Commit 6de57b8d authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Reenable OverscrollActions tests on device

The tests now pass after
https://chromium-review.googlesource.com/c/chromium/src/+/2446782. See
below for a hypothesis on the root causes.

The root cause of the issue is a unclear, but seems to be as follows:
The overscroll state is supposed to change twice, once to
STARTED_PULLING after the |-scrollViewDidScroll| call, and once to
ACTION_READY after the contentOffset is updated. This happens
on simulator, but on device, the first change actually causes the
overscroll state to change to NO_PULL_STARTED.

This seems to be because on device, the initial contentOffset is 0,
while on simulator, it is ~ -2.46E-314, which compares less than 0 in
|OverscrollActionsController scrollViewDidScroll|. To fix this, I
changed the content offset in the test manually to a small number less
than 0.

Bug: 944599
Change-Id: I0d062e6ab9d20aca0b85810375b0081186fef48a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390381
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarMohammad Refaat <mrefaat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820216}
parent f8b23beb
...@@ -86,13 +86,7 @@ class OverscrollActionsTabHelperTest : public PlatformTest { ...@@ -86,13 +86,7 @@ class OverscrollActionsTabHelperTest : public PlatformTest {
// Tests that OverscrollActionsControllerDelegate is set correctly and triggered // Tests that OverscrollActionsControllerDelegate is set correctly and triggered
// When there is a view pull. // When there is a view pull.
// TODO(crbug.com/944599): Fails on device. TEST_F(OverscrollActionsTabHelperTest, TestDelegateTrigger) {
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_TestDelegateTrigger TestDelegateTrigger
#else
#define MAYBE_TestDelegateTrigger DISABLED_TestDelegateTrigger
#endif
TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestDelegateTrigger) {
web_state_.SetBrowserState(browser_state_.get()); web_state_.SetBrowserState(browser_state_.get());
overscroll_tab_helper()->SetDelegate(overscroll_delegate_); overscroll_tab_helper()->SetDelegate(overscroll_delegate_);
// Start pull for page refresh action. // Start pull for page refresh action.
...@@ -108,13 +102,7 @@ TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestDelegateTrigger) { ...@@ -108,13 +102,7 @@ TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestDelegateTrigger) {
// Tests that overscrolls actions view style is set correctly, for regular // Tests that overscrolls actions view style is set correctly, for regular
// browsing browser state. // browsing browser state.
// TODO(crbug.com/944599): Fails on device. TEST_F(OverscrollActionsTabHelperTest, TestRegularBrowserStateStyle) {
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_TestRegularBrowserStateStyle TestRegularBrowserStateStyle
#else
#define MAYBE_TestRegularBrowserStateStyle DISABLED_TestRegularBrowserStateStyle
#endif
TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestRegularBrowserStateStyle) {
web_state_.SetBrowserState(browser_state_.get()); web_state_.SetBrowserState(browser_state_.get());
overscroll_tab_helper()->SetDelegate(overscroll_delegate_); overscroll_tab_helper()->SetDelegate(overscroll_delegate_);
SimulatePullForRefreshAction(); SimulatePullForRefreshAction();
...@@ -125,16 +113,7 @@ TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestRegularBrowserStateStyle) { ...@@ -125,16 +113,7 @@ TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestRegularBrowserStateStyle) {
// Tests that overscrolls actions view style is set correctly, for off the // Tests that overscrolls actions view style is set correctly, for off the
// record browser state. // record browser state.
// TODO(crbug.com/944599): Fails on device. TEST_F(OverscrollActionsTabHelperTest, TestOffTheRecordBrowserStateStyle) {
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_TestOffTheRecordBrowserStateStyle \
TestOffTheRecordBrowserStateStyle
#else
#define MAYBE_TestOffTheRecordBrowserStateStyle \
DISABLED_TestOffTheRecordBrowserStateStyle
#endif
TEST_F(OverscrollActionsTabHelperTest,
MAYBE_TestOffTheRecordBrowserStateStyle) {
web_state_.SetBrowserState( web_state_.SetBrowserState(
browser_state_->GetOffTheRecordChromeBrowserState()); browser_state_->GetOffTheRecordChromeBrowserState());
overscroll_tab_helper()->SetDelegate(overscroll_delegate_); overscroll_tab_helper()->SetDelegate(overscroll_delegate_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment