Chromium Code Reviews| 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..48bc5b6e112f88bd7145c8fcf51dc3593ff8603d 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>"; |
|
Eugene But (OOO till 7-30)
2016/05/23 20:21:58
Optional NIT: s/\"/'
baxley
2016/05/23 21:18:02
Done.
|
| + 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)] |
|
Eugene But (OOO till 7-30)
2016/05/23 20:21:58
Suggestion for the future:
Should |addressFieldTe
baxley
2016/05/23 21:18:02
That sounds reasonable. I was hesitant since the c
|
| + 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 |