| 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 26 matching lines...) Expand all Loading... |
| 37 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] | 37 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] |
| 38 assertWithMatcher:grey_notNil()]; | 38 assertWithMatcher:grey_notNil()]; |
| 39 | 39 |
| 40 web::shell_test_util::TapWebViewElementWithId( | 40 web::shell_test_util::TapWebViewElementWithId( |
| 41 "basic-link-navigation-to-about-blank"); | 41 "basic-link-navigation-to-about-blank"); |
| 42 | 42 |
| 43 [[EarlGrey selectElementWithMatcher:web::addressFieldText("about:blank")] | 43 [[EarlGrey selectElementWithMatcher:web::addressFieldText("about:blank")] |
| 44 assertWithMatcher:grey_notNil()]; | 44 assertWithMatcher:grey_notNil()]; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // TODO(crbug.com/675015): Re-enable this test on device. | |
| 48 #if TARGET_IPHONE_SIMULATOR | |
| 49 #define MAYBE_testNavigationBackAndForward testNavigationBackAndForward | |
| 50 #else | |
| 51 #define MAYBE_testNavigationBackAndForward FLAKY_testNavigationBackAndForward | |
| 52 #endif | |
| 53 // Tests the back and forward button after entering two URLs. | 47 // Tests the back and forward button after entering two URLs. |
| 54 - (void)MAYBE_testNavigationBackAndForward { | 48 - (void)testNavigationBackAndForward { |
| 55 // Create map of canned responses and set up the test HTML server. | 49 // Create map of canned responses and set up the test HTML server. |
| 56 std::map<GURL, std::string> responses; | 50 std::map<GURL, std::string> responses; |
| 57 const GURL URL1 = web::test::HttpServer::MakeUrl("http://firstURL"); | 51 const GURL URL1 = web::test::HttpServer::MakeUrl("http://firstURL"); |
| 58 std::string response1 = "Test Page 1"; | 52 std::string response1 = "Test Page 1"; |
| 59 responses[URL1] = response1; | 53 responses[URL1] = response1; |
| 60 | 54 |
| 61 const GURL URL2 = web::test::HttpServer::MakeUrl("http://secondURL"); | 55 const GURL URL2 = web::test::HttpServer::MakeUrl("http://secondURL"); |
| 62 std::string response2 = "Test Page 2"; | 56 std::string response2 = "Test Page 2"; |
| 63 responses[URL2] = response2; | 57 responses[URL2] = response2; |
| 64 | 58 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 assertWithMatcher:grey_notNil()]; | 78 assertWithMatcher:grey_notNil()]; |
| 85 | 79 |
| 86 [[EarlGrey selectElementWithMatcher:web::forwardButton()] | 80 [[EarlGrey selectElementWithMatcher:web::forwardButton()] |
| 87 performAction:grey_tap()]; | 81 performAction:grey_tap()]; |
| 88 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL2.spec())] | 82 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL2.spec())] |
| 89 assertWithMatcher:grey_notNil()]; | 83 assertWithMatcher:grey_notNil()]; |
| 90 [[EarlGrey selectElementWithMatcher:web::webViewContainingText(response2)] | 84 [[EarlGrey selectElementWithMatcher:web::webViewContainingText(response2)] |
| 91 assertWithMatcher:grey_notNil()]; | 85 assertWithMatcher:grey_notNil()]; |
| 92 } | 86 } |
| 93 | 87 |
| 94 // TODO(crbug.com/675015): Re-enable this test on device. | |
| 95 #if TARGET_IPHONE_SIMULATOR | |
| 96 #define MAYBE_testNavigationBackAndForwardAfterFragmentLink \ | |
| 97 testNavigationBackAndForwardAfterFragmentLink | |
| 98 #else | |
| 99 #define MAYBE_testNavigationBackAndForwardAfterFragmentLink \ | |
| 100 FLAKY_testNavigationBackAndForwardAfterFragmentLink | |
| 101 #endif | |
| 102 // Tests back and forward navigation where a fragment link is tapped. | 88 // Tests back and forward navigation where a fragment link is tapped. |
| 103 - (void)MAYBE_testNavigationBackAndForwardAfterFragmentLink { | 89 - (void)testNavigationBackAndForwardAfterFragmentLink { |
| 104 // Create map of canned responses and set up the test HTML server. | 90 // Create map of canned responses and set up the test HTML server. |
| 105 std::map<GURL, std::string> responses; | 91 std::map<GURL, std::string> responses; |
| 106 const GURL URL1 = web::test::HttpServer::MakeUrl("http://fragmentLink"); | 92 const GURL URL1 = web::test::HttpServer::MakeUrl("http://fragmentLink"); |
| 107 const std::string response = "<a href='#hash' id='link'>link</a>"; | 93 const std::string response = "<a href='#hash' id='link'>link</a>"; |
| 108 responses[URL1] = response; | 94 responses[URL1] = response; |
| 109 | 95 |
| 110 const GURL URL2 = web::test::HttpServer::MakeUrl("http://fragmentLink/#hash"); | 96 const GURL URL2 = web::test::HttpServer::MakeUrl("http://fragmentLink/#hash"); |
| 111 | 97 |
| 112 web::test::SetUpSimpleHttpServer(responses); | 98 web::test::SetUpSimpleHttpServer(responses); |
| 113 | 99 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 web::shell_test_util::TapWebViewElementWithId("link"); | 174 web::shell_test_util::TapWebViewElementWithId("link"); |
| 189 | 175 |
| 190 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] | 176 [[EarlGrey selectElementWithMatcher:web::addressFieldText(URL.spec())] |
| 191 assertWithMatcher:grey_notNil()]; | 177 assertWithMatcher:grey_notNil()]; |
| 192 [[EarlGrey | 178 [[EarlGrey |
| 193 selectElementWithMatcher:web::webViewContainingText("No navigation!")] | 179 selectElementWithMatcher:web::webViewContainingText("No navigation!")] |
| 194 assertWithMatcher:grey_notNil()]; | 180 assertWithMatcher:grey_notNil()]; |
| 195 } | 181 } |
| 196 | 182 |
| 197 @end | 183 @end |
| OLD | NEW |