Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: ios/chrome/browser/web/visible_url_egtest.mm

Issue 2832853002: Handle correctly start and commit of non-latest navigations. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/web/BUILD.gn ('k') | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..290aa57ad9d9b42b4670771bc81bdcb1bae8b42a 100644
--- a/ios/chrome/browser/web/visible_url_egtest.mm
+++ b/ios/chrome/browser/web/visible_url_egtest.mm
@@ -7,6 +7,11 @@
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
+#include "base/strings/utf_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 +503,38 @@ 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.
+ GURL URL(kChromeUIVersionURL);
+ [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 (using chrome command) 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);
+
+ const std::string version = version_info::GetVersionNumber();
+ [[EarlGrey selectElementWithMatcher:WebViewContainingText(version)]
+ assertWithMatcher:grey_notNil()];
+
+ // Make sure that kChromeUIVersionURL URL is displayed in the omnibox.
+ std::string expectedText = base::UTF16ToUTF8(web::GetDisplayTitleForUrl(URL));
+ [[EarlGrey selectElementWithMatcher:OmniboxText(expectedText)]
+ assertWithMatcher:grey_notNil()];
+}
+
// Tests that visible URL is always the same as last committed URL if page calls
// window.history.back() twice.
- (void)testDoubleBackJSNavigation {
« no previous file with comments | « ios/chrome/browser/web/BUILD.gn ('k') | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698