| 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" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "content/browser/web_contents/web_contents_impl.h" | 19 #include "content/browser/web_contents/web_contents_impl.h" |
| 20 #include "content/public/common/content_paths.h" | 20 #include "content/public/common/content_paths.h" |
| 21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
| 22 #include "content/public/test/layouttest_support.h" | |
| 23 #include "content/shell/common/shell_switches.h" | 22 #include "content/shell/common/shell_switches.h" |
| 24 #include "content/shell/shell.h" | 23 #include "content/shell/shell.h" |
| 25 #include "content/shell/webkit_test_controller.h" | 24 #include "content/shell/webkit_test_controller.h" |
| 26 #include "content/test/content_browser_test_utils.h" | 25 #include "content/test/content_browser_test_utils.h" |
| 27 #include "content/test/layout_test_http_server.h" | 26 #include "content/test/layout_test_http_server.h" |
| 28 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 29 | 28 |
| 30 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 31 static const char kPlatformName[] = "chromium-win"; | 30 static const char kPlatformName[] = "chromium-win"; |
| 32 #elif defined(OS_MACOSX) | 31 #elif defined(OS_MACOSX) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 : test_parent_dir_(test_parent_dir), test_case_dir_(test_case_dir), | 71 : test_parent_dir_(test_parent_dir), test_case_dir_(test_case_dir), |
| 73 port_(port) { | 72 port_(port) { |
| 74 } | 73 } |
| 75 | 74 |
| 76 InProcessBrowserLayoutTest::~InProcessBrowserLayoutTest() { | 75 InProcessBrowserLayoutTest::~InProcessBrowserLayoutTest() { |
| 77 if (test_http_server_) | 76 if (test_http_server_) |
| 78 CHECK(test_http_server_->Stop()); | 77 CHECK(test_http_server_->Stop()); |
| 79 } | 78 } |
| 80 | 79 |
| 81 void InProcessBrowserLayoutTest::SetUpInProcessBrowserTestFixture() { | 80 void InProcessBrowserLayoutTest::SetUpInProcessBrowserTestFixture() { |
| 82 EnableBrowserLayoutTestMode(); | |
| 83 | |
| 84 base::FilePath src_dir; | 81 base::FilePath src_dir; |
| 85 ASSERT_TRUE(PathService::Get(DIR_LAYOUT_TESTS, &src_dir)); | 82 ASSERT_TRUE(PathService::Get(DIR_LAYOUT_TESTS, &src_dir)); |
| 86 base::FilePath absolute_parent_dir = src_dir.Append(test_parent_dir_); | 83 base::FilePath absolute_parent_dir = src_dir.Append(test_parent_dir_); |
| 87 ASSERT_TRUE(file_util::DirectoryExists(absolute_parent_dir)); | 84 ASSERT_TRUE(file_util::DirectoryExists(absolute_parent_dir)); |
| 88 layout_test_dir_ = absolute_parent_dir.Append(test_case_dir_); | 85 layout_test_dir_ = absolute_parent_dir.Append(test_case_dir_); |
| 89 ASSERT_TRUE(file_util::DirectoryExists(layout_test_dir_)); | 86 ASSERT_TRUE(file_util::DirectoryExists(layout_test_dir_)); |
| 90 | 87 |
| 91 // Gets the file path to rebased expected result directory for the current | 88 // Gets the file path to rebased expected result directory for the current |
| 92 // platform. | 89 // platform. |
| 93 // $LayoutTestRoot/platform/chromium_***/... | 90 // $LayoutTestRoot/platform/chromium_***/... |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 expected.size())); | 205 expected.size())); |
| 209 EXPECT_NE(-1, file_util::WriteFile(actual_filename, | 206 EXPECT_NE(-1, file_util::WriteFile(actual_filename, |
| 210 actual.c_str(), | 207 actual.c_str(), |
| 211 actual.size())); | 208 actual.size())); |
| 212 return base::StringPrintf("Wrote %"PRFilePath" %"PRFilePath, | 209 return base::StringPrintf("Wrote %"PRFilePath" %"PRFilePath, |
| 213 expected_filename.value().c_str(), | 210 expected_filename.value().c_str(), |
| 214 actual_filename.value().c_str()); | 211 actual_filename.value().c_str()); |
| 215 } | 212 } |
| 216 | 213 |
| 217 } // namespace content | 214 } // namespace content |
| OLD | NEW |