OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/test/test_file_util.h" | 10 #include "base/test/test_file_util.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 FilePath new_test_file_path(new_layout_test_dir_); | 202 FilePath new_test_file_path(new_layout_test_dir_); |
203 new_test_file_path = new_test_file_path.AppendASCII(test_case_file_name); | 203 new_test_file_path = new_test_file_path.AppendASCII(test_case_file_name); |
204 ASSERT_TRUE(file_util::WriteFile(new_test_file_path, | 204 ASSERT_TRUE(file_util::WriteFile(new_test_file_path, |
205 &test_html.at(0), | 205 &test_html.at(0), |
206 static_cast<int>(test_html.size()))); | 206 static_cast<int>(test_html.size()))); |
207 | 207 |
208 scoped_ptr<GURL> new_test_url; | 208 scoped_ptr<GURL> new_test_url; |
209 if (port != kNoHttpPort) | 209 if (port != kNoHttpPort) |
210 new_test_url.reset(new GURL( | 210 new_test_url.reset(new GURL( |
211 StringPrintf("http://localhost:%d/", port) + | 211 StringPrintf("http://localhost:%d/", port) + |
212 WideToUTF8(test_case_dir_.ToWStringHack()) + | 212 UTF16ToUTF8(test_case_dir_.LossyDisplayName()) + |
213 "/" + | 213 "/" + |
214 test_case_file_name)); | 214 test_case_file_name)); |
215 else | 215 else |
216 new_test_url.reset(new GURL(net::FilePathToFileURL(new_test_file_path))); | 216 new_test_url.reset(new GURL(net::FilePathToFileURL(new_test_file_path))); |
217 | 217 |
218 // Runs the new layout test. | 218 // Runs the new layout test. |
219 scoped_refptr<TabProxy> tab(GetActiveTab()); | 219 scoped_refptr<TabProxy> tab(GetActiveTab()); |
220 ASSERT_TRUE(tab.get()); | 220 ASSERT_TRUE(tab.get()); |
221 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); | 221 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); |
222 std::string escaped_value = | 222 std::string escaped_value = |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 std::string* expected_result_value) { | 264 std::string* expected_result_value) { |
265 FilePath expected_result_path(result_dir_path); | 265 FilePath expected_result_path(result_dir_path); |
266 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); | 266 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); |
267 expected_result_path = expected_result_path.InsertBeforeExtension( | 267 expected_result_path = expected_result_path.InsertBeforeExtension( |
268 FILE_PATH_LITERAL("-expected")); | 268 FILE_PATH_LITERAL("-expected")); |
269 expected_result_path = | 269 expected_result_path = |
270 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); | 270 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); |
271 return file_util::ReadFileToString(expected_result_path, | 271 return file_util::ReadFileToString(expected_result_path, |
272 expected_result_value); | 272 expected_result_value); |
273 } | 273 } |
OLD | NEW |