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

Side by Side Diff: content/test/layout_browsertest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
« no previous file with comments | « content/test/gpu/gpu_test_config_unittest.cc ('k') | courgette/bsdiff_memory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/test/layout_browsertest.h" 5 #include "content/test/layout_browsertest.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 void InProcessBrowserLayoutTest::RunLayoutTestInternal( 149 void InProcessBrowserLayoutTest::RunLayoutTestInternal(
150 const std::string& test_case_file_name, const GURL& url) { 150 const std::string& test_case_file_name, const GURL& url) {
151 std::stringstream result; 151 std::stringstream result;
152 scoped_ptr<WebKitTestResultPrinter> printer( 152 scoped_ptr<WebKitTestResultPrinter> printer(
153 new WebKitTestResultPrinter(&result, NULL)); 153 new WebKitTestResultPrinter(&result, NULL));
154 printer->set_capture_text_only(true); 154 printer->set_capture_text_only(true);
155 test_controller_->set_printer(printer.release()); 155 test_controller_->set_printer(printer.release());
156 156
157 LOG(INFO) << "Navigating to URL " << url << " and blocking."; 157 LOG(INFO) << "Navigating to URL " << url << " and blocking.";
158 ASSERT_TRUE( 158 ASSERT_TRUE(test_controller_->PrepareForLayoutTest(
159 test_controller_->PrepareForLayoutTest(url, layout_test_dir_, false, "")); 159 url, layout_test_dir_, false, std::string()));
160 base::RunLoop run_loop; 160 base::RunLoop run_loop;
161 run_loop.Run(); 161 run_loop.Run();
162 LOG(INFO) << "Navigation completed."; 162 LOG(INFO) << "Navigation completed.";
163 ASSERT_TRUE(test_controller_->ResetAfterLayoutTest()); 163 ASSERT_TRUE(test_controller_->ResetAfterLayoutTest());
164 164
165 std::string actual_text = result.str();; 165 std::string actual_text = result.str();;
166 166
167 std::string expected_text; 167 std::string expected_text;
168 // Reads the expected result. First try to read from rebase directory. 168 // Reads the expected result. First try to read from rebase directory.
169 // If failed, read from original directory. 169 // If failed, read from original directory.
(...skipping 18 matching lines...) Expand all
188 EXPECT_EQ(expected_text, actual_text) << 188 EXPECT_EQ(expected_text, actual_text) <<
189 SaveResults(expected_text, actual_text); 189 SaveResults(expected_text, actual_text);
190 } else { 190 } else {
191 EXPECT_EQ(expected_text, actual_text); 191 EXPECT_EQ(expected_text, actual_text);
192 } 192 }
193 } 193 }
194 194
195 std::string InProcessBrowserLayoutTest::SaveResults(const std::string& expected, 195 std::string InProcessBrowserLayoutTest::SaveResults(const std::string& expected,
196 const std::string& actual) { 196 const std::string& actual) {
197 base::FilePath cwd; 197 base::FilePath cwd;
198 EXPECT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &cwd)); 198 EXPECT_TRUE(file_util::CreateNewTempDirectory(
199 base::FilePath expected_filename = cwd.Append( 199 base::FilePath::StringType(), &cwd));
200 FILE_PATH_LITERAL("expected.txt")); 200 base::FilePath expected_filename =
201 cwd.Append(FILE_PATH_LITERAL("expected.txt"));
201 base::FilePath actual_filename = cwd.Append(FILE_PATH_LITERAL("actual.txt")); 202 base::FilePath actual_filename = cwd.Append(FILE_PATH_LITERAL("actual.txt"));
202 EXPECT_NE(-1, file_util::WriteFile(expected_filename, 203 EXPECT_NE(-1, file_util::WriteFile(expected_filename,
203 expected.c_str(), 204 expected.c_str(),
204 expected.size())); 205 expected.size()));
205 EXPECT_NE(-1, file_util::WriteFile(actual_filename, 206 EXPECT_NE(-1, file_util::WriteFile(actual_filename,
206 actual.c_str(), 207 actual.c_str(),
207 actual.size())); 208 actual.size()));
208 return base::StringPrintf("Wrote %"PRFilePath" %"PRFilePath, 209 return base::StringPrintf("Wrote %"PRFilePath" %"PRFilePath,
209 expected_filename.value().c_str(), 210 expected_filename.value().c_str(),
210 actual_filename.value().c_str()); 211 actual_filename.value().c_str());
211 } 212 }
212 213
213 } // namespace content 214 } // namespace content
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_test_config_unittest.cc ('k') | courgette/bsdiff_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698