| 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 <XCTest/XCTest.h> | 5 #import <XCTest/XCTest.h> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 chrome_test_util::AssertMainTabCount(2); | 272 chrome_test_util::AssertMainTabCount(2); |
| 273 | 273 |
| 274 // Verify the new tab was opened with the expected URL. | 274 // Verify the new tab was opened with the expected URL. |
| 275 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] | 275 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 276 assertWithMatcher:grey_notNil()]; | 276 assertWithMatcher:grey_notNil()]; |
| 277 } | 277 } |
| 278 | 278 |
| 279 // Tests that clicking a link with URL changed by onclick uses the href of the | 279 // Tests that clicking a link with URL changed by onclick uses the href of the |
| 280 // anchor tag instead of the one specified in JavaScript. Also verifies a new | 280 // anchor tag instead of the one specified in JavaScript. Also verifies a new |
| 281 // tab is opened by target '_blank'. | 281 // tab is opened by target '_blank'. |
| 282 - (void)testBrowsingPreventDefaultWithLinkOpenedByJavascript { | 282 // TODO(crbug.com/688223): WKWebView does not open a new window as expected by |
| 283 // this test. |
| 284 - (void)DISABLED_testBrowsingPreventDefaultWithLinkOpenedByJavascript { |
| 283 // Create map of canned responses and set up the test HTML server. | 285 // Create map of canned responses and set up the test HTML server. |
| 284 std::map<GURL, std::string> responses; | 286 std::map<GURL, std::string> responses; |
| 285 const GURL URL = web::test::HttpServer::MakeUrl( | 287 const GURL URL = web::test::HttpServer::MakeUrl( |
| 286 "http://preventDefaultWithLinkOpenedByJavascript"); | 288 "http://preventDefaultWithLinkOpenedByJavascript"); |
| 287 const GURL anchorURL = | 289 const GURL anchorURL = |
| 288 web::test::HttpServer::MakeUrl("http://anchorDestination"); | 290 web::test::HttpServer::MakeUrl("http://anchorDestination"); |
| 289 const GURL destinationURL = | 291 const GURL destinationURL = |
| 290 web::test::HttpServer::MakeUrl("http://javaScriptDestination"); | 292 web::test::HttpServer::MakeUrl("http://javaScriptDestination"); |
| 291 // This is a page with a link where the href and JavaScript are setting the | 293 // This is a page with a link where the href and JavaScript are setting the |
| 292 // destination to two different URLs so the test can verify which one the | 294 // destination to two different URLs so the test can verify which one the |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] | 662 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 661 assertWithMatcher:grey_notNil()]; | 663 assertWithMatcher:grey_notNil()]; |
| 662 | 664 |
| 663 // Go back and verify that the browser navigates to the original URL. | 665 // Go back and verify that the browser navigates to the original URL. |
| 664 [self goBack]; | 666 [self goBack]; |
| 665 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] | 667 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 666 assertWithMatcher:grey_notNil()]; | 668 assertWithMatcher:grey_notNil()]; |
| 667 } | 669 } |
| 668 | 670 |
| 669 @end | 671 @end |
| OLD | NEW |