Commit f148a549 authored by Maksym Onufriienko's avatar Maksym Onufriienko Committed by Commit Bot

Replace [GREYConfiguration sharedInstance] with ScopedSynchronizationDisabler.

This is part of EG1 to EG2 migration, which involves moving
EarlGrey code from app-side helpers into test code.
EarlGrey2 has multiprocess architecture,
where Chrome Test and Chrome App are separate processes

Change-Id: I2468c4ff67829084ffc563822b8d53997367b9bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733036Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Maksym Onufriienko <monufriienko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684225}
parent 54451172
...@@ -78,15 +78,6 @@ class InfinitePendingResponseProvider : public HtmlResponseProvider { ...@@ -78,15 +78,6 @@ class InfinitePendingResponseProvider : public HtmlResponseProvider {
@implementation StopLoadingTestCase @implementation StopLoadingTestCase
- (void)tearDown {
// |testStopLoading| Disables synchronization, so make sure that it is enabled
// if that test has failed and did not enable it back.
[[GREYConfiguration sharedInstance]
setValue:@YES
forConfigKey:kGREYConfigKeySynchronizationEnabled];
[super tearDown];
}
// Tests that tapping "Stop" button stops the loading. // Tests that tapping "Stop" button stops the loading.
- (void)testStopLoading { - (void)testStopLoading {
// Load a page which never finishes loading. // Load a page which never finishes loading.
...@@ -107,34 +98,31 @@ class InfinitePendingResponseProvider : public HtmlResponseProvider { ...@@ -107,34 +98,31 @@ class InfinitePendingResponseProvider : public HtmlResponseProvider {
// Disable EG synchronization so the framework does not wait until the tab // Disable EG synchronization so the framework does not wait until the tab
// loading spinner becomes idle (which will not happen until the stop button // loading spinner becomes idle (which will not happen until the stop button
// is tapped). // is tapped).
[[GREYConfiguration sharedInstance] ScopedSynchronizationDisabler disabler;
setValue:@NO // Wait until the page is half loaded.
forConfigKey:kGREYConfigKeySynchronizationEnabled]; [ChromeEarlGrey waitForWebStateContainingText:kPageText];
} // Verify that stop button is visible and reload button is hidden.
[[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
assertWithMatcher:grey_sufficientlyVisible()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()]
assertWithMatcher:grey_notVisible()];
// Stop the page loading.
[[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
performAction:grey_tap()];
} else {
// Wait until the page is half loaded. // Wait until the page is half loaded.
[ChromeEarlGrey waitForWebStateContainingText:kPageText]; [ChromeEarlGrey waitForWebStateContainingText:kPageText];
// On iPhone Stop/Reload button is a part of tools menu, so open it. // On iPhone Stop/Reload button is a part of tools menu, so open it.
if (![ChromeEarlGrey isIPadIdiom]) {
[ChromeEarlGreyUI openToolsMenu]; [ChromeEarlGreyUI openToolsMenu];
}
// Verify that stop button is visible and reload button is hidden. // Verify that stop button is visible and reload button is hidden.
[[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()] [[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()] [[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()]
assertWithMatcher:grey_notVisible()]; assertWithMatcher:grey_notVisible()];
// Stop the page loading. // Stop the page loading.
[[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()] [[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
performAction:grey_tap()]; performAction:grey_tap()];
}
// Enable synchronization back. The spinner should become idle and test
// should wait for it.
[[GREYConfiguration sharedInstance]
setValue:@YES
forConfigKey:kGREYConfigKeySynchronizationEnabled];
// Verify that stop button is hidden and reload button is visible. // Verify that stop button is hidden and reload button is visible.
if (![ChromeEarlGrey isIPadIdiom]) { if (![ChromeEarlGrey isIPadIdiom]) {
......
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