Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1512)

Side by Side Diff: chrome/browser/history/redirect_browsertest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 10 #include "base/bind.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 "</html>", 130 "</html>",
131 final_url.spec().c_str()); 131 final_url.spec().c_str());
132 132
133 // Write the contents to a temporary file. 133 // Write the contents to a temporary file.
134 base::ScopedTempDir temp_directory; 134 base::ScopedTempDir temp_directory;
135 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 135 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
136 base::FilePath temp_file; 136 base::FilePath temp_file;
137 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), 137 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(),
138 &temp_file)); 138 &temp_file));
139 ASSERT_EQ(static_cast<int>(file_redirect_contents.size()), 139 ASSERT_EQ(static_cast<int>(file_redirect_contents.size()),
140 file_util::WriteFile(temp_file, 140 base::WriteFile(temp_file,
141 file_redirect_contents.data(), 141 file_redirect_contents.data(),
142 file_redirect_contents.size())); 142 file_redirect_contents.size()));
143 143
144 // Navigate to the file through the browser. The client redirect will appear 144 // Navigate to the file through the browser. The client redirect will appear
145 // as two page visits in the browser. 145 // as two page visits in the browser.
146 GURL first_url = net::FilePathToFileURL(temp_file); 146 GURL first_url = net::FilePathToFileURL(temp_file);
147 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( 147 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
148 browser(), first_url, 2); 148 browser(), first_url, 2);
149 149
150 std::vector<GURL> redirects = GetRedirects(first_url); 150 std::vector<GURL> redirects = GetRedirects(first_url);
151 ASSERT_EQ(1U, redirects.size()); 151 ASSERT_EQ(1U, redirects.size());
152 EXPECT_EQ(final_url.spec(), redirects[0].spec()); 152 EXPECT_EQ(final_url.spec(), redirects[0].spec());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // as a client redirect from the first (/client-redirect?) page. 300 // as a client redirect from the first (/client-redirect?) page.
301 for (std::vector<GURL>::iterator it = redirects.begin(); 301 for (std::vector<GURL>::iterator it = redirects.begin();
302 it != redirects.end(); ++it) { 302 it != redirects.end(); ++it) {
303 if (final_url.spec() == it->spec()) { 303 if (final_url.spec() == it->spec()) {
304 final_navigation_not_redirect = false; 304 final_navigation_not_redirect = false;
305 break; 305 break;
306 } 306 }
307 } 307 }
308 EXPECT_TRUE(final_navigation_not_redirect); 308 EXPECT_TRUE(final_navigation_not_redirect);
309 } 309 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend_unittest.cc ('k') | chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698