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