Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <UIKit/UIKit.h> | 5 #import <UIKit/UIKit.h> |
| 6 #import <WebKit/WebKit.h> | 6 #import <WebKit/WebKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 | 8 |
| 9 #import <EarlGrey/EarlGrey.h> | 9 #import <EarlGrey/EarlGrey.h> |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 performAction:grey_tap()]; | 132 performAction:grey_tap()]; |
| 133 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL1.spec())] | 133 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL1.spec())] |
| 134 assertWithMatcher:grey_notNil()]; | 134 assertWithMatcher:grey_notNil()]; |
| 135 | 135 |
| 136 [[EarlGrey selectElementWithMatcher:web::forwardButton()] | 136 [[EarlGrey selectElementWithMatcher:web::forwardButton()] |
| 137 performAction:grey_tap()]; | 137 performAction:grey_tap()]; |
| 138 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL2.spec())] | 138 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL2.spec())] |
| 139 assertWithMatcher:grey_notNil()]; | 139 assertWithMatcher:grey_notNil()]; |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Tests tapping a link with onclick="event.preventDefault()" and verifies that | |
| 143 // the URL didn't change.. | |
| 144 - (void)testNavigationLinkPreventDefaultOverridesHref { | |
| 145 // Create map of canned responses and set up the test HTML server. | |
| 146 std::map<GURL, std::string> responses; | |
| 147 const GURL URL = web::test::HttpServer::MakeUrl("http://overridesHrefLink"); | |
| 148 const std::string response = | |
| 149 "<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.
| |
| 150 "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.
| |
| 151 responses[URL] = response; | |
| 152 | |
| 153 web::test::SetUpSimpleHttpServer(responses); | |
| 154 web::shell_test_util::LoadUrl(URL); | |
| 155 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] | |
| 156 assertWithMatcher:grey_notNil()]; | |
| 157 | |
| 158 web::shell_test_util::TapWebViewElementWithId("overridesHref"); | |
| 159 | |
| 160 [[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
| |
| 161 assertWithMatcher:grey_notNil()]; | |
| 162 } | |
| 163 | |
| 142 @end | 164 @end |
| OLD | NEW |