| 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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 | 6 |
| 7 #import "ios/web/public/test/http_server.h" | 7 #import "ios/web/public/test/http_server.h" |
| 8 #include "ios/web/public/test/http_server_util.h" | 8 #include "ios/web/public/test/http_server_util.h" |
| 9 #include "ios/web/public/test/response_providers/html_response_provider.h" | 9 #include "ios/web/public/test/response_providers/html_response_provider.h" |
| 10 #include "ios/web/public/test/response_providers/html_response_provider_impl.h" | 10 #include "ios/web/public/test/response_providers/html_response_provider_impl.h" |
| 11 #include "ios/web/shell/test/app/navigation_test_util.h" | 11 #include "ios/web/shell/test/app/navigation_test_util.h" |
| 12 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h" | 12 #import "ios/web/shell/test/earl_grey/shell_base_test_case.h" |
| 13 #import "ios/web/shell/test/earl_grey/shell_matchers.h" | 13 #import "ios/web/shell/test/earl_grey/shell_matchers.h" |
| 14 #include "net/http/http_status_code.h" | 14 #include "net/http/http_status_code.h" |
| 15 | 15 |
| 16 #if !defined(__has_feature) || !__has_feature(objc_arc) | 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 17 #error "This file requires ARC support." | 17 #error "This file requires ARC support." |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 using web::addressFieldText; | 20 using web::addressFieldText; |
| 21 using web::test::HttpServer; | 21 using web::test::HttpServer; |
| 22 using web::webViewContainingText; | 22 using web::webViewContainingText; |
| 23 | 23 |
| 24 // Redirect test cases for the web shell. | 24 // Redirect test cases for the web shell. |
| 25 @interface RedirectTest : ShellBaseTestCase | 25 @interface RedirectTestCase : ShellBaseTestCase |
| 26 @end | 26 @end |
| 27 | 27 |
| 28 @implementation RedirectTest | 28 @implementation RedirectTestCase |
| 29 | 29 |
| 30 // Tests loading of page that is redirected 3 times using a 301 redirect. | 30 // Tests loading of page that is redirected 3 times using a 301 redirect. |
| 31 - (void)testMultipleRedirects { | 31 - (void)testMultipleRedirects { |
| 32 // Create map of canned responses and set up the test HTML server. | 32 // Create map of canned responses and set up the test HTML server. |
| 33 std::map<GURL, HtmlResponseProviderImpl::Response> responses; | 33 std::map<GURL, HtmlResponseProviderImpl::Response> responses; |
| 34 const GURL firstRedirectURL = HttpServer::MakeUrl("http://firstRedirect/"); | 34 const GURL firstRedirectURL = HttpServer::MakeUrl("http://firstRedirect/"); |
| 35 const GURL secondRedirectURL = HttpServer::MakeUrl("http://secondRedirect/"); | 35 const GURL secondRedirectURL = HttpServer::MakeUrl("http://secondRedirect/"); |
| 36 const GURL thirdRedirectURL = HttpServer::MakeUrl("http://thirdRedirect/"); | 36 const GURL thirdRedirectURL = HttpServer::MakeUrl("http://thirdRedirect/"); |
| 37 const GURL destinationURL = HttpServer::MakeUrl("http://destination/"); | 37 const GURL destinationURL = HttpServer::MakeUrl("http://destination/"); |
| 38 | 38 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // Load first URL and expect destination URL to load. | 100 // Load first URL and expect destination URL to load. |
| 101 web::shell_test_util::LoadUrl(firstRedirectURL); | 101 web::shell_test_util::LoadUrl(firstRedirectURL); |
| 102 [[EarlGrey selectElementWithMatcher:addressFieldText(destinationURL.spec())] | 102 [[EarlGrey selectElementWithMatcher:addressFieldText(destinationURL.spec())] |
| 103 assertWithMatcher:grey_notNil()]; | 103 assertWithMatcher:grey_notNil()]; |
| 104 [[EarlGrey selectElementWithMatcher:webViewContainingText(kFinalPageContent)] | 104 [[EarlGrey selectElementWithMatcher:webViewContainingText(kFinalPageContent)] |
| 105 assertWithMatcher:grey_notNil()]; | 105 assertWithMatcher:grey_notNil()]; |
| 106 } | 106 } |
| 107 | 107 |
| 108 @end | 108 @end |
| OLD | NEW |