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

Unified Diff: ios/web/shell/test/web_shell_navigation_egtest.mm

Issue 1988253002: Add web shell test to navigate with fragment link. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make html more readable with single-quotes Created 4 years, 7 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/web/shell/test/earl_grey/shell_matchers.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/shell/test/web_shell_navigation_egtest.mm
diff --git a/ios/web/shell/test/web_shell_navigation_egtest.mm b/ios/web/shell/test/web_shell_navigation_egtest.mm
index 9dc55a2f95b1f2692496db72ef8dde5de89adf63..04e0f3cf7bb13c234d1b7f494b9bc2150922f106 100644
--- a/ios/web/shell/test/web_shell_navigation_egtest.mm
+++ b/ios/web/shell/test/web_shell_navigation_egtest.mm
@@ -69,7 +69,7 @@
}
// Tests the back and forward button after entering two URLs.
-- (void)testWebScenarioBrowsingBackAndForward {
+- (void)testNavigationBackAndForward {
// Create map of canned responses and set up the test HTML server.
std::map<GURL, std::string> responses;
const GURL URL1 = web::test::HttpServer::MakeUrl("http://firstURL");
@@ -111,4 +111,37 @@
assertWithMatcher:grey_notNil()];
}
+// Tests back and forward navigation where a fragment link is tapped.
+- (void)testNavigationBackAndForwardAfterFragmentLink {
+ // Create map of canned responses and set up the test HTML server.
+ std::map<GURL, std::string> responses;
+ const GURL URL1 = web::test::HttpServer::MakeUrl("http://fragmentLink");
+ NSString* URL1Text = base::SysUTF8ToNSString(URL1.spec());
+ const std::string response = "<a href='#hash' id='link'>link</a>";
+ responses[URL1] = response;
+
+ const GURL URL2 = web::test::HttpServer::MakeUrl("http://fragmentLink/#hash");
+ NSString* URL2Text = base::SysUTF8ToNSString(URL2.spec());
+
+ web::test::SetUpSimpleHttpServer(responses);
+
+ web::shell_test_util::LoadUrl(URL1);
+ [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL1Text)]
+ assertWithMatcher:grey_notNil()];
+
+ web::shell_test_util::TapWebViewElementWithId("link");
+ [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL2Text)]
+ assertWithMatcher:grey_notNil()];
+
+ [[EarlGrey selectElementWithMatcher:web::backButton()]
+ performAction:grey_tap()];
+ [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL1Text)]
+ assertWithMatcher:grey_notNil()];
+
+ [[EarlGrey selectElementWithMatcher:web::forwardButton()]
+ performAction:grey_tap()];
+ [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL2Text)]
+ assertWithMatcher:grey_notNil()];
+}
+
@end
« no previous file with comments | « ios/web/shell/test/earl_grey/shell_matchers.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698