Chromium Code Reviews| Index: ios/chrome/browser/web/visible_url_egtest.mm |
| diff --git a/ios/chrome/browser/web/visible_url_egtest.mm b/ios/chrome/browser/web/visible_url_egtest.mm |
| index 364fb6500ea6ef7aaefd7e47c4084b4ced723d21..8b9876b3ffb93a6fb3a1215e334facea52643eb0 100644 |
| --- a/ios/chrome/browser/web/visible_url_egtest.mm |
| +++ b/ios/chrome/browser/web/visible_url_egtest.mm |
| @@ -7,6 +7,10 @@ |
| #include "base/memory/ptr_util.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/strings/sys_string_conversions.h" |
| +#include "components/version_info/version_info.h" |
| +#include "ios/chrome/browser/chrome_url_constants.h" |
| +#import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| +#include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| #include "ios/chrome/browser/ui/ui_util.h" |
| #import "ios/chrome/test/app/chrome_test_util.h" |
| #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
| @@ -498,6 +502,35 @@ class PausableResponseProvider : public HtmlResponseProvider { |
| assertWithMatcher:grey_notNil()]; |
| } |
| +// Tests that visible URL is always the same as last committed URL if user |
| +// issues 2 go forward commands to WebUI page (crbug.com/711465). |
| +- (void)testDoubleForwardNavigationToWebUIPage { |
| + // Create 3rd entry in the history, to be able to go back twice. |
| + [ChromeEarlGrey loadURL:GURL(kChromeUIVersionURL)]; |
| + |
| + // Tap the back button twice in the toolbar and wait for URL 1 to load. |
| + [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
| + performAction:grey_tap()]; |
| + [[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()] |
| + performAction:grey_tap()]; |
| + [[EarlGrey selectElementWithMatcher:WebViewContainingText(kTestPage1)] |
| + assertWithMatcher:grey_notNil()]; |
| + |
| + // Quickly navigate forward twice and wait for kChromeUIVersionURL to load. |
| + base::scoped_nsobject<GenericChromeCommand> forwardCommand( |
| + [[GenericChromeCommand alloc] initWithTag:IDC_FORWARD]); |
| + chrome_test_util::RunCommandWithActiveViewController(forwardCommand); |
| + chrome_test_util::RunCommandWithActiveViewController(forwardCommand); |
|
kkhorimoto
2017/04/18 23:03:15
Why are we using commands to go forward but UI ele
Eugene But (OOO till 7-30)
2017/04/19 00:26:46
Done.
|
| + |
| + const std::string version = version_info::GetVersionNumber(); |
| + [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)] |
| + assertWithMatcher:grey_notNil()]; |
| + |
| + // Make sure that chrome://version URL is displayed in the omnibox. |
| + [[EarlGrey selectElementWithMatcher:OmniboxText("chrome://version")] |
|
kkhorimoto
2017/04/18 23:03:15
Can we not use kChromeUIVersionURL?
Eugene But (OOO till 7-30)
2017/04/19 00:26:46
No, kChromeUIVersionURL has a trailing slash :(
kkhorimoto
2017/04/19 00:34:41
I think you can use web::GetDisplayTitleForUrl() t
Eugene But (OOO till 7-30)
2017/04/19 01:24:36
I can. Thanks!
|
| + assertWithMatcher:grey_notNil()]; |
| +} |
| + |
| // Tests that visible URL is always the same as last committed URL if page calls |
| // window.history.back() twice. |
| - (void)testDoubleBackJSNavigation { |