Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: ios/chrome/browser/web/stop_loading_egtest.mm

Issue 2642193012: Make EarlGrey matchers compliant with Chromium style. (Closed)
Patch Set: build.gn and rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <EarlGrey/EarlGrey.h> 5 #import <EarlGrey/EarlGrey.h>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ios/chrome/browser/ui/ui_util.h" 10 #include "ios/chrome/browser/ui/ui_util.h"
11 #include "ios/chrome/test/app/navigation_test_util.h" 11 #include "ios/chrome/test/app/navigation_test_util.h"
12 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" 12 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
13 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 13 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
14 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 14 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
15 #import "ios/web/public/test/http_server.h" 15 #import "ios/web/public/test/http_server.h"
16 #include "ios/web/public/test/http_server_util.h" 16 #include "ios/web/public/test/http_server_util.h"
17 #include "ios/web/public/test/response_providers/html_response_provider.h" 17 #include "ios/web/public/test/response_providers/html_response_provider.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 using chrome_test_util::buttonWithAccessibilityLabelId; 20 using chrome_test_util::ButtonWithAccessibilityLabelId;
21 using chrome_test_util::webViewContainingText; 21 using chrome_test_util::WebViewContainingText;
22 22
23 namespace { 23 namespace {
24 24
25 // Text appearing on the navigation test page. 25 // Text appearing on the navigation test page.
26 const char kPageText[] = "Navigation testing page"; 26 const char kPageText[] = "Navigation testing page";
27 27
28 // Response provider that serves the page which never finishes loading. 28 // Response provider that serves the page which never finishes loading.
29 class InfinitePendingResponseProvider : public HtmlResponseProvider { 29 class InfinitePendingResponseProvider : public HtmlResponseProvider {
30 public: 30 public:
31 explicit InfinitePendingResponseProvider(const GURL& url) : url_(url) {} 31 explicit InfinitePendingResponseProvider(const GURL& url) : url_(url) {}
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (IsIPadIdiom()) { 95 if (IsIPadIdiom()) {
96 // Disable EG synchronization so the framework does not wait until the tab 96 // Disable EG synchronization so the framework does not wait until the tab
97 // loading spinner becomes idle (which will not happen until the stop button 97 // loading spinner becomes idle (which will not happen until the stop button
98 // is tapped). 98 // is tapped).
99 [[GREYConfiguration sharedInstance] 99 [[GREYConfiguration sharedInstance]
100 setValue:@NO 100 setValue:@NO
101 forConfigKey:kGREYConfigKeySynchronizationEnabled]; 101 forConfigKey:kGREYConfigKeySynchronizationEnabled];
102 } 102 }
103 103
104 // Wait until the page is half loaded. 104 // Wait until the page is half loaded.
105 [[EarlGrey selectElementWithMatcher:webViewContainingText(kPageText)] 105 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kPageText)]
106 assertWithMatcher:grey_notNil()]; 106 assertWithMatcher:grey_notNil()];
107 107
108 // On iPhone Stop/Reload button is a part of tools menu, so open it. 108 // On iPhone Stop/Reload button is a part of tools menu, so open it.
109 if (!IsIPadIdiom()) { 109 if (!IsIPadIdiom()) {
110 [ChromeEarlGreyUI openToolsMenu]; 110 [ChromeEarlGreyUI openToolsMenu];
111 } 111 }
112 112
113 // Verify that stop button is visible and reload button is hidden. 113 // Verify that stop button is visible and reload button is hidden.
114 [[EarlGrey selectElementWithMatcher:chrome_test_util::stopButton()] 114 [[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
115 assertWithMatcher:grey_sufficientlyVisible()]; 115 assertWithMatcher:grey_sufficientlyVisible()];
116 [[EarlGrey selectElementWithMatcher:chrome_test_util::reloadButton()] 116 [[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()]
117 assertWithMatcher:grey_notVisible()]; 117 assertWithMatcher:grey_notVisible()];
118 118
119 // Stop the page loading. 119 // Stop the page loading.
120 [[EarlGrey selectElementWithMatcher:chrome_test_util::stopButton()] 120 [[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
121 performAction:grey_tap()]; 121 performAction:grey_tap()];
122 122
123 // Enable synchronization back. The spinner should become idle and test should 123 // Enable synchronization back. The spinner should become idle and test should
124 // wait for it. 124 // wait for it.
125 [[GREYConfiguration sharedInstance] 125 [[GREYConfiguration sharedInstance]
126 setValue:@YES 126 setValue:@YES
127 forConfigKey:kGREYConfigKeySynchronizationEnabled]; 127 forConfigKey:kGREYConfigKeySynchronizationEnabled];
128 128
129 // Verify that stop button is hidden and reload button is visible. 129 // Verify that stop button is hidden and reload button is visible.
130 if (!IsIPadIdiom()) { 130 if (!IsIPadIdiom()) {
131 [ChromeEarlGreyUI openToolsMenu]; 131 [ChromeEarlGreyUI openToolsMenu];
132 } 132 }
133 [[EarlGrey selectElementWithMatcher:chrome_test_util::stopButton()] 133 [[EarlGrey selectElementWithMatcher:chrome_test_util::StopButton()]
134 assertWithMatcher:grey_notVisible()]; 134 assertWithMatcher:grey_notVisible()];
135 [[EarlGrey selectElementWithMatcher:chrome_test_util::reloadButton()] 135 [[EarlGrey selectElementWithMatcher:chrome_test_util::ReloadButton()]
136 assertWithMatcher:grey_sufficientlyVisible()]; 136 assertWithMatcher:grey_sufficientlyVisible()];
137 } 137 }
138 138
139 @end 139 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/push_and_replace_state_navigation_egtest.mm ('k') | ios/chrome/browser/web/visible_url_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698