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