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 "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 GURL URL(kChromeUIVersionURL); | 512 GURL URL(kChromeUIVersionURL); |
513 [ChromeEarlGrey loadURL:GURL(kChromeUIVersionURL)]; | 513 [ChromeEarlGrey loadURL:GURL(kChromeUIVersionURL)]; |
514 | 514 |
515 // Tap the back button twice in the toolbar and wait for URL 1 to load. | 515 // Tap the back button twice in the toolbar and wait for URL 1 to load. |
516 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] | 516 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
517 performAction:grey_tap()]; | 517 performAction:grey_tap()]; |
518 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] | 518 [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
519 performAction:grey_tap()]; | 519 performAction:grey_tap()]; |
520 [ChromeEarlGrey waitForWebViewContainingText:kTestPage1]; | 520 [ChromeEarlGrey waitForWebViewContainingText:kTestPage1]; |
521 | 521 |
522 // Quickly (using chrome command) navigate forward twice and wait for | 522 // Quickly navigate forward twice and wait for kChromeUIVersionURL to load. |
523 // kChromeUIVersionURL to load. | 523 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goForward]; |
524 GenericChromeCommand* forwardCommand = | 524 [chrome_test_util::BrowserCommandDispatcherForMainBVC() goForward]; |
525 [[GenericChromeCommand alloc] initWithTag:IDC_FORWARD]; | |
526 chrome_test_util::RunCommandWithActiveViewController(forwardCommand); | |
527 chrome_test_util::RunCommandWithActiveViewController(forwardCommand); | |
528 | 525 |
529 const std::string version = version_info::GetVersionNumber(); | 526 const std::string version = version_info::GetVersionNumber(); |
530 [ChromeEarlGrey waitForWebViewContainingText:version]; | 527 [ChromeEarlGrey waitForWebViewContainingText:version]; |
531 | 528 |
532 // Make sure that kChromeUIVersionURL URL is displayed in the omnibox. | 529 // Make sure that kChromeUIVersionURL URL is displayed in the omnibox. |
533 std::string expectedText = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(URL)); | 530 std::string expectedText = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(URL)); |
534 [[EarlGrey selectElementWithMatcher:OmniboxText(expectedText)] | 531 [[EarlGrey selectElementWithMatcher:OmniboxText(expectedText)] |
535 assertWithMatcher:grey_notNil()]; | 532 assertWithMatcher:grey_notNil()]; |
536 } | 533 } |
537 | 534 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 - (BOOL)waitForServerToReceiveRequestWithURL:(GURL)URL { | 582 - (BOOL)waitForServerToReceiveRequestWithURL:(GURL)URL { |
586 return [[GREYCondition | 583 return [[GREYCondition |
587 conditionWithName:@"Wait for received request" | 584 conditionWithName:@"Wait for received request" |
588 block:^{ | 585 block:^{ |
589 return _responseProvider->last_request_url() == URL ? YES | 586 return _responseProvider->last_request_url() == URL ? YES |
590 : NO; | 587 : NO; |
591 }] waitWithTimeout:10]; | 588 }] waitWithTimeout:10]; |
592 } | 589 } |
593 | 590 |
594 @end | 591 @end |
OLD | NEW |