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 <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/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "ios/chrome/browser/experimental_flags.h" | |
11 #include "ios/chrome/browser/ui/ui_util.h" | 10 #include "ios/chrome/browser/ui/ui_util.h" |
12 #import "ios/chrome/test/app/chrome_test_util.h" | 11 #import "ios/chrome/test/app/chrome_test_util.h" |
13 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 12 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
14 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" | 13 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
15 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 14 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
16 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 15 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
17 #import "ios/testing/earl_grey/disabled_test_macros.h" | |
18 #import "ios/web/public/test/http_server.h" | 16 #import "ios/web/public/test/http_server.h" |
19 #include "ios/web/public/test/http_server_util.h" | 17 #include "ios/web/public/test/http_server_util.h" |
20 #include "ios/web/public/test/response_providers/html_response_provider.h" | 18 #include "ios/web/public/test/response_providers/html_response_provider.h" |
21 #include "ios/web/public/test/url_test_util.h" | 19 #include "ios/web/public/test/url_test_util.h" |
22 #include "url/gurl.h" | 20 #include "url/gurl.h" |
23 | 21 |
24 using chrome_test_util::WebViewContainingText; | 22 using chrome_test_util::WebViewContainingText; |
25 using chrome_test_util::OmniboxText; | 23 using chrome_test_util::OmniboxText; |
26 | 24 |
27 namespace { | 25 namespace { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 forConfigKey:kGREYConfigKeySynchronizationEnabled]; | 166 forConfigKey:kGREYConfigKeySynchronizationEnabled]; |
169 [super tearDown]; | 167 [super tearDown]; |
170 } | 168 } |
171 | 169 |
172 #pragma mark - | 170 #pragma mark - |
173 #pragma mark Tests | 171 #pragma mark Tests |
174 | 172 |
175 // Tests that visible URL is always the same as last committed URL during | 173 // Tests that visible URL is always the same as last committed URL during |
176 // pending back and forward navigations. | 174 // pending back and forward navigations. |
177 - (void)testBackForwardNavigation { | 175 - (void)testBackForwardNavigation { |
178 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
179 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
180 } | |
181 | |
182 // Purge web view caches and pause the server to make sure that tests can | 176 // Purge web view caches and pause the server to make sure that tests can |
183 // verify omnibox state before server starts responding. | 177 // verify omnibox state before server starts responding. |
184 PurgeCachedWebViewPages(); | 178 PurgeCachedWebViewPages(); |
185 [self setServerPaused:YES]; | 179 [self setServerPaused:YES]; |
186 | 180 |
187 // Tap the back button in the toolbar and verify that URL2 (committed URL) is | 181 // Tap the back button in the toolbar and verify that URL2 (committed URL) is |
188 // displayed even though URL1 is a pending URL. | 182 // displayed even though URL1 is a pending URL. |
189 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] | 183 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
190 performAction:grey_tap()]; | 184 performAction:grey_tap()]; |
191 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], | 185 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], |
(...skipping 26 matching lines...) Expand all Loading... |
218 [self setServerPaused:NO]; | 212 [self setServerPaused:NO]; |
219 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] | 213 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] |
220 assertWithMatcher:grey_notNil()]; | 214 assertWithMatcher:grey_notNil()]; |
221 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] | 215 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] |
222 assertWithMatcher:grey_notNil()]; | 216 assertWithMatcher:grey_notNil()]; |
223 } | 217 } |
224 | 218 |
225 // Tests that visible URL is always the same as last committed URL during | 219 // Tests that visible URL is always the same as last committed URL during |
226 // pending navigations initialted from back history popover. | 220 // pending navigations initialted from back history popover. |
227 - (void)testHistoryNavigation { | 221 - (void)testHistoryNavigation { |
228 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
229 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
230 } | |
231 | |
232 // Purge web view caches and pause the server to make sure that tests can | 222 // Purge web view caches and pause the server to make sure that tests can |
233 // verify omnibox state before server starts responding. | 223 // verify omnibox state before server starts responding. |
234 PurgeCachedWebViewPages(); | 224 PurgeCachedWebViewPages(); |
235 [self setServerPaused:YES]; | 225 [self setServerPaused:YES]; |
236 | 226 |
237 // Go back in history and verify that URL2 (committed URL) is displayed even | 227 // Go back in history and verify that URL2 (committed URL) is displayed even |
238 // though URL1 is a pending URL. | 228 // though URL1 is a pending URL. |
239 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] | 229 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
240 performAction:grey_longPress()]; | 230 performAction:grey_longPress()]; |
241 NSString* URL1Title = | 231 NSString* URL1Title = |
242 base::SysUTF16ToNSString(web::GetDisplayTitleForUrl(_testURL1)); | 232 base::SysUTF16ToNSString(web::GetDisplayTitleForUrl(_testURL1)); |
243 [[EarlGrey selectElementWithMatcher:grey_text(URL1Title)] | 233 [[EarlGrey selectElementWithMatcher:grey_text(URL1Title)] |
244 performAction:grey_tap()]; | 234 performAction:grey_tap()]; |
245 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], | 235 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], |
246 @"Last request URL: %@", self.lastRequestURLSpec); | 236 @"Last request URL: %@", self.lastRequestURLSpec); |
247 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] | 237 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] |
248 assertWithMatcher:grey_notNil()]; | 238 assertWithMatcher:grey_notNil()]; |
249 | 239 |
250 // Make server respond so URL1 becomes committed. | 240 // Make server respond so URL1 becomes committed. |
251 [self setServerPaused:NO]; | 241 [self setServerPaused:NO]; |
252 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] | 242 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] |
253 assertWithMatcher:grey_notNil()]; | 243 assertWithMatcher:grey_notNil()]; |
254 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] | 244 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] |
255 assertWithMatcher:grey_notNil()]; | 245 assertWithMatcher:grey_notNil()]; |
256 } | 246 } |
257 | 247 |
258 // Tests that stopping a pending Back navigation and reloading reloads committed | 248 // Tests that stopping a pending Back navigation and reloading reloads committed |
259 // URL, not pending URL. | 249 // URL, not pending URL. |
260 - (void)testStoppingPendingBackNavigationAndReload { | 250 - (void)testStoppingPendingBackNavigationAndReload { |
261 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
262 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
263 } | |
264 | |
265 // Purge web view caches and pause the server to make sure that tests can | 251 // Purge web view caches and pause the server to make sure that tests can |
266 // verify omnibox state before server starts responding. | 252 // verify omnibox state before server starts responding. |
267 PurgeCachedWebViewPages(); | 253 PurgeCachedWebViewPages(); |
268 [self setServerPaused:YES]; | 254 [self setServerPaused:YES]; |
269 | 255 |
270 // Tap the back button, stop pending navigation and reload. | 256 // Tap the back button, stop pending navigation and reload. |
271 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] | 257 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
272 performAction:grey_tap()]; | 258 performAction:grey_tap()]; |
273 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], | 259 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], |
274 @"Last request URL: %@", self.lastRequestURLSpec); | 260 @"Last request URL: %@", self.lastRequestURLSpec); |
(...skipping 13 matching lines...) Expand all Loading... |
288 [self setServerPaused:NO]; | 274 [self setServerPaused:NO]; |
289 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] | 275 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] |
290 assertWithMatcher:grey_notNil()]; | 276 assertWithMatcher:grey_notNil()]; |
291 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] | 277 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] |
292 assertWithMatcher:grey_notNil()]; | 278 assertWithMatcher:grey_notNil()]; |
293 } | 279 } |
294 | 280 |
295 // Tests that visible URL is always the same as last committed URL during | 281 // Tests that visible URL is always the same as last committed URL during |
296 // back forward navigations initiated with JS. | 282 // back forward navigations initiated with JS. |
297 - (void)testJSBackForwardNavigation { | 283 - (void)testJSBackForwardNavigation { |
298 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
299 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
300 } | |
301 | |
302 // Purge web view caches and pause the server to make sure that tests can | 284 // Purge web view caches and pause the server to make sure that tests can |
303 // verify omnibox state before server starts responding. | 285 // verify omnibox state before server starts responding. |
304 PurgeCachedWebViewPages(); | 286 PurgeCachedWebViewPages(); |
305 [self setServerPaused:YES]; | 287 [self setServerPaused:YES]; |
306 | 288 |
307 // Tap the back button on the page and verify that URL2 (committed URL) is | 289 // Tap the back button on the page and verify that URL2 (committed URL) is |
308 // displayed even though URL1 is a pending URL. | 290 // displayed even though URL1 is a pending URL. |
309 [ChromeEarlGrey tapWebViewElementWithID:base::SysUTF8ToNSString(kGoBackLink)]; | 291 [ChromeEarlGrey tapWebViewElementWithID:base::SysUTF8ToNSString(kGoBackLink)]; |
310 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], | 292 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], |
311 @"Last request URL: %@", self.lastRequestURLSpec); | 293 @"Last request URL: %@", self.lastRequestURLSpec); |
(...skipping 25 matching lines...) Expand all Loading... |
337 [self setServerPaused:NO]; | 319 [self setServerPaused:NO]; |
338 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] | 320 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] |
339 assertWithMatcher:grey_notNil()]; | 321 assertWithMatcher:grey_notNil()]; |
340 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] | 322 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] |
341 assertWithMatcher:grey_notNil()]; | 323 assertWithMatcher:grey_notNil()]; |
342 } | 324 } |
343 | 325 |
344 // Tests that visible URL is always the same as last committed URL during go | 326 // Tests that visible URL is always the same as last committed URL during go |
345 // navigations initiated with JS. | 327 // navigations initiated with JS. |
346 - (void)testJSGoNavigation { | 328 - (void)testJSGoNavigation { |
347 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
348 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
349 } | |
350 | |
351 // Purge web view caches and pause the server to make sure that tests can | 329 // Purge web view caches and pause the server to make sure that tests can |
352 // verify omnibox state before server starts responding. | 330 // verify omnibox state before server starts responding. |
353 PurgeCachedWebViewPages(); | 331 PurgeCachedWebViewPages(); |
354 [self setServerPaused:YES]; | 332 [self setServerPaused:YES]; |
355 | 333 |
356 // Tap the go negative delta button on the page and verify that URL2 | 334 // Tap the go negative delta button on the page and verify that URL2 |
357 // (committed URL) is displayed even though URL1 is a pending URL. | 335 // (committed URL) is displayed even though URL1 is a pending URL. |
358 [ChromeEarlGrey | 336 [ChromeEarlGrey |
359 tapWebViewElementWithID:base::SysUTF8ToNSString(kGoNegativeDeltaLink)]; | 337 tapWebViewElementWithID:base::SysUTF8ToNSString(kGoNegativeDeltaLink)]; |
360 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], | 338 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], |
(...skipping 26 matching lines...) Expand all Loading... |
387 [self setServerPaused:NO]; | 365 [self setServerPaused:NO]; |
388 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] | 366 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage2)] |
389 assertWithMatcher:grey_notNil()]; | 367 assertWithMatcher:grey_notNil()]; |
390 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] | 368 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL2.GetContent())] |
391 assertWithMatcher:grey_notNil()]; | 369 assertWithMatcher:grey_notNil()]; |
392 } | 370 } |
393 | 371 |
394 // Tests that visible URL is always the same as last committed URL during go | 372 // Tests that visible URL is always the same as last committed URL during go |
395 // back navigation started with pending reload in progress. | 373 // back navigation started with pending reload in progress. |
396 - (void)testBackNavigationWithPendingReload { | 374 - (void)testBackNavigationWithPendingReload { |
397 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
398 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
399 } | |
400 | |
401 // Purge web view caches and pause the server to make sure that tests can | 375 // Purge web view caches and pause the server to make sure that tests can |
402 // verify omnibox state before server starts responding. | 376 // verify omnibox state before server starts responding. |
403 PurgeCachedWebViewPages(); | 377 PurgeCachedWebViewPages(); |
404 [self setServerPaused:YES]; | 378 [self setServerPaused:YES]; |
405 | 379 |
406 // Start reloading the page. | 380 // Start reloading the page. |
407 if (!IsIPadIdiom()) { | 381 if (!IsIPadIdiom()) { |
408 // Enable EG synchronization to make test wait for popover animations. | 382 // Enable EG synchronization to make test wait for popover animations. |
409 [[GREYConfiguration sharedInstance] | 383 [[GREYConfiguration sharedInstance] |
410 setValue:@YES | 384 setValue:@YES |
(...skipping 18 matching lines...) Expand all Loading... |
429 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] | 403 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] |
430 assertWithMatcher:grey_notNil()]; | 404 assertWithMatcher:grey_notNil()]; |
431 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] | 405 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] |
432 assertWithMatcher:grey_notNil()]; | 406 assertWithMatcher:grey_notNil()]; |
433 } | 407 } |
434 | 408 |
435 // Tests that visible URL is always the same as last committed URL during go | 409 // Tests that visible URL is always the same as last committed URL during go |
436 // back navigation initiated with pending renderer-initiated navigation in | 410 // back navigation initiated with pending renderer-initiated navigation in |
437 // progress. | 411 // progress. |
438 - (void)testBackNavigationWithPendingRendererInitiatedNavigation { | 412 - (void)testBackNavigationWithPendingRendererInitiatedNavigation { |
439 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
440 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
441 } | |
442 | |
443 // Purge web view caches and pause the server to make sure that tests can | 413 // Purge web view caches and pause the server to make sure that tests can |
444 // verify omnibox state before server starts responding. | 414 // verify omnibox state before server starts responding. |
445 PurgeCachedWebViewPages(); | 415 PurgeCachedWebViewPages(); |
446 [self setServerPaused:YES]; | 416 [self setServerPaused:YES]; |
447 | 417 |
448 // Start renderer initiated navigation. | 418 // Start renderer initiated navigation. |
449 [ChromeEarlGrey tapWebViewElementWithID:base::SysUTF8ToNSString(kPage3Link)]; | 419 [ChromeEarlGrey tapWebViewElementWithID:base::SysUTF8ToNSString(kPage3Link)]; |
450 | 420 |
451 // Do not wait until renderer-initiated navigation is finished, tap the back | 421 // Do not wait until renderer-initiated navigation is finished, tap the back |
452 // button in the toolbar and verify that URL2 (committed URL) is displayed | 422 // button in the toolbar and verify that URL2 (committed URL) is displayed |
(...skipping 10 matching lines...) Expand all Loading... |
463 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] | 433 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] |
464 assertWithMatcher:grey_notNil()]; | 434 assertWithMatcher:grey_notNil()]; |
465 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] | 435 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] |
466 assertWithMatcher:grey_notNil()]; | 436 assertWithMatcher:grey_notNil()]; |
467 } | 437 } |
468 | 438 |
469 // Tests that visible URL is always the same as last committed URL during | 439 // Tests that visible URL is always the same as last committed URL during |
470 // renderer-initiated navigation started with pending back navigation in | 440 // renderer-initiated navigation started with pending back navigation in |
471 // progress. | 441 // progress. |
472 - (void)testRendererInitiatedNavigationWithPendingBackNavigation { | 442 - (void)testRendererInitiatedNavigationWithPendingBackNavigation { |
473 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
474 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
475 } | |
476 | |
477 // Purge web view caches and pause the server to make sure that tests can | 443 // Purge web view caches and pause the server to make sure that tests can |
478 // verify omnibox state before server starts responding. | 444 // verify omnibox state before server starts responding. |
479 PurgeCachedWebViewPages(); | 445 PurgeCachedWebViewPages(); |
480 [self setServerPaused:YES]; | 446 [self setServerPaused:YES]; |
481 | 447 |
482 // Tap the back button in the toolbar and verify that URL2 (committed URL) is | 448 // Tap the back button in the toolbar and verify that URL2 (committed URL) is |
483 // displayed even though URL1 is a pending URL. | 449 // displayed even though URL1 is a pending URL. |
484 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] | 450 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
485 performAction:grey_tap()]; | 451 performAction:grey_tap()]; |
486 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], | 452 GREYAssert([self waitForServerToReceiveRequestWithURL:_testURL1], |
(...skipping 10 matching lines...) Expand all Loading... |
497 [self setServerPaused:NO]; | 463 [self setServerPaused:NO]; |
498 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage3)] | 464 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage3)] |
499 assertWithMatcher:grey_notNil()]; | 465 assertWithMatcher:grey_notNil()]; |
500 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL3.GetContent())] | 466 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL3.GetContent())] |
501 assertWithMatcher:grey_notNil()]; | 467 assertWithMatcher:grey_notNil()]; |
502 } | 468 } |
503 | 469 |
504 // Tests that visible URL is always the same as last committed URL if user | 470 // Tests that visible URL is always the same as last committed URL if user |
505 // issues 2 go back commands. | 471 // issues 2 go back commands. |
506 - (void)testDoubleBackNavigation { | 472 - (void)testDoubleBackNavigation { |
507 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
508 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
509 } | |
510 | |
511 // Create 3rd entry in the history, to be able to go back twice. | 473 // Create 3rd entry in the history, to be able to go back twice. |
512 [ChromeEarlGrey loadURL:_testURL3]; | 474 [ChromeEarlGrey loadURL:_testURL3]; |
513 | 475 |
514 // Purge web view caches and pause the server to make sure that tests can | 476 // Purge web view caches and pause the server to make sure that tests can |
515 // verify omnibox state before server starts responding. | 477 // verify omnibox state before server starts responding. |
516 PurgeCachedWebViewPages(); | 478 PurgeCachedWebViewPages(); |
517 [self setServerPaused:YES]; | 479 [self setServerPaused:YES]; |
518 | 480 |
519 // Tap the back button twice in the toolbar and verify that URL3 (committed | 481 // Tap the back button twice in the toolbar and verify that URL3 (committed |
520 // URL) is displayed even though URL1 is a pending URL. | 482 // URL) is displayed even though URL1 is a pending URL. |
(...skipping 11 matching lines...) Expand all Loading... |
532 [self setServerPaused:NO]; | 494 [self setServerPaused:NO]; |
533 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] | 495 [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] |
534 assertWithMatcher:grey_notNil()]; | 496 assertWithMatcher:grey_notNil()]; |
535 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] | 497 [[EarlGrey selectElementWithMatcher:OmniboxText(_testURL1.GetContent())] |
536 assertWithMatcher:grey_notNil()]; | 498 assertWithMatcher:grey_notNil()]; |
537 } | 499 } |
538 | 500 |
539 // Tests that visible URL is always the same as last committed URL if page calls | 501 // Tests that visible URL is always the same as last committed URL if page calls |
540 // window.history.back() twice. | 502 // window.history.back() twice. |
541 - (void)testDoubleBackJSNavigation { | 503 - (void)testDoubleBackJSNavigation { |
542 if (!experimental_flags::IsPendingIndexNavigationEnabled()) { | |
543 EARL_GREY_TEST_SKIPPED(@"Pending Index Navigation experiment is disabled"); | |
544 } | |
545 | |
546 // Create 3rd entry in the history, to be able to go back twice. | 504 // Create 3rd entry in the history, to be able to go back twice. |
547 [ChromeEarlGrey loadURL:_testURL3]; | 505 [ChromeEarlGrey loadURL:_testURL3]; |
548 | 506 |
549 // Purge web view caches and pause the server to make sure that tests can | 507 // Purge web view caches and pause the server to make sure that tests can |
550 // verify omnibox state before server starts responding. | 508 // verify omnibox state before server starts responding. |
551 PurgeCachedWebViewPages(); | 509 PurgeCachedWebViewPages(); |
552 [self setServerPaused:YES]; | 510 [self setServerPaused:YES]; |
553 | 511 |
554 // Tap the back button twice on the page and verify that URL3 (committed URL) | 512 // Tap the back button twice on the page and verify that URL3 (committed URL) |
555 // is displayed even though URL1 is a pending URL. | 513 // is displayed even though URL1 is a pending URL. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 - (BOOL)waitForServerToReceiveRequestWithURL:(GURL)URL { | 549 - (BOOL)waitForServerToReceiveRequestWithURL:(GURL)URL { |
592 return [[GREYCondition | 550 return [[GREYCondition |
593 conditionWithName:@"Wait for received request" | 551 conditionWithName:@"Wait for received request" |
594 block:^{ | 552 block:^{ |
595 return _responseProvider->last_request_url() == URL ? YES | 553 return _responseProvider->last_request_url() == URL ? YES |
596 : NO; | 554 : NO; |
597 }] waitWithTimeout:10]; | 555 }] waitWithTimeout:10]; |
598 } | 556 } |
599 | 557 |
600 @end | 558 @end |
OLD | NEW |