| 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 18 matching lines...) Expand all Loading... |
| 29 #import "ios/testing/wait_util.h" | 29 #import "ios/testing/wait_util.h" |
| 30 #import "ios/web/public/test/earl_grey/web_view_actions.h" | 30 #import "ios/web/public/test/earl_grey/web_view_actions.h" |
| 31 #import "ios/web/public/test/earl_grey/web_view_matchers.h" | 31 #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| 32 #import "ios/web/public/test/http_server.h" | 32 #import "ios/web/public/test/http_server.h" |
| 33 #include "ios/web/public/test/http_server_util.h" | 33 #include "ios/web/public/test/http_server_util.h" |
| 34 #include "ios/web/public/test/response_providers/data_response_provider.h" | 34 #include "ios/web/public/test/response_providers/data_response_provider.h" |
| 35 #include "net/http/http_response_headers.h" | 35 #include "net/http/http_response_headers.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "url/gurl.h" | 37 #include "url/gurl.h" |
| 38 | 38 |
| 39 using chrome_test_util::omniboxText; | 39 using chrome_test_util::OmniboxText; |
| 40 using chrome_test_util::webViewContainingText; | 40 using chrome_test_util::WebViewContainingText; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // URL used for the reload test. | 44 // URL used for the reload test. |
| 45 const char kReloadTestUrl[] = "http://mock/reloadTest"; | 45 const char kReloadTestUrl[] = "http://mock/reloadTest"; |
| 46 | 46 |
| 47 // Returns the number of serviced requests in HTTP body. | 47 // Returns the number of serviced requests in HTTP body. |
| 48 class ReloadResponseProvider : public web::DataResponseProvider { | 48 class ReloadResponseProvider : public web::DataResponseProvider { |
| 49 public: | 49 public: |
| 50 ReloadResponseProvider() : request_number_(0) {} | 50 ReloadResponseProvider() : request_number_(0) {} |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }; | 115 }; |
| 116 } // namespace | 116 } // namespace |
| 117 | 117 |
| 118 // Tests web browsing scenarios. | 118 // Tests web browsing scenarios. |
| 119 @interface BrowsingTestCase : ChromeTestCase | 119 @interface BrowsingTestCase : ChromeTestCase |
| 120 @end | 120 @end |
| 121 | 121 |
| 122 @implementation BrowsingTestCase | 122 @implementation BrowsingTestCase |
| 123 | 123 |
| 124 // Matcher for the title of the current tab (on tablet only). | 124 // Matcher for the title of the current tab (on tablet only). |
| 125 id<GREYMatcher> tabWithTitle(const std::string& tab_title) { | 125 id<GREYMatcher> TabWithTitle(const std::string& tab_title) { |
| 126 id<GREYMatcher> notPartOfOmnibox = | 126 id<GREYMatcher> notPartOfOmnibox = |
| 127 grey_not(grey_ancestor(chrome_test_util::omnibox())); | 127 grey_not(grey_ancestor(chrome_test_util::Omnibox())); |
| 128 return grey_allOf(grey_accessibilityLabel(base::SysUTF8ToNSString(tab_title)), | 128 return grey_allOf(grey_accessibilityLabel(base::SysUTF8ToNSString(tab_title)), |
| 129 notPartOfOmnibox, nil); | 129 notPartOfOmnibox, nil); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Matcher for a Go button that is interactable. | 132 // Matcher for a Go button that is interactable. |
| 133 id<GREYMatcher> goButtonMatcher() { | 133 id<GREYMatcher> GoButtonMatcher() { |
| 134 return grey_allOf(grey_accessibilityID(@"Go"), grey_interactable(), nil); | 134 return grey_allOf(grey_accessibilityID(@"Go"), grey_interactable(), nil); |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Tests that page successfully reloads. | 137 // Tests that page successfully reloads. |
| 138 - (void)testReload { | 138 - (void)testReload { |
| 139 // Set up test HTTP server responses. | 139 // Set up test HTTP server responses. |
| 140 std::unique_ptr<web::DataResponseProvider> provider( | 140 std::unique_ptr<web::DataResponseProvider> provider( |
| 141 new ReloadResponseProvider()); | 141 new ReloadResponseProvider()); |
| 142 web::test::SetUpHttpServer(std::move(provider)); | 142 web::test::SetUpHttpServer(std::move(provider)); |
| 143 | 143 |
| 144 GURL URL = ReloadResponseProvider::GetReloadTestUrl(); | 144 GURL URL = ReloadResponseProvider::GetReloadTestUrl(); |
| 145 [ChromeEarlGrey loadURL:URL]; | 145 [ChromeEarlGrey loadURL:URL]; |
| 146 std::string expectedBodyBeforeReload( | 146 std::string expectedBodyBeforeReload( |
| 147 ReloadResponseProvider::GetResponseBody(0 /* request number */)); | 147 ReloadResponseProvider::GetResponseBody(0 /* request number */)); |
| 148 [[EarlGrey | 148 [[EarlGrey |
| 149 selectElementWithMatcher:webViewContainingText(expectedBodyBeforeReload)] | 149 selectElementWithMatcher:WebViewContainingText(expectedBodyBeforeReload)] |
| 150 assertWithMatcher:grey_notNil()]; | 150 assertWithMatcher:grey_notNil()]; |
| 151 | 151 |
| 152 [ChromeEarlGreyUI reload]; | 152 [ChromeEarlGreyUI reload]; |
| 153 std::string expectedBodyAfterReload( | 153 std::string expectedBodyAfterReload( |
| 154 ReloadResponseProvider::GetResponseBody(1 /* request_number */)); | 154 ReloadResponseProvider::GetResponseBody(1 /* request_number */)); |
| 155 [[EarlGrey | 155 [[EarlGrey |
| 156 selectElementWithMatcher:webViewContainingText(expectedBodyAfterReload)] | 156 selectElementWithMatcher:WebViewContainingText(expectedBodyAfterReload)] |
| 157 assertWithMatcher:grey_notNil()]; | 157 assertWithMatcher:grey_notNil()]; |
| 158 } | 158 } |
| 159 | 159 |
| 160 // Tests that a tab's title is based on the URL when no other information is | 160 // Tests that a tab's title is based on the URL when no other information is |
| 161 // available. | 161 // available. |
| 162 - (void)testBrowsingTabTitleSetFromURL { | 162 - (void)testBrowsingTabTitleSetFromURL { |
| 163 if (!IsIPadIdiom()) { | 163 if (!IsIPadIdiom()) { |
| 164 EARL_GREY_TEST_SKIPPED(@"Tab Title not displayed on handset."); | 164 EARL_GREY_TEST_SKIPPED(@"Tab Title not displayed on handset."); |
| 165 } | 165 } |
| 166 | 166 |
| 167 web::test::SetUpFileBasedHttpServer(); | 167 web::test::SetUpFileBasedHttpServer(); |
| 168 | 168 |
| 169 const GURL destinationURL = web::test::HttpServer::MakeUrl( | 169 const GURL destinationURL = web::test::HttpServer::MakeUrl( |
| 170 "http://ios/testing/data/http_server_files/destination.html"); | 170 "http://ios/testing/data/http_server_files/destination.html"); |
| 171 [ChromeEarlGrey loadURL:destinationURL]; | 171 [ChromeEarlGrey loadURL:destinationURL]; |
| 172 | 172 |
| 173 // Add 3 for the "://" which is not considered part of the scheme | 173 // Add 3 for the "://" which is not considered part of the scheme |
| 174 std::string URLWithoutScheme = | 174 std::string URLWithoutScheme = |
| 175 destinationURL.spec().substr(destinationURL.scheme().length() + 3); | 175 destinationURL.spec().substr(destinationURL.scheme().length() + 3); |
| 176 | 176 |
| 177 [[EarlGrey selectElementWithMatcher:tabWithTitle(URLWithoutScheme)] | 177 [[EarlGrey selectElementWithMatcher:TabWithTitle(URLWithoutScheme)] |
| 178 assertWithMatcher:grey_sufficientlyVisible()]; | 178 assertWithMatcher:grey_sufficientlyVisible()]; |
| 179 } | 179 } |
| 180 | 180 |
| 181 // Tests that after a PDF is loaded, the title appears in the tab bar on iPad. | 181 // Tests that after a PDF is loaded, the title appears in the tab bar on iPad. |
| 182 - (void)testPDFLoadTitle { | 182 - (void)testPDFLoadTitle { |
| 183 if (!IsIPadIdiom()) { | 183 if (!IsIPadIdiom()) { |
| 184 EARL_GREY_TEST_SKIPPED(@"Tab Title not displayed on handset."); | 184 EARL_GREY_TEST_SKIPPED(@"Tab Title not displayed on handset."); |
| 185 } | 185 } |
| 186 | 186 |
| 187 web::test::SetUpFileBasedHttpServer(); | 187 web::test::SetUpFileBasedHttpServer(); |
| 188 | 188 |
| 189 const GURL destinationURL = web::test::HttpServer::MakeUrl( | 189 const GURL destinationURL = web::test::HttpServer::MakeUrl( |
| 190 "http://ios/testing/data/http_server_files/testpage.pdf"); | 190 "http://ios/testing/data/http_server_files/testpage.pdf"); |
| 191 [ChromeEarlGrey loadURL:destinationURL]; | 191 [ChromeEarlGrey loadURL:destinationURL]; |
| 192 | 192 |
| 193 // Add 3 for the "://" which is not considered part of the scheme | 193 // Add 3 for the "://" which is not considered part of the scheme |
| 194 std::string URLWithoutScheme = | 194 std::string URLWithoutScheme = |
| 195 destinationURL.spec().substr(destinationURL.scheme().length() + 3); | 195 destinationURL.spec().substr(destinationURL.scheme().length() + 3); |
| 196 | 196 |
| 197 [[EarlGrey selectElementWithMatcher:tabWithTitle(URLWithoutScheme)] | 197 [[EarlGrey selectElementWithMatcher:TabWithTitle(URLWithoutScheme)] |
| 198 assertWithMatcher:grey_sufficientlyVisible()]; | 198 assertWithMatcher:grey_sufficientlyVisible()]; |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Tests that tab title is set to the specified title from a JavaScript. | 201 // Tests that tab title is set to the specified title from a JavaScript. |
| 202 - (void)testBrowsingTabTitleSetFromScript { | 202 - (void)testBrowsingTabTitleSetFromScript { |
| 203 if (!IsIPadIdiom()) { | 203 if (!IsIPadIdiom()) { |
| 204 EARL_GREY_TEST_SKIPPED(@"Tab Title not displayed on handset."); | 204 EARL_GREY_TEST_SKIPPED(@"Tab Title not displayed on handset."); |
| 205 } | 205 } |
| 206 | 206 |
| 207 const char* kPageTitle = "Some title"; | 207 const char* kPageTitle = "Some title"; |
| 208 const GURL URL = GURL(base::StringPrintf( | 208 const GURL URL = GURL(base::StringPrintf( |
| 209 "data:text/html;charset=utf-8,<script>document.title = " | 209 "data:text/html;charset=utf-8,<script>document.title = " |
| 210 "\"%s\"</script>", | 210 "\"%s\"</script>", |
| 211 kPageTitle)); | 211 kPageTitle)); |
| 212 [ChromeEarlGrey loadURL:URL]; | 212 [ChromeEarlGrey loadURL:URL]; |
| 213 | 213 |
| 214 [[EarlGrey selectElementWithMatcher:tabWithTitle(kPageTitle)] | 214 [[EarlGrey selectElementWithMatcher:TabWithTitle(kPageTitle)] |
| 215 assertWithMatcher:grey_sufficientlyVisible()]; | 215 assertWithMatcher:grey_sufficientlyVisible()]; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // Tests clicking a link with target="_blank" and "event.stopPropagation()" | 218 // Tests clicking a link with target="_blank" and "event.stopPropagation()" |
| 219 // opens a new tab. | 219 // opens a new tab. |
| 220 - (void)testBrowsingStopPropagation { | 220 - (void)testBrowsingStopPropagation { |
| 221 // Create map of canned responses and set up the test HTML server. | 221 // Create map of canned responses and set up the test HTML server. |
| 222 std::map<GURL, std::string> responses; | 222 std::map<GURL, std::string> responses; |
| 223 const GURL URL = web::test::HttpServer::MakeUrl("http://stopPropagation"); | 223 const GURL URL = web::test::HttpServer::MakeUrl("http://stopPropagation"); |
| 224 const GURL destinationURL = | 224 const GURL destinationURL = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 235 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); | 235 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); |
| 236 | 236 |
| 237 [ChromeEarlGrey loadURL:URL]; | 237 [ChromeEarlGrey loadURL:URL]; |
| 238 chrome_test_util::AssertMainTabCount(1); | 238 chrome_test_util::AssertMainTabCount(1); |
| 239 | 239 |
| 240 chrome_test_util::TapWebViewElementWithId("link"); | 240 chrome_test_util::TapWebViewElementWithId("link"); |
| 241 | 241 |
| 242 chrome_test_util::AssertMainTabCount(2); | 242 chrome_test_util::AssertMainTabCount(2); |
| 243 | 243 |
| 244 // Verify the new tab was opened with the expected URL. | 244 // Verify the new tab was opened with the expected URL. |
| 245 [[EarlGrey selectElementWithMatcher:omniboxText(destinationURL.GetContent())] | 245 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 246 assertWithMatcher:grey_notNil()]; | 246 assertWithMatcher:grey_notNil()]; |
| 247 } | 247 } |
| 248 | 248 |
| 249 // Tests clicking a relative link with target="_blank" and | 249 // Tests clicking a relative link with target="_blank" and |
| 250 // "event.stopPropagation()" opens a new tab. | 250 // "event.stopPropagation()" opens a new tab. |
| 251 - (void)testBrowsingStopPropagationRelativePath { | 251 - (void)testBrowsingStopPropagationRelativePath { |
| 252 // Create map of canned responses and set up the test HTML server. | 252 // Create map of canned responses and set up the test HTML server. |
| 253 std::map<GURL, std::string> responses; | 253 std::map<GURL, std::string> responses; |
| 254 const GURL URL = web::test::HttpServer::MakeUrl("http://stopPropRel"); | 254 const GURL URL = web::test::HttpServer::MakeUrl("http://stopPropRel"); |
| 255 const GURL destinationURL = | 255 const GURL destinationURL = |
| 256 web::test::HttpServer::MakeUrl("http://stopPropRel/#test"); | 256 web::test::HttpServer::MakeUrl("http://stopPropRel/#test"); |
| 257 // This is page with a relative link to "#test". | 257 // This is page with a relative link to "#test". |
| 258 responses[URL] = | 258 responses[URL] = |
| 259 "<a id='link' href='#test' target='_blank' " | 259 "<a id='link' href='#test' target='_blank' " |
| 260 "onclick='event.stopPropagation()'>link</a>"; | 260 "onclick='event.stopPropagation()'>link</a>"; |
| 261 // This is the page that should be showing at the end of the test. | 261 // This is the page that should be showing at the end of the test. |
| 262 responses[destinationURL] = "You've arrived!"; | 262 responses[destinationURL] = "You've arrived!"; |
| 263 web::test::SetUpSimpleHttpServer(responses); | 263 web::test::SetUpSimpleHttpServer(responses); |
| 264 | 264 |
| 265 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); | 265 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); |
| 266 | 266 |
| 267 [ChromeEarlGrey loadURL:URL]; | 267 [ChromeEarlGrey loadURL:URL]; |
| 268 chrome_test_util::AssertMainTabCount(1); | 268 chrome_test_util::AssertMainTabCount(1); |
| 269 | 269 |
| 270 chrome_test_util::TapWebViewElementWithId("link"); | 270 chrome_test_util::TapWebViewElementWithId("link"); |
| 271 | 271 |
| 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 - (void)testBrowsingPreventDefaultWithLinkOpenedByJavascript { |
| 283 // Create map of canned responses and set up the test HTML server. | 283 // Create map of canned responses and set up the test HTML server. |
| 284 std::map<GURL, std::string> responses; | 284 std::map<GURL, std::string> responses; |
| 285 const GURL URL = web::test::HttpServer::MakeUrl( | 285 const GURL URL = web::test::HttpServer::MakeUrl( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 303 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); | 303 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); |
| 304 | 304 |
| 305 [ChromeEarlGrey loadURL:URL]; | 305 [ChromeEarlGrey loadURL:URL]; |
| 306 chrome_test_util::AssertMainTabCount(1); | 306 chrome_test_util::AssertMainTabCount(1); |
| 307 | 307 |
| 308 chrome_test_util::TapWebViewElementWithId("link"); | 308 chrome_test_util::TapWebViewElementWithId("link"); |
| 309 | 309 |
| 310 chrome_test_util::AssertMainTabCount(2); | 310 chrome_test_util::AssertMainTabCount(2); |
| 311 | 311 |
| 312 // Verify the new tab was opened with the expected URL. | 312 // Verify the new tab was opened with the expected URL. |
| 313 [[EarlGrey selectElementWithMatcher:omniboxText(anchorURL.GetContent())] | 313 [[EarlGrey selectElementWithMatcher:OmniboxText(anchorURL.GetContent())] |
| 314 assertWithMatcher:grey_notNil()]; | 314 assertWithMatcher:grey_notNil()]; |
| 315 } | 315 } |
| 316 | 316 |
| 317 // Tests tapping a link that navigates to a page that immediately navigates | 317 // Tests tapping a link that navigates to a page that immediately navigates |
| 318 // again via document.location.href. | 318 // again via document.location.href. |
| 319 - (void)testBrowsingWindowDataLinkScriptRedirect { | 319 - (void)testBrowsingWindowDataLinkScriptRedirect { |
| 320 // Create map of canned responses and set up the test HTML server. | 320 // Create map of canned responses and set up the test HTML server. |
| 321 std::map<GURL, std::string> responses; | 321 std::map<GURL, std::string> responses; |
| 322 const GURL URL = | 322 const GURL URL = |
| 323 web::test::HttpServer::MakeUrl("http://windowDataLinkScriptRedirect"); | 323 web::test::HttpServer::MakeUrl("http://windowDataLinkScriptRedirect"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 342 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); | 342 ScopedBlockPopupsPref prefSetter(CONTENT_SETTING_ALLOW); |
| 343 | 343 |
| 344 [ChromeEarlGrey loadURL:URL]; | 344 [ChromeEarlGrey loadURL:URL]; |
| 345 chrome_test_util::AssertMainTabCount(1); | 345 chrome_test_util::AssertMainTabCount(1); |
| 346 | 346 |
| 347 chrome_test_util::TapWebViewElementWithId("link"); | 347 chrome_test_util::TapWebViewElementWithId("link"); |
| 348 | 348 |
| 349 chrome_test_util::AssertMainTabCount(2); | 349 chrome_test_util::AssertMainTabCount(2); |
| 350 | 350 |
| 351 // Verify the new tab was opened with the expected URL. | 351 // Verify the new tab was opened with the expected URL. |
| 352 [[EarlGrey selectElementWithMatcher:omniboxText(destinationURL.GetContent())] | 352 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 353 assertWithMatcher:grey_notNil()]; | 353 assertWithMatcher:grey_notNil()]; |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Tests that pressing the button on a POST-based form changes the page and that | 356 // Tests that pressing the button on a POST-based form changes the page and that |
| 357 // the back button works as expected afterwards. | 357 // the back button works as expected afterwards. |
| 358 - (void)testBrowsingPostEntryWithButton { | 358 - (void)testBrowsingPostEntryWithButton { |
| 359 // Create map of canned responses and set up the test HTML server. | 359 // Create map of canned responses and set up the test HTML server. |
| 360 std::map<GURL, std::string> responses; | 360 std::map<GURL, std::string> responses; |
| 361 const GURL URL = web::test::HttpServer::MakeUrl("http://postEntryWithButton"); | 361 const GURL URL = web::test::HttpServer::MakeUrl("http://postEntryWithButton"); |
| 362 const GURL destinationURL = web::test::HttpServer::MakeUrl("http://foo"); | 362 const GURL destinationURL = web::test::HttpServer::MakeUrl("http://foo"); |
| 363 // This is a page with a button that posts to the destination. | 363 // This is a page with a button that posts to the destination. |
| 364 responses[URL] = base::StringPrintf( | 364 responses[URL] = base::StringPrintf( |
| 365 "<form action='%s' method='post'>" | 365 "<form action='%s' method='post'>" |
| 366 "<input value='button' type='submit' id='button'></form>", | 366 "<input value='button' type='submit' id='button'></form>", |
| 367 destinationURL.spec().c_str()); | 367 destinationURL.spec().c_str()); |
| 368 // This is the page that should be showing at the end of the test. | 368 // This is the page that should be showing at the end of the test. |
| 369 responses[destinationURL] = "bar!"; | 369 responses[destinationURL] = "bar!"; |
| 370 web::test::SetUpSimpleHttpServer(responses); | 370 web::test::SetUpSimpleHttpServer(responses); |
| 371 | 371 |
| 372 [ChromeEarlGrey loadURL:URL]; | 372 [ChromeEarlGrey loadURL:URL]; |
| 373 chrome_test_util::TapWebViewElementWithId("button"); | 373 chrome_test_util::TapWebViewElementWithId("button"); |
| 374 | 374 |
| 375 [[EarlGrey selectElementWithMatcher:omniboxText(destinationURL.GetContent())] | 375 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 376 assertWithMatcher:grey_notNil()]; | 376 assertWithMatcher:grey_notNil()]; |
| 377 | 377 |
| 378 // Go back and verify the browser navigates to the original URL. | 378 // Go back and verify the browser navigates to the original URL. |
| 379 [self goBack]; | 379 [self goBack]; |
| 380 [[EarlGrey selectElementWithMatcher:omniboxText(URL.GetContent())] | 380 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 381 assertWithMatcher:grey_notNil()]; | 381 assertWithMatcher:grey_notNil()]; |
| 382 } | 382 } |
| 383 | 383 |
| 384 // Tests that a link with a JavaScript-based navigation changes the page and | 384 // Tests that a link with a JavaScript-based navigation changes the page and |
| 385 // that the back button works as expected afterwards. | 385 // that the back button works as expected afterwards. |
| 386 - (void)testBrowsingJavaScriptBasedNavigation { | 386 - (void)testBrowsingJavaScriptBasedNavigation { |
| 387 std::map<GURL, std::string> responses; | 387 std::map<GURL, std::string> responses; |
| 388 const GURL URL = web::test::HttpServer::MakeUrl("http://origin"); | 388 const GURL URL = web::test::HttpServer::MakeUrl("http://origin"); |
| 389 const GURL destURL = web::test::HttpServer::MakeUrl("http://destination"); | 389 const GURL destURL = web::test::HttpServer::MakeUrl("http://destination"); |
| 390 // Page containing a link with onclick attribute that sets window.location | 390 // Page containing a link with onclick attribute that sets window.location |
| 391 // to the destination URL. | 391 // to the destination URL. |
| 392 responses[URL] = base::StringPrintf( | 392 responses[URL] = base::StringPrintf( |
| 393 "<a href='#' onclick=\"window.location='%s';\" id='link'>Link</a>", | 393 "<a href='#' onclick=\"window.location='%s';\" id='link'>Link</a>", |
| 394 destURL.spec().c_str()); | 394 destURL.spec().c_str()); |
| 395 // Page with some text. | 395 // Page with some text. |
| 396 responses[destURL] = "You've arrived!"; | 396 responses[destURL] = "You've arrived!"; |
| 397 web::test::SetUpSimpleHttpServer(responses); | 397 web::test::SetUpSimpleHttpServer(responses); |
| 398 | 398 |
| 399 [ChromeEarlGrey loadURL:URL]; | 399 [ChromeEarlGrey loadURL:URL]; |
| 400 chrome_test_util::TapWebViewElementWithId("link"); | 400 chrome_test_util::TapWebViewElementWithId("link"); |
| 401 | 401 |
| 402 [[EarlGrey selectElementWithMatcher:omniboxText(destURL.GetContent())] | 402 [[EarlGrey selectElementWithMatcher:OmniboxText(destURL.GetContent())] |
| 403 assertWithMatcher:grey_notNil()]; | 403 assertWithMatcher:grey_notNil()]; |
| 404 | 404 |
| 405 [self goBack]; | 405 [self goBack]; |
| 406 [[EarlGrey selectElementWithMatcher:omniboxText(URL.GetContent())] | 406 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 407 assertWithMatcher:grey_notNil()]; | 407 assertWithMatcher:grey_notNil()]; |
| 408 } | 408 } |
| 409 | 409 |
| 410 // TODO(crbug.com/638674): Evaluate if this can move to shared code | 410 // TODO(crbug.com/638674): Evaluate if this can move to shared code |
| 411 // Navigates back to the previous webpage. | 411 // Navigates back to the previous webpage. |
| 412 - (void)goBack { | 412 - (void)goBack { |
| 413 base::scoped_nsobject<GenericChromeCommand> backCommand( | 413 base::scoped_nsobject<GenericChromeCommand> backCommand( |
| 414 [[GenericChromeCommand alloc] initWithTag:IDC_BACK]); | 414 [[GenericChromeCommand alloc] initWithTag:IDC_BACK]); |
| 415 chrome_test_util::RunCommandWithActiveViewController(backCommand); | 415 chrome_test_util::RunCommandWithActiveViewController(backCommand); |
| 416 | 416 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 chrome_test_util::AssertMainTabCount(1U); | 448 chrome_test_util::AssertMainTabCount(1U); |
| 449 chrome_test_util::AssertIncognitoTabCount(0U); | 449 chrome_test_util::AssertIncognitoTabCount(0U); |
| 450 | 450 |
| 451 [ChromeEarlGrey loadURL:URL]; | 451 [ChromeEarlGrey loadURL:URL]; |
| 452 | 452 |
| 453 // Tap on chrome://version link. | 453 // Tap on chrome://version link. |
| 454 [ChromeEarlGrey tapWebViewElementWithID:@"link"]; | 454 [ChromeEarlGrey tapWebViewElementWithID:@"link"]; |
| 455 | 455 |
| 456 // Verify that page did not change by checking its URL and message printed by | 456 // Verify that page did not change by checking its URL and message printed by |
| 457 // onclick event. | 457 // onclick event. |
| 458 [[EarlGrey selectElementWithMatcher:omniboxText("chrome://version")] | 458 [[EarlGrey selectElementWithMatcher:OmniboxText("chrome://version")] |
| 459 assertWithMatcher:grey_nil()]; | 459 assertWithMatcher:grey_nil()]; |
| 460 [[EarlGrey selectElementWithMatcher:webViewContainingText("Hello world!")] | 460 [[EarlGrey selectElementWithMatcher:WebViewContainingText("Hello world!")] |
| 461 assertWithMatcher:grey_notNil()]; | 461 assertWithMatcher:grey_notNil()]; |
| 462 | 462 |
| 463 // Verify that no new tabs were open which could load chrome://version. | 463 // Verify that no new tabs were open which could load chrome://version. |
| 464 chrome_test_util::AssertMainTabCount(1U); | 464 chrome_test_util::AssertMainTabCount(1U); |
| 465 } | 465 } |
| 466 | 466 |
| 467 // Tests that pressing the button on a POST-based form with same-page action | 467 // Tests that pressing the button on a POST-based form with same-page action |
| 468 // does not change the page and that the back button works as expected | 468 // does not change the page and that the back button works as expected |
| 469 // afterwards. | 469 // afterwards. |
| 470 - (void)testBrowsingPostToSamePage { | 470 - (void)testBrowsingPostToSamePage { |
| 471 // Create map of canned responses and set up the test HTML server. | 471 // Create map of canned responses and set up the test HTML server. |
| 472 std::map<GURL, std::string> responses; | 472 std::map<GURL, std::string> responses; |
| 473 const GURL firstURL = web::test::HttpServer::MakeUrl("http://first"); | 473 const GURL firstURL = web::test::HttpServer::MakeUrl("http://first"); |
| 474 const GURL formURL = web::test::HttpServer::MakeUrl("http://form"); | 474 const GURL formURL = web::test::HttpServer::MakeUrl("http://form"); |
| 475 // This is just a page with some text. | 475 // This is just a page with some text. |
| 476 responses[firstURL] = "foo"; | 476 responses[firstURL] = "foo"; |
| 477 // This is a page with at button that posts to the current URL. | 477 // This is a page with at button that posts to the current URL. |
| 478 responses[formURL] = | 478 responses[formURL] = |
| 479 "<form method='post'>" | 479 "<form method='post'>" |
| 480 "<input value='button' type='submit' id='button'></form>"; | 480 "<input value='button' type='submit' id='button'></form>"; |
| 481 web::test::SetUpSimpleHttpServer(responses); | 481 web::test::SetUpSimpleHttpServer(responses); |
| 482 | 482 |
| 483 // Open the first URL so it's in history. | 483 // Open the first URL so it's in history. |
| 484 [ChromeEarlGrey loadURL:firstURL]; | 484 [ChromeEarlGrey loadURL:firstURL]; |
| 485 | 485 |
| 486 // Open the second URL, tap the button, and verify the browser navigates to | 486 // Open the second URL, tap the button, and verify the browser navigates to |
| 487 // the expected URL. | 487 // the expected URL. |
| 488 [ChromeEarlGrey loadURL:formURL]; | 488 [ChromeEarlGrey loadURL:formURL]; |
| 489 chrome_test_util::TapWebViewElementWithId("button"); | 489 chrome_test_util::TapWebViewElementWithId("button"); |
| 490 [[EarlGrey selectElementWithMatcher:omniboxText(formURL.GetContent())] | 490 [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] |
| 491 assertWithMatcher:grey_notNil()]; | 491 assertWithMatcher:grey_notNil()]; |
| 492 | 492 |
| 493 // Go back once and verify the browser navigates to the form URL. | 493 // Go back once and verify the browser navigates to the form URL. |
| 494 [self goBack]; | 494 [self goBack]; |
| 495 [[EarlGrey selectElementWithMatcher:omniboxText(formURL.GetContent())] | 495 [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())] |
| 496 assertWithMatcher:grey_notNil()]; | 496 assertWithMatcher:grey_notNil()]; |
| 497 | 497 |
| 498 // Go back a second time and verify the browser navigates to the first URL. | 498 // Go back a second time and verify the browser navigates to the first URL. |
| 499 [self goBack]; | 499 [self goBack]; |
| 500 [[EarlGrey selectElementWithMatcher:omniboxText(firstURL.GetContent())] | 500 [[EarlGrey selectElementWithMatcher:OmniboxText(firstURL.GetContent())] |
| 501 assertWithMatcher:grey_notNil()]; | 501 assertWithMatcher:grey_notNil()]; |
| 502 } | 502 } |
| 503 | 503 |
| 504 // Tests that evaluating user JavaScript that causes navigation correctly | 504 // Tests that evaluating user JavaScript that causes navigation correctly |
| 505 // modifies history. | 505 // modifies history. |
| 506 - (void)testBrowsingUserJavaScriptNavigation { | 506 - (void)testBrowsingUserJavaScriptNavigation { |
| 507 // TODO(crbug.com/640220): Keyboard entry inside the omnibox fails only on | 507 // TODO(crbug.com/640220): Keyboard entry inside the omnibox fails only on |
| 508 // iPad running iOS 10. | 508 // iPad running iOS 10. |
| 509 if (IsIPadIdiom() && base::ios::IsRunningOnIOS10OrLater()) | 509 if (IsIPadIdiom() && base::ios::IsRunningOnIOS10OrLater()) |
| 510 return; | 510 return; |
| 511 | 511 |
| 512 // Create map of canned responses and set up the test HTML server. | 512 // Create map of canned responses and set up the test HTML server. |
| 513 std::map<GURL, std::string> responses; | 513 std::map<GURL, std::string> responses; |
| 514 const GURL startURL = web::test::HttpServer::MakeUrl("http://startpage"); | 514 const GURL startURL = web::test::HttpServer::MakeUrl("http://startpage"); |
| 515 responses[startURL] = "<html><body><p>Ready to begin.</p></body></html>"; | 515 responses[startURL] = "<html><body><p>Ready to begin.</p></body></html>"; |
| 516 const GURL targetURL = web::test::HttpServer::MakeUrl("http://targetpage"); | 516 const GURL targetURL = web::test::HttpServer::MakeUrl("http://targetpage"); |
| 517 responses[targetURL] = "<html><body><p>You've arrived!</p></body></html>"; | 517 responses[targetURL] = "<html><body><p>You've arrived!</p></body></html>"; |
| 518 web::test::SetUpSimpleHttpServer(responses); | 518 web::test::SetUpSimpleHttpServer(responses); |
| 519 | 519 |
| 520 // Load the first page and run JS (using the codepath that user-entered JS in | 520 // Load the first page and run JS (using the codepath that user-entered JS in |
| 521 // the omnibox would take, not page-triggered) that should navigate. | 521 // the omnibox would take, not page-triggered) that should navigate. |
| 522 [ChromeEarlGrey loadURL:startURL]; | 522 [ChromeEarlGrey loadURL:startURL]; |
| 523 | 523 |
| 524 NSString* script = | 524 NSString* script = |
| 525 [NSString stringWithFormat:@"javascript:window.location='%s'", | 525 [NSString stringWithFormat:@"javascript:window.location='%s'", |
| 526 targetURL.spec().c_str()]; | 526 targetURL.spec().c_str()]; |
| 527 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] | 527 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] |
| 528 performAction:grey_typeText(script)]; | 528 performAction:grey_typeText(script)]; |
| 529 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] | 529 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] |
| 530 performAction:grey_tap()]; | 530 performAction:grey_tap()]; |
| 531 [ChromeEarlGrey waitForPageToFinishLoading]; | 531 [ChromeEarlGrey waitForPageToFinishLoading]; |
| 532 | 532 |
| 533 [[EarlGrey selectElementWithMatcher:omniboxText(targetURL.GetContent())] | 533 [[EarlGrey selectElementWithMatcher:OmniboxText(targetURL.GetContent())] |
| 534 assertWithMatcher:grey_notNil()]; | 534 assertWithMatcher:grey_notNil()]; |
| 535 | 535 |
| 536 [self goBack]; | 536 [self goBack]; |
| 537 [[EarlGrey selectElementWithMatcher:omniboxText(startURL.GetContent())] | 537 [[EarlGrey selectElementWithMatcher:OmniboxText(startURL.GetContent())] |
| 538 assertWithMatcher:grey_notNil()]; | 538 assertWithMatcher:grey_notNil()]; |
| 539 } | 539 } |
| 540 | 540 |
| 541 // Tests that evaluating non-navigation user JavaScript doesn't affect history. | 541 // Tests that evaluating non-navigation user JavaScript doesn't affect history. |
| 542 - (void)testBrowsingUserJavaScriptWithoutNavigation { | 542 - (void)testBrowsingUserJavaScriptWithoutNavigation { |
| 543 // TODO(crbug.com/640220): Keyboard entry inside the omnibox fails only on | 543 // TODO(crbug.com/640220): Keyboard entry inside the omnibox fails only on |
| 544 // iPad running iOS 10. | 544 // iPad running iOS 10. |
| 545 if (IsIPadIdiom() && base::ios::IsRunningOnIOS10OrLater()) | 545 if (IsIPadIdiom() && base::ios::IsRunningOnIOS10OrLater()) |
| 546 return; | 546 return; |
| 547 | 547 |
| 548 // Create map of canned responses and set up the test HTML server. | 548 // Create map of canned responses and set up the test HTML server. |
| 549 std::map<GURL, std::string> responses; | 549 std::map<GURL, std::string> responses; |
| 550 const GURL firstURL = web::test::HttpServer::MakeUrl("http://firstURL"); | 550 const GURL firstURL = web::test::HttpServer::MakeUrl("http://firstURL"); |
| 551 const std::string firstResponse = "Test Page 1"; | 551 const std::string firstResponse = "Test Page 1"; |
| 552 const GURL secondURL = web::test::HttpServer::MakeUrl("http://secondURL"); | 552 const GURL secondURL = web::test::HttpServer::MakeUrl("http://secondURL"); |
| 553 const std::string secondResponse = "Test Page 2"; | 553 const std::string secondResponse = "Test Page 2"; |
| 554 responses[firstURL] = firstResponse; | 554 responses[firstURL] = firstResponse; |
| 555 responses[secondURL] = secondResponse; | 555 responses[secondURL] = secondResponse; |
| 556 web::test::SetUpSimpleHttpServer(responses); | 556 web::test::SetUpSimpleHttpServer(responses); |
| 557 | 557 |
| 558 [ChromeEarlGrey loadURL:firstURL]; | 558 [ChromeEarlGrey loadURL:firstURL]; |
| 559 [ChromeEarlGrey loadURL:secondURL]; | 559 [ChromeEarlGrey loadURL:secondURL]; |
| 560 | 560 |
| 561 // Execute some JavaScript in the omnibox. | 561 // Execute some JavaScript in the omnibox. |
| 562 [[EarlGrey selectElementWithMatcher:chrome_test_util::omnibox()] | 562 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] |
| 563 performAction:grey_typeText(@"javascript:document.write('foo')")]; | 563 performAction:grey_typeText(@"javascript:document.write('foo')")]; |
| 564 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] | 564 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] |
| 565 performAction:grey_tap()]; | 565 performAction:grey_tap()]; |
| 566 | 566 |
| 567 id<GREYMatcher> webView = chrome_test_util::webViewContainingText("foo"); | 567 id<GREYMatcher> webView = chrome_test_util::WebViewContainingText("foo"); |
| 568 [[EarlGrey selectElementWithMatcher:webView] assertWithMatcher:grey_notNil()]; | 568 [[EarlGrey selectElementWithMatcher:webView] assertWithMatcher:grey_notNil()]; |
| 569 | 569 |
| 570 // Verify that the JavaScript did not affect history by going back and then | 570 // Verify that the JavaScript did not affect history by going back and then |
| 571 // forward again. | 571 // forward again. |
| 572 [self goBack]; | 572 [self goBack]; |
| 573 [[EarlGrey selectElementWithMatcher:omniboxText(firstURL.GetContent())] | 573 [[EarlGrey selectElementWithMatcher:OmniboxText(firstURL.GetContent())] |
| 574 assertWithMatcher:grey_notNil()]; | 574 assertWithMatcher:grey_notNil()]; |
| 575 [self goForward]; | 575 [self goForward]; |
| 576 [[EarlGrey selectElementWithMatcher:omniboxText(secondURL.GetContent())] | 576 [[EarlGrey selectElementWithMatcher:OmniboxText(secondURL.GetContent())] |
| 577 assertWithMatcher:grey_notNil()]; | 577 assertWithMatcher:grey_notNil()]; |
| 578 } | 578 } |
| 579 | 579 |
| 580 // Tap the text field indicated by |ID| to open the keyboard, and then | 580 // Tap the text field indicated by |ID| to open the keyboard, and then |
| 581 // press the keyboard's "Go" button. | 581 // press the keyboard's "Go" button. |
| 582 - (void)openKeyboardAndTapGoButtonWithTextFieldID:(const std::string&)ID { | 582 - (void)openKeyboardAndTapGoButtonWithTextFieldID:(const std::string&)ID { |
| 583 // Disable EarlGrey's synchronization since it is blocked by opening the | 583 // Disable EarlGrey's synchronization since it is blocked by opening the |
| 584 // keyboard from a web view. | 584 // keyboard from a web view. |
| 585 [[GREYConfiguration sharedInstance] | 585 [[GREYConfiguration sharedInstance] |
| 586 setValue:@NO | 586 setValue:@NO |
| 587 forConfigKey:kGREYConfigKeySynchronizationEnabled]; | 587 forConfigKey:kGREYConfigKeySynchronizationEnabled]; |
| 588 | 588 |
| 589 // Wait for web view to be interactable before tapping. | 589 // Wait for web view to be interactable before tapping. |
| 590 GREYCondition* interactableCondition = [GREYCondition | 590 GREYCondition* interactableCondition = [GREYCondition |
| 591 conditionWithName:@"Wait for web view to be interactable." | 591 conditionWithName:@"Wait for web view to be interactable." |
| 592 block:^BOOL { | 592 block:^BOOL { |
| 593 NSError* error = nil; | 593 NSError* error = nil; |
| 594 id<GREYMatcher> webViewMatcher = webViewInWebState( | 594 id<GREYMatcher> webViewMatcher = WebViewInWebState( |
| 595 chrome_test_util::GetCurrentWebState()); | 595 chrome_test_util::GetCurrentWebState()); |
| 596 [[EarlGrey selectElementWithMatcher:webViewMatcher] | 596 [[EarlGrey selectElementWithMatcher:webViewMatcher] |
| 597 assertWithMatcher:grey_interactable() | 597 assertWithMatcher:grey_interactable() |
| 598 error:&error]; | 598 error:&error]; |
| 599 return !error; | 599 return !error; |
| 600 }]; | 600 }]; |
| 601 GREYAssert( | 601 GREYAssert( |
| 602 [interactableCondition waitWithTimeout:testing::kWaitForUIElementTimeout], | 602 [interactableCondition waitWithTimeout:testing::kWaitForUIElementTimeout], |
| 603 @"Web view did not become interactable."); | 603 @"Web view did not become interactable."); |
| 604 | 604 |
| 605 web::WebState* currentWebState = chrome_test_util::GetCurrentWebState(); | 605 web::WebState* currentWebState = chrome_test_util::GetCurrentWebState(); |
| 606 [[EarlGrey selectElementWithMatcher:web::webViewInWebState(currentWebState)] | 606 [[EarlGrey selectElementWithMatcher:web::WebViewInWebState(currentWebState)] |
| 607 performAction:web::webViewTapElement(currentWebState, ID)]; | 607 performAction:web::webViewTapElement(currentWebState, ID)]; |
| 608 | 608 |
| 609 // Wait until the keyboard shows up before tapping. | 609 // Wait until the keyboard shows up before tapping. |
| 610 GREYCondition* condition = [GREYCondition | 610 GREYCondition* condition = [GREYCondition |
| 611 conditionWithName:@"Wait for the keyboard to show up." | 611 conditionWithName:@"Wait for the keyboard to show up." |
| 612 block:^BOOL { | 612 block:^BOOL { |
| 613 NSError* error = nil; | 613 NSError* error = nil; |
| 614 [[EarlGrey selectElementWithMatcher:goButtonMatcher()] | 614 [[EarlGrey selectElementWithMatcher:GoButtonMatcher()] |
| 615 assertWithMatcher:grey_notNil() | 615 assertWithMatcher:grey_notNil() |
| 616 error:&error]; | 616 error:&error]; |
| 617 return (error == nil); | 617 return (error == nil); |
| 618 }]; | 618 }]; |
| 619 GREYAssert([condition waitWithTimeout:10], | 619 GREYAssert([condition waitWithTimeout:10], |
| 620 @"No keyboard with 'Go' button showed up."); | 620 @"No keyboard with 'Go' button showed up."); |
| 621 | 621 |
| 622 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] | 622 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] |
| 623 performAction:grey_tap()]; | 623 performAction:grey_tap()]; |
| 624 | 624 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 644 "<form action='%s' method='post'>" | 644 "<form action='%s' method='post'>" |
| 645 "<input value='textfield' id='textfield' type='text'></label>" | 645 "<input value='textfield' id='textfield' type='text'></label>" |
| 646 "<input type='submit'></form>", | 646 "<input type='submit'></form>", |
| 647 destinationURL.spec().c_str()); | 647 destinationURL.spec().c_str()); |
| 648 // This is the page that should be showing at the end of the test. | 648 // This is the page that should be showing at the end of the test. |
| 649 responses[destinationURL] = "baz!"; | 649 responses[destinationURL] = "baz!"; |
| 650 web::test::SetUpSimpleHttpServer(responses); | 650 web::test::SetUpSimpleHttpServer(responses); |
| 651 | 651 |
| 652 // Open the URL, focus the textfield,and submit via keyboard. | 652 // Open the URL, focus the textfield,and submit via keyboard. |
| 653 [ChromeEarlGrey loadURL:URL]; | 653 [ChromeEarlGrey loadURL:URL]; |
| 654 [[EarlGrey selectElementWithMatcher:webViewContainingText("hello!")] | 654 [[EarlGrey selectElementWithMatcher:WebViewContainingText("hello!")] |
| 655 assertWithMatcher:grey_notNil()]; | 655 assertWithMatcher:grey_notNil()]; |
| 656 | 656 |
| 657 [self openKeyboardAndTapGoButtonWithTextFieldID:"textfield"]; | 657 [self openKeyboardAndTapGoButtonWithTextFieldID:"textfield"]; |
| 658 | 658 |
| 659 // Verify that the browser navigates to the expected URL. | 659 // Verify that the browser navigates to the expected URL. |
| 660 [[EarlGrey selectElementWithMatcher:omniboxText(destinationURL.GetContent())] | 660 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 661 assertWithMatcher:grey_notNil()]; | 661 assertWithMatcher:grey_notNil()]; |
| 662 | 662 |
| 663 // Go back and verify that the browser navigates to the original URL. | 663 // Go back and verify that the browser navigates to the original URL. |
| 664 [self goBack]; | 664 [self goBack]; |
| 665 [[EarlGrey selectElementWithMatcher:omniboxText(URL.GetContent())] | 665 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 666 assertWithMatcher:grey_notNil()]; | 666 assertWithMatcher:grey_notNil()]; |
| 667 } | 667 } |
| 668 | 668 |
| 669 @end | 669 @end |
| OLD | NEW |