OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/public/browser/resource_request_details.h" | 5 #include "content/public/browser/resource_request_details.h" |
6 #include "content/public/test/browser_test_utils.h" | 6 #include "content/public/test/browser_test_utils.h" |
7 #include "content/public/test/content_browser_test.h" | 7 #include "content/public/test/content_browser_test.h" |
8 #include "content/public/test/content_browser_test_utils.h" | 8 #include "content/public/test/content_browser_test_utils.h" |
9 #include "content/shell/browser/shell.h" | 9 #include "content/shell/browser/shell.h" |
10 #include "net/dns/mock_host_resolver.h" | 10 #include "net/dns/mock_host_resolver.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // http://foo.com:<port>/title2.html | 63 // http://foo.com:<port>/title2.html |
64 NavigationObserver observer(shell()->web_contents()); | 64 NavigationObserver observer(shell()->web_contents()); |
65 NavigateToURL( | 65 NavigateToURL( |
66 shell(), | 66 shell(), |
67 embedded_test_server()->GetURL("/cross-site/foo.com/title2.html")); | 67 embedded_test_server()->GetURL("/cross-site/foo.com/title2.html")); |
68 | 68 |
69 // The expectation is that the cross-site redirector will take the | 69 // The expectation is that the cross-site redirector will take the |
70 // hostname supplied in the URL and rewrite the URL. Build the | 70 // hostname supplied in the URL and rewrite the URL. Build the |
71 // expected URL to ensure navigation was properly redirected. | 71 // expected URL to ensure navigation was properly redirected. |
72 GURL::Replacements replace_host; | 72 GURL::Replacements replace_host; |
73 std::string foo_com("foo.com"); | |
74 GURL expected_url(embedded_test_server()->GetURL("/title2.html")); | 73 GURL expected_url(embedded_test_server()->GetURL("/title2.html")); |
75 replace_host.SetHostStr(foo_com); | 74 replace_host.SetHostStr("foo.com"); |
76 expected_url = expected_url.ReplaceComponents(replace_host); | 75 expected_url = expected_url.ReplaceComponents(replace_host); |
77 | 76 |
78 EXPECT_EQ(expected_url, observer.navigation_url()); | 77 EXPECT_EQ(expected_url, observer.navigation_url()); |
79 EXPECT_EQ(observer.redirect_url(), observer.navigation_url()); | 78 EXPECT_EQ(observer.redirect_url(), observer.navigation_url()); |
80 } | 79 } |
81 | 80 |
82 } // namespace content | 81 } // namespace content |
OLD | NEW |