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 e3a58281a5b9764af9cfc3d648af87073c3298d2..23851f01fd9787ba1f2befa633c6ccfc7e75ef86 100644 |
| --- a/ios/web/shell/test/web_shell_navigation_egtest.mm |
| +++ b/ios/web/shell/test/web_shell_navigation_egtest.mm |
| @@ -139,4 +139,26 @@ |
| assertWithMatcher:grey_notNil()]; |
| } |
| +// Tests tapping a link with onclick="event.preventDefault()" and verifies that |
| +// the URL didn't change.. |
| +- (void)testNavigationLinkPreventDefaultOverridesHref { |
| + // Create map of canned responses and set up the test HTML server. |
| + std::map<GURL, std::string> responses; |
| + const GURL URL = web::test::HttpServer::MakeUrl("http://overridesHrefLink"); |
| + const std::string response = |
| + "<a href='#hash' id='overridesHref' " |
|
Eugene But (OOO till 7-30)
2016/06/23 22:31:50
NIT: s/overridesHref/overrides-href Per JS Style G
huangml1
2016/06/23 23:25:31
Done.
|
| + "onclick='event.preventDefault()'>linkPreventDefaultOverridesHref</a>"; |
|
Eugene But (OOO till 7-30)
2016/06/23 22:31:50
Maybe you should add something to the page (like t
huangml1
2016/06/23 23:25:31
Done.
|
| + responses[URL] = response; |
| + |
| + web::test::SetUpSimpleHttpServer(responses); |
| + web::shell_test_util::LoadUrl(URL); |
| + [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] |
| + assertWithMatcher:grey_notNil()]; |
| + |
| + web::shell_test_util::TapWebViewElementWithId("overridesHref"); |
| + |
| + [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] |
|
huangml1
2016/06/23 22:21:39
I only checked no url change here for this test.
Eugene But (OOO till 7-30)
2016/06/23 22:31:50
Well you can not check tab counts here. So maybe t
Eugene But (OOO till 7-30)
2016/06/24 00:41:25
So this does not really protect from the broken te
|
| + assertWithMatcher:grey_notNil()]; |
| +} |
| + |
| @end |