OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Navigates the browser to server and client redirect pages and makes sure | 5 // Navigates the browser to server and client redirect pages and makes sure |
6 // that the correct redirects are reflected in the history database. Errors | 6 // that the correct redirects are reflected in the history database. Errors |
7 // here might indicate that WebKit changed the calls our glue layer gets in | 7 // here might indicate that WebKit changed the calls our glue layer gets in |
8 // the case of redirects. It may also mean problems with the history system. | 8 // the case of redirects. It may also mean problems with the history system. |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 "<html>" | 129 "<html>" |
130 "<head></head>" | 130 "<head></head>" |
131 "<body onload=\"document.location='%s'\"></body>" | 131 "<body onload=\"document.location='%s'\"></body>" |
132 "</html>", | 132 "</html>", |
133 final_url.spec().c_str()); | 133 final_url.spec().c_str()); |
134 | 134 |
135 // Write the contents to a temporary file. | 135 // Write the contents to a temporary file. |
136 base::ScopedTempDir temp_directory; | 136 base::ScopedTempDir temp_directory; |
137 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 137 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
138 base::FilePath temp_file; | 138 base::FilePath temp_file; |
139 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), | 139 ASSERT_TRUE( |
140 &temp_file)); | 140 base::CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file)); |
141 ASSERT_EQ(static_cast<int>(file_redirect_contents.size()), | 141 ASSERT_EQ(static_cast<int>(file_redirect_contents.size()), |
142 base::WriteFile(temp_file, | 142 base::WriteFile(temp_file, |
143 file_redirect_contents.data(), | 143 file_redirect_contents.data(), |
144 file_redirect_contents.size())); | 144 file_redirect_contents.size())); |
145 | 145 |
146 // Navigate to the file through the browser. The client redirect will appear | 146 // Navigate to the file through the browser. The client redirect will appear |
147 // as two page visits in the browser. | 147 // as two page visits in the browser. |
148 GURL first_url = net::FilePathToFileURL(temp_file); | 148 GURL first_url = net::FilePathToFileURL(temp_file); |
149 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 149 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
150 browser(), first_url, 2); | 150 browser(), first_url, 2); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // as a client redirect from the first (/client-redirect?) page. | 304 // as a client redirect from the first (/client-redirect?) page. |
305 for (std::vector<GURL>::iterator it = redirects.begin(); | 305 for (std::vector<GURL>::iterator it = redirects.begin(); |
306 it != redirects.end(); ++it) { | 306 it != redirects.end(); ++it) { |
307 if (final_url.spec() == it->spec()) { | 307 if (final_url.spec() == it->spec()) { |
308 final_navigation_not_redirect = false; | 308 final_navigation_not_redirect = false; |
309 break; | 309 break; |
310 } | 310 } |
311 } | 311 } |
312 EXPECT_TRUE(final_navigation_not_redirect); | 312 EXPECT_TRUE(final_navigation_not_redirect); |
313 } | 313 } |
OLD | NEW |