| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/test/ui/ui_layout_test.h" | 5 #include "chrome/test/ui/ui_layout_test.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/test/test_file_util.h" | 10 #include "base/test/test_file_util.h" |
| 11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/test/automation/tab_proxy.h" | 13 #include "chrome/test/automation/tab_proxy.h" |
| 14 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 15 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 static const char kPlatformName[] = "chromium-win"; | 18 static const char kPlatformName[] = "chromium-win"; |
| 19 #elif defined(OS_MACOSX) | 19 #elif defined(OS_MACOSX) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name, | 169 void UILayoutTest::RunLayoutTest(const std::string& test_case_file_name, |
| 170 int port) { | 170 int port) { |
| 171 SCOPED_TRACE(test_case_file_name.c_str()); | 171 SCOPED_TRACE(test_case_file_name.c_str()); |
| 172 | 172 |
| 173 ASSERT_TRUE(!layout_test_controller_.empty()); | 173 ASSERT_TRUE(!layout_test_controller_.empty()); |
| 174 | 174 |
| 175 // Creates a new cookie name. We will have to use a new cookie because | 175 // Creates a new cookie name. We will have to use a new cookie because |
| 176 // this function could be called multiple times. | 176 // this function could be called multiple times. |
| 177 std::string status_cookie(kTestCompleteCookie); | 177 std::string status_cookie(kTestCompleteCookie); |
| 178 status_cookie += IntToString(test_count_); | 178 status_cookie += base::IntToString(test_count_); |
| 179 test_count_++; | 179 test_count_++; |
| 180 | 180 |
| 181 // Reads the layout test HTML file. | 181 // Reads the layout test HTML file. |
| 182 FilePath test_file_path(layout_test_dir_); | 182 FilePath test_file_path(layout_test_dir_); |
| 183 test_file_path = test_file_path.AppendASCII(test_case_file_name); | 183 test_file_path = test_file_path.AppendASCII(test_case_file_name); |
| 184 std::string test_html; | 184 std::string test_html; |
| 185 ASSERT_TRUE(file_util::ReadFileToString(test_file_path, &test_html)); | 185 ASSERT_TRUE(file_util::ReadFileToString(test_file_path, &test_html)); |
| 186 | 186 |
| 187 // Injects the layout test controller into the test HTML. | 187 // Injects the layout test controller into the test HTML. |
| 188 size_t insertion_position = FindInsertPosition(test_html); | 188 size_t insertion_position = FindInsertPosition(test_html); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 std::string* expected_result_value) { | 253 std::string* expected_result_value) { |
| 254 FilePath expected_result_path(result_dir_path); | 254 FilePath expected_result_path(result_dir_path); |
| 255 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); | 255 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); |
| 256 expected_result_path = expected_result_path.InsertBeforeExtension( | 256 expected_result_path = expected_result_path.InsertBeforeExtension( |
| 257 FILE_PATH_LITERAL("-expected")); | 257 FILE_PATH_LITERAL("-expected")); |
| 258 expected_result_path = | 258 expected_result_path = |
| 259 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); | 259 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); |
| 260 return file_util::ReadFileToString(expected_result_path, | 260 return file_util::ReadFileToString(expected_result_path, |
| 261 expected_result_value); | 261 expected_result_value); |
| 262 } | 262 } |
| OLD | NEW |