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

Side by Side Diff: ios/web/shell/test/web_shell_navigation_egtest.mm

Issue 2094753004: Earlgrey test for webScenarioBrowsingLinkPreventDefaultOverridesHref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Text marker Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 char pageHTML[] =
149 "<script>"
150 " function printMsg() {"
151 " document.body.appendChild(document.createTextNode('Default "
152 "prevented!'));"
153 " }"
154 "</script>"
155 "<a href='#hash' id='overrides-href' onclick='event.preventDefault(); "
156 "printMsg();'>redirectLink</a>";
157 responses[URL] = pageHTML;
158
159 web::test::SetUpSimpleHttpServer(responses);
160
161 web::shell_test_util::LoadUrl(URL);
162 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())]
163 assertWithMatcher:grey_notNil()];
164
165 web::shell_test_util::TapWebViewElementWithId("overrides-href");
166
167 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())]
168 assertWithMatcher:grey_notNil()];
169 [[EarlGrey
170 selectElementWithMatcher:web::webViewContainingText("Default prevented!")]
171 assertWithMatcher:grey_notNil()];
172 }
173
142 @end 174 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698