Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <XCTest/XCTest.h> | 5 #import <XCTest/XCTest.h> |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "components/strings/grit/components_strings.h" | 8 #include "components/strings/grit/components_strings.h" |
| 9 #include "ios/chrome/browser/ui/ui_util.h" | 9 #include "ios/chrome/browser/ui/ui_util.h" |
| 10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 10 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 "http://ios/testing/data/http_server_files/history.html#replaceWithObject"; | 25 "http://ios/testing/data/http_server_files/history.html#replaceWithObject"; |
| 26 const char* kPushStateHashStringURL = | 26 const char* kPushStateHashStringURL = |
| 27 "http://ios/testing/data/http_server_files/history.html#string"; | 27 "http://ios/testing/data/http_server_files/history.html#string"; |
| 28 const char* kReplaceStateHashStringURL = | 28 const char* kReplaceStateHashStringURL = |
| 29 "http://ios/testing/data/http_server_files/history.html#replace"; | 29 "http://ios/testing/data/http_server_files/history.html#replace"; |
| 30 const char* kPushStatePathURL = | 30 const char* kPushStatePathURL = |
| 31 "http://ios/testing/data/http_server_files/path"; | 31 "http://ios/testing/data/http_server_files/path"; |
| 32 const char* kReplaceStateRootPathSpaceURL = "http://ios/rep lace"; | 32 const char* kReplaceStateRootPathSpaceURL = "http://ios/rep lace"; |
| 33 | 33 |
| 34 // Matcher for the navigate forward button. | 34 // Matcher for the navigate forward button. |
| 35 id<GREYMatcher> forwardButton() { | 35 id<GREYMatcher> ForwardButton() { |
|
Eugene But (OOO till 7-30)
2017/01/23 19:39:04
Could you please use existing matchers from chrome
baxley
2017/01/24 22:18:50
Done.
| |
| 36 return chrome_test_util::buttonWithAccessibilityLabelId(IDS_ACCNAME_FORWARD); | 36 return chrome_test_util::ButtonWithAccessibilityLabelId(IDS_ACCNAME_FORWARD); |
| 37 } | 37 } |
| 38 // Matcher for the navigate backward button. | 38 // Matcher for the navigate backward button. |
| 39 id<GREYMatcher> backButton() { | 39 id<GREYMatcher> BackButton() { |
| 40 return chrome_test_util::buttonWithAccessibilityLabelId(IDS_ACCNAME_BACK); | 40 return chrome_test_util::ButtonWithAccessibilityLabelId(IDS_ACCNAME_BACK); |
| 41 } | 41 } |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 // Tests for pushState/replaceState navigations. | 44 // Tests for pushState/replaceState navigations. |
| 45 @interface PushAndReplaceStateNavigationTestCase : ChromeTestCase | 45 @interface PushAndReplaceStateNavigationTestCase : ChromeTestCase |
| 46 @end | 46 @end |
| 47 | 47 |
| 48 @implementation PushAndReplaceStateNavigationTestCase | 48 @implementation PushAndReplaceStateNavigationTestCase |
| 49 | 49 |
| 50 // Tests calling history.pushState() multiple times and navigating back/forward. | 50 // Tests calling history.pushState() multiple times and navigating back/forward. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 69 withURL:pushStateRootPathURL | 69 withURL:pushStateRootPathURL |
| 70 pageLoaded:NO]; | 70 pageLoaded:NO]; |
| 71 | 71 |
| 72 [ChromeEarlGrey tapWebViewElementWithID:@"pushStatePathSpace"]; | 72 [ChromeEarlGrey tapWebViewElementWithID:@"pushStatePathSpace"]; |
| 73 [self assertStatusText:@"pushStatePathSpace" | 73 [self assertStatusText:@"pushStatePathSpace" |
| 74 withURL:pushStatePathSpaceURL | 74 withURL:pushStatePathSpaceURL |
| 75 pageLoaded:NO]; | 75 pageLoaded:NO]; |
| 76 | 76 |
| 77 // Go back and check that the page doesn't load and the status text is updated | 77 // Go back and check that the page doesn't load and the status text is updated |
| 78 // by the popstate event. | 78 // by the popstate event. |
| 79 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 79 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 80 [self assertStatusText:@"pushStateRootPath" | 80 [self assertStatusText:@"pushStateRootPath" |
| 81 withURL:pushStateRootPathURL | 81 withURL:pushStateRootPathURL |
| 82 pageLoaded:NO]; | 82 pageLoaded:NO]; |
| 83 | 83 |
| 84 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 84 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 85 [self assertStatusText:@"pushStateHashWithObject" | 85 [self assertStatusText:@"pushStateHashWithObject" |
| 86 withURL:pushStateHashWithObjectURL | 86 withURL:pushStateHashWithObjectURL |
| 87 pageLoaded:NO]; | 87 pageLoaded:NO]; |
| 88 | 88 |
| 89 [ChromeEarlGrey tapWebViewElementWithID:@"goBack"]; | 89 [ChromeEarlGrey tapWebViewElementWithID:@"goBack"]; |
| 90 const GURL historyTestURL = web::test::HttpServer::MakeUrl(kHistoryTestUrl); | 90 const GURL historyTestURL = web::test::HttpServer::MakeUrl(kHistoryTestUrl); |
| 91 [self assertStatusText:NULL withURL:historyTestURL pageLoaded:NO]; | 91 [self assertStatusText:NULL withURL:historyTestURL pageLoaded:NO]; |
| 92 | 92 |
| 93 // Go forward 2 pages and check that the page doesn't load and the status text | 93 // Go forward 2 pages and check that the page doesn't load and the status text |
| 94 // is updated by the popstate event. | 94 // is updated by the popstate event. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 106 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kHistoryTestUrl)]; | 106 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kHistoryTestUrl)]; |
| 107 | 107 |
| 108 // Replace the URL and go back then forward. | 108 // Replace the URL and go back then forward. |
| 109 const GURL replaceStateHashWithObjectURL = | 109 const GURL replaceStateHashWithObjectURL = |
| 110 web::test::HttpServer::MakeUrl(kReplaceStateHashWithObjectURL); | 110 web::test::HttpServer::MakeUrl(kReplaceStateHashWithObjectURL); |
| 111 [ChromeEarlGrey tapWebViewElementWithID:@"replaceStateHashWithObject"]; | 111 [ChromeEarlGrey tapWebViewElementWithID:@"replaceStateHashWithObject"]; |
| 112 [self assertStatusText:@"replaceStateHashWithObject" | 112 [self assertStatusText:@"replaceStateHashWithObject" |
| 113 withURL:replaceStateHashWithObjectURL | 113 withURL:replaceStateHashWithObjectURL |
| 114 pageLoaded:NO]; | 114 pageLoaded:NO]; |
| 115 | 115 |
| 116 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 116 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 117 [[EarlGrey selectElementWithMatcher:chrome_test_util::omniboxText( | 117 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 118 initialURL.GetContent())] | 118 initialURL.GetContent())] |
| 119 assertWithMatcher:grey_notNil()]; | 119 assertWithMatcher:grey_notNil()]; |
| 120 | 120 |
| 121 [[EarlGrey selectElementWithMatcher:forwardButton()] | 121 [[EarlGrey selectElementWithMatcher:ForwardButton()] |
| 122 performAction:grey_tap()]; | 122 performAction:grey_tap()]; |
| 123 [self assertStatusText:@"replaceStateHashWithObject" | 123 [self assertStatusText:@"replaceStateHashWithObject" |
| 124 withURL:replaceStateHashWithObjectURL | 124 withURL:replaceStateHashWithObjectURL |
| 125 pageLoaded:YES]; | 125 pageLoaded:YES]; |
| 126 | 126 |
| 127 // Push URL then replace it. Do this twice. | 127 // Push URL then replace it. Do this twice. |
| 128 const GURL pushStateHashStringURL = | 128 const GURL pushStateHashStringURL = |
| 129 web::test::HttpServer::MakeUrl(kPushStateHashStringURL); | 129 web::test::HttpServer::MakeUrl(kPushStateHashStringURL); |
| 130 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateHashString"]; | 130 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateHashString"]; |
| 131 [self assertStatusText:@"pushStateHashString" | 131 [self assertStatusText:@"pushStateHashString" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 147 pageLoaded:NO]; | 147 pageLoaded:NO]; |
| 148 | 148 |
| 149 const GURL replaceStateRootPathSpaceURL = | 149 const GURL replaceStateRootPathSpaceURL = |
| 150 web::test::HttpServer::MakeUrl(kReplaceStateRootPathSpaceURL); | 150 web::test::HttpServer::MakeUrl(kReplaceStateRootPathSpaceURL); |
| 151 [ChromeEarlGrey tapWebViewElementWithID:@"replaceStateRootPathSpace"]; | 151 [ChromeEarlGrey tapWebViewElementWithID:@"replaceStateRootPathSpace"]; |
| 152 [self assertStatusText:@"replaceStateRootPathSpace" | 152 [self assertStatusText:@"replaceStateRootPathSpace" |
| 153 withURL:replaceStateRootPathSpaceURL | 153 withURL:replaceStateRootPathSpaceURL |
| 154 pageLoaded:NO]; | 154 pageLoaded:NO]; |
| 155 | 155 |
| 156 // Go back and check URLs. | 156 // Go back and check URLs. |
| 157 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 157 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 158 [self assertStatusText:@"replaceStateHashString" | 158 [self assertStatusText:@"replaceStateHashString" |
| 159 withURL:replaceStateHashStringURL | 159 withURL:replaceStateHashStringURL |
| 160 pageLoaded:NO]; | 160 pageLoaded:NO]; |
| 161 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 161 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 162 [self assertStatusText:@"replaceStateHashWithObject" | 162 [self assertStatusText:@"replaceStateHashWithObject" |
| 163 withURL:replaceStateHashWithObjectURL | 163 withURL:replaceStateHashWithObjectURL |
| 164 pageLoaded:NO]; | 164 pageLoaded:NO]; |
| 165 | 165 |
| 166 // Go forward and check URL. | 166 // Go forward and check URL. |
| 167 [ChromeEarlGrey tapWebViewElementWithID:@"goForward2"]; | 167 [ChromeEarlGrey tapWebViewElementWithID:@"goForward2"]; |
| 168 [self assertStatusText:@"replaceStateRootPathSpace" | 168 [self assertStatusText:@"replaceStateRootPathSpace" |
| 169 withURL:replaceStateRootPathSpaceURL | 169 withURL:replaceStateRootPathSpaceURL |
| 170 pageLoaded:NO]; | 170 pageLoaded:NO]; |
| 171 } | 171 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 196 [ChromeEarlGrey loadURL:historyTestURL]; | 196 [ChromeEarlGrey loadURL:historyTestURL]; |
| 197 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateHashString"]; | 197 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateHashString"]; |
| 198 [self assertStatusText:@"pushStateHashString" | 198 [self assertStatusText:@"pushStateHashString" |
| 199 withURL:pushStateHashStringURL | 199 withURL:pushStateHashStringURL |
| 200 pageLoaded:NO]; | 200 pageLoaded:NO]; |
| 201 | 201 |
| 202 // At this point the history looks like this: | 202 // At this point the history looks like this: |
| 203 // [NTP, history.html, #string, #string, nonPushedURL, history.html, #string] | 203 // [NTP, history.html, #string, #string, nonPushedURL, history.html, #string] |
| 204 | 204 |
| 205 // Go back (to second history.html) and verify page did not load. | 205 // Go back (to second history.html) and verify page did not load. |
| 206 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 206 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 207 [self assertStatusText:nil withURL:historyTestURL pageLoaded:NO]; | 207 [self assertStatusText:nil withURL:historyTestURL pageLoaded:NO]; |
| 208 | 208 |
| 209 // Go back twice (to second #string) and verify page did load. | 209 // Go back twice (to second #string) and verify page did load. |
| 210 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 210 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 211 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 211 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 212 [self assertStatusText:nil withURL:pushStateHashStringURL pageLoaded:YES]; | 212 [self assertStatusText:nil withURL:pushStateHashStringURL pageLoaded:YES]; |
| 213 | 213 |
| 214 // Go back once (to first #string) and verify page did not load. | 214 // Go back once (to first #string) and verify page did not load. |
| 215 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 215 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 216 [self assertStatusText:@"pushStateHashString" | 216 [self assertStatusText:@"pushStateHashString" |
| 217 withURL:pushStateHashStringURL | 217 withURL:pushStateHashStringURL |
| 218 pageLoaded:NO]; | 218 pageLoaded:NO]; |
| 219 | 219 |
| 220 // Go forward 4 entries at once (to third #string) and verify page did load. | 220 // Go forward 4 entries at once (to third #string) and verify page did load. |
| 221 [ChromeEarlGrey tapWebViewElementWithID:@"goForward4"]; | 221 [ChromeEarlGrey tapWebViewElementWithID:@"goForward4"]; |
| 222 | 222 |
| 223 [self assertStatusText:nil withURL:pushStateHashStringURL pageLoaded:YES]; | 223 [self assertStatusText:nil withURL:pushStateHashStringURL pageLoaded:YES]; |
| 224 | 224 |
| 225 // Go back 4 entries at once (to first #string) and verify page did load. | 225 // Go back 4 entries at once (to first #string) and verify page did load. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 243 | 243 |
| 244 web::test::SetUpFileBasedHttpServer(); | 244 web::test::SetUpFileBasedHttpServer(); |
| 245 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kHistoryTestUrl)]; | 245 [ChromeEarlGrey loadURL:web::test::HttpServer::MakeUrl(kHistoryTestUrl)]; |
| 246 | 246 |
| 247 // TODO(crbug.com/643458): The fact that the URL shows %-escaped is due to | 247 // TODO(crbug.com/643458): The fact that the URL shows %-escaped is due to |
| 248 // NSURL escaping to make UIWebView/JS happy. See if it's possible to | 248 // NSURL escaping to make UIWebView/JS happy. See if it's possible to |
| 249 // represent differently such that it displays unescaped. | 249 // represent differently such that it displays unescaped. |
| 250 // Do 2 push states with unicode characters. | 250 // Do 2 push states with unicode characters. |
| 251 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateUnicode"]; | 251 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateUnicode"]; |
| 252 [[EarlGrey | 252 [[EarlGrey |
| 253 selectElementWithMatcher:chrome_test_util::omniboxText( | 253 selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 254 pushStateUnicodeURLEncoded.GetContent())] | 254 pushStateUnicodeURLEncoded.GetContent())] |
| 255 assertWithMatcher:grey_notNil()]; | 255 assertWithMatcher:grey_notNil()]; |
| 256 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 256 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 257 pushStateUnicodeLabel)] | 257 pushStateUnicodeLabel)] |
| 258 assertWithMatcher:grey_notNil()]; | 258 assertWithMatcher:grey_notNil()]; |
| 259 | 259 |
| 260 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateUnicode2"]; | 260 [ChromeEarlGrey tapWebViewElementWithID:@"pushStateUnicode2"]; |
| 261 [[EarlGrey | 261 [[EarlGrey |
| 262 selectElementWithMatcher:chrome_test_util::omniboxText( | 262 selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 263 pushStateUnicode2URLEncoded.GetContent())] | 263 pushStateUnicode2URLEncoded.GetContent())] |
| 264 assertWithMatcher:grey_notNil()]; | 264 assertWithMatcher:grey_notNil()]; |
| 265 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 265 [[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 266 pushStateUnicode2Label)] | 266 pushStateUnicode2Label)] |
| 267 assertWithMatcher:grey_notNil()]; | 267 assertWithMatcher:grey_notNil()]; |
| 268 | 268 |
| 269 // Do a push state without a unicode character. | 269 // Do a push state without a unicode character. |
| 270 const GURL pushStatePathURL = | 270 const GURL pushStatePathURL = |
| 271 web::test::HttpServer::MakeUrl(kPushStatePathURL); | 271 web::test::HttpServer::MakeUrl(kPushStatePathURL); |
| 272 [ChromeEarlGrey tapWebViewElementWithID:@"pushStatePath"]; | 272 [ChromeEarlGrey tapWebViewElementWithID:@"pushStatePath"]; |
| 273 | 273 |
| 274 [self assertStatusText:@"pushStatePath" | 274 [self assertStatusText:@"pushStatePath" |
| 275 withURL:pushStatePathURL | 275 withURL:pushStatePathURL |
| 276 pageLoaded:NO]; | 276 pageLoaded:NO]; |
| 277 | 277 |
| 278 // Go back and check the unicode in the URL and status. | 278 // Go back and check the unicode in the URL and status. |
| 279 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 279 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 280 [self assertStatusText:pushStateUnicode2Status | 280 [self assertStatusText:pushStateUnicode2Status |
| 281 withURL:pushStateUnicode2URLEncoded | 281 withURL:pushStateUnicode2URLEncoded |
| 282 pageLoaded:NO]; | 282 pageLoaded:NO]; |
| 283 | 283 |
| 284 [[EarlGrey selectElementWithMatcher:backButton()] performAction:grey_tap()]; | 284 [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()]; |
| 285 [self assertStatusText:pushStateUnicodeStatus | 285 [self assertStatusText:pushStateUnicodeStatus |
| 286 withURL:pushStateUnicodeURLEncoded | 286 withURL:pushStateUnicodeURLEncoded |
| 287 pageLoaded:NO]; | 287 pageLoaded:NO]; |
| 288 } | 288 } |
| 289 | 289 |
| 290 // Tests that pushState/replaceState handling properly handles <base>. | 290 // Tests that pushState/replaceState handling properly handles <base>. |
| 291 - (void)testHtml5HistoryWithBase { | 291 - (void)testHtml5HistoryWithBase { |
| 292 std::map<GURL, std::string> responses; | 292 std::map<GURL, std::string> responses; |
| 293 GURL originURL = | 293 GURL originURL = |
| 294 web::test::HttpServer::MakeUrl("http://foo.com/foo/bar.html"); | 294 web::test::HttpServer::MakeUrl("http://foo.com/foo/bar.html"); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 308 "id=\"replaceState\" onclick=\"history.replaceState(" | 308 "id=\"replaceState\" onclick=\"history.replaceState(" |
| 309 "{}, 'Foo', './replaced/relative/url');\"><br>"; | 309 "{}, 'Foo', './replaced/relative/url');\"><br>"; |
| 310 NSString* simplePage = | 310 NSString* simplePage = |
| 311 @"<!doctype html><html><head>%@</head><body>%@</body></html>"; | 311 @"<!doctype html><html><head>%@</head><body>%@</body></html>"; |
| 312 responses[originURL] = base::SysNSStringToUTF8( | 312 responses[originURL] = base::SysNSStringToUTF8( |
| 313 [NSString stringWithFormat:simplePage, baseTag, pushAndReplaceButtons]); | 313 [NSString stringWithFormat:simplePage, baseTag, pushAndReplaceButtons]); |
| 314 web::test::SetUpSimpleHttpServer(responses); | 314 web::test::SetUpSimpleHttpServer(responses); |
| 315 | 315 |
| 316 [ChromeEarlGrey loadURL:originURL]; | 316 [ChromeEarlGrey loadURL:originURL]; |
| 317 [ChromeEarlGrey tapWebViewElementWithID:@"pushState"]; | 317 [ChromeEarlGrey tapWebViewElementWithID:@"pushState"]; |
| 318 [[EarlGrey selectElementWithMatcher:chrome_test_util::omniboxText( | 318 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 319 pushResultURL.GetContent())] | 319 pushResultURL.GetContent())] |
| 320 assertWithMatcher:grey_notNil()]; | 320 assertWithMatcher:grey_notNil()]; |
| 321 | 321 |
| 322 [ChromeEarlGrey tapWebViewElementWithID:@"replaceState"]; | 322 [ChromeEarlGrey tapWebViewElementWithID:@"replaceState"]; |
| 323 [[EarlGrey selectElementWithMatcher:chrome_test_util::omniboxText( | 323 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 324 replaceResultURL.GetContent())] | 324 replaceResultURL.GetContent())] |
| 325 assertWithMatcher:grey_notNil()]; | 325 assertWithMatcher:grey_notNil()]; |
| 326 } | 326 } |
| 327 | 327 |
| 328 #pragma mark - Utility methods | 328 #pragma mark - Utility methods |
| 329 | 329 |
| 330 // Assert that status text |status| is displayed in the webview, that "onloaded" | 330 // Assert that status text |status| is displayed in the webview, that "onloaded" |
| 331 // text is displayed if pageLoaded is YES, and that the URL is as expected. | 331 // text is displayed if pageLoaded is YES, and that the URL is as expected. |
| 332 - (void)assertStatusText:(NSString*)status | 332 - (void)assertStatusText:(NSString*)status |
| 333 withURL:(const GURL&)urlToVerify | 333 withURL:(const GURL&)urlToVerify |
| 334 pageLoaded:(BOOL)pageLoaded { | 334 pageLoaded:(BOOL)pageLoaded { |
| 335 id<GREYMatcher> pageLoadedMatcher = | 335 id<GREYMatcher> pageLoadedMatcher = |
| 336 pageLoaded ? chrome_test_util::webViewContainingText("onload") | 336 pageLoaded ? chrome_test_util::WebViewContainingText("onload") |
| 337 : chrome_test_util::webViewNotContainingText("onload"); | 337 : chrome_test_util::WebViewNotContainingText("onload"); |
| 338 [[EarlGrey selectElementWithMatcher:pageLoadedMatcher] | 338 [[EarlGrey selectElementWithMatcher:pageLoadedMatcher] |
| 339 assertWithMatcher:grey_notNil()]; | 339 assertWithMatcher:grey_notNil()]; |
| 340 | 340 |
| 341 if (status != NULL) { | 341 if (status != NULL) { |
| 342 NSString* statusLabel = [NSString stringWithFormat:@"Action: %@", status]; | 342 NSString* statusLabel = [NSString stringWithFormat:@"Action: %@", status]; |
| 343 [[EarlGrey | 343 [[EarlGrey |
| 344 selectElementWithMatcher:chrome_test_util::webViewContainingText( | 344 selectElementWithMatcher:chrome_test_util::WebViewContainingText( |
| 345 base::SysNSStringToUTF8(statusLabel))] | 345 base::SysNSStringToUTF8(statusLabel))] |
| 346 assertWithMatcher:grey_notNil()]; | 346 assertWithMatcher:grey_notNil()]; |
| 347 } | 347 } |
| 348 | 348 |
| 349 [[EarlGrey selectElementWithMatcher:chrome_test_util::omniboxText( | 349 [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| 350 urlToVerify.GetContent())] | 350 urlToVerify.GetContent())] |
| 351 assertWithMatcher:grey_notNil()]; | 351 assertWithMatcher:grey_notNil()]; |
| 352 } | 352 } |
| 353 | 353 |
| 354 @end | 354 @end |
| OLD | NEW |