| 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 #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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void InProcessBrowserLayoutTest::RunLayoutTest( | 133 void InProcessBrowserLayoutTest::RunLayoutTest( |
| 134 const std::string& test_case_file_name) { | 134 const std::string& test_case_file_name) { |
| 135 GURL url = net::FilePathToFileURL( | 135 GURL url = net::FilePathToFileURL( |
| 136 layout_test_dir_.AppendASCII(test_case_file_name)); | 136 layout_test_dir_.AppendASCII(test_case_file_name)); |
| 137 RunLayoutTestInternal(test_case_file_name, url); | 137 RunLayoutTestInternal(test_case_file_name, url); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void InProcessBrowserLayoutTest::RunHttpLayoutTest( | 140 void InProcessBrowserLayoutTest::RunHttpLayoutTest( |
| 141 const std::string& test_case_file_name) { | 141 const std::string& test_case_file_name) { |
| 142 DCHECK(test_http_server_.get()); | 142 DCHECK(test_http_server_.get()); |
| 143 GURL url(StringPrintf( | 143 GURL url(base::StringPrintf( |
| 144 "http://127.0.0.1:%d/%s/%s", port_, test_case_dir_.MaybeAsASCII().c_str(), | 144 "http://127.0.0.1:%d/%s/%s", port_, test_case_dir_.MaybeAsASCII().c_str(), |
| 145 test_case_file_name.c_str())); | 145 test_case_file_name.c_str())); |
| 146 RunLayoutTestInternal(test_case_file_name, url); | 146 RunLayoutTestInternal(test_case_file_name, url); |
| 147 } | 147 } |
| 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)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 EXPECT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &cwd)); | 198 EXPECT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &cwd)); |
| 199 base::FilePath expected_filename = cwd.Append( | 199 base::FilePath expected_filename = cwd.Append( |
| 200 FILE_PATH_LITERAL("expected.txt")); | 200 FILE_PATH_LITERAL("expected.txt")); |
| 201 base::FilePath actual_filename = cwd.Append(FILE_PATH_LITERAL("actual.txt")); | 201 base::FilePath actual_filename = cwd.Append(FILE_PATH_LITERAL("actual.txt")); |
| 202 EXPECT_NE(-1, file_util::WriteFile(expected_filename, | 202 EXPECT_NE(-1, file_util::WriteFile(expected_filename, |
| 203 expected.c_str(), | 203 expected.c_str(), |
| 204 expected.size())); | 204 expected.size())); |
| 205 EXPECT_NE(-1, file_util::WriteFile(actual_filename, | 205 EXPECT_NE(-1, file_util::WriteFile(actual_filename, |
| 206 actual.c_str(), | 206 actual.c_str(), |
| 207 actual.size())); | 207 actual.size())); |
| 208 return StringPrintf("Wrote %"PRFilePath" %"PRFilePath, | 208 return base::StringPrintf("Wrote %"PRFilePath" %"PRFilePath, |
| 209 expected_filename.value().c_str(), | 209 expected_filename.value().c_str(), |
| 210 actual_filename.value().c_str()); | 210 actual_filename.value().c_str()); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace content | 213 } // namespace content |
| OLD | NEW |