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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // We expect the test case dir to be ASCII. It might be empty, so we | 207 // We expect the test case dir to be ASCII. It might be empty, so we |
208 // can't test whether MaybeAsASCII succeeded, but the tests will fail | 208 // can't test whether MaybeAsASCII succeeded, but the tests will fail |
209 // loudly in that case anyway. | 209 // loudly in that case anyway. |
210 std::string url_path = test_case_dir_.MaybeAsASCII(); | 210 std::string url_path = test_case_dir_.MaybeAsASCII(); |
211 | 211 |
212 scoped_ptr<GURL> new_test_url; | 212 scoped_ptr<GURL> new_test_url; |
213 if (port != kNoHttpPort) | 213 if (port != kNoHttpPort) |
214 new_test_url.reset(new GURL( | 214 new_test_url.reset(new GURL( |
215 StringPrintf("http://localhost:%d/", port) + | 215 StringPrintf("http://127.0.0.1:%d/", port) + |
216 url_path + "/" + test_case_file_name)); | 216 url_path + "/" + test_case_file_name)); |
217 else | 217 else |
218 new_test_url.reset(new GURL(net::FilePathToFileURL(new_test_file_path))); | 218 new_test_url.reset(new GURL(net::FilePathToFileURL(new_test_file_path))); |
219 | 219 |
220 // Runs the new layout test. | 220 // Runs the new layout test. |
221 scoped_refptr<TabProxy> tab(GetActiveTab()); | 221 scoped_refptr<TabProxy> tab(GetActiveTab()); |
222 ASSERT_TRUE(tab.get()); | 222 ASSERT_TRUE(tab.get()); |
223 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); | 223 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); |
224 std::string escaped_value = | 224 std::string escaped_value = |
225 WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), | 225 WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 std::string* expected_result_value) { | 266 std::string* expected_result_value) { |
267 FilePath expected_result_path(result_dir_path); | 267 FilePath expected_result_path(result_dir_path); |
268 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); | 268 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); |
269 expected_result_path = expected_result_path.InsertBeforeExtension( | 269 expected_result_path = expected_result_path.InsertBeforeExtension( |
270 FILE_PATH_LITERAL("-expected")); | 270 FILE_PATH_LITERAL("-expected")); |
271 expected_result_path = | 271 expected_result_path = |
272 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); | 272 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); |
273 return file_util::ReadFileToString(expected_result_path, | 273 return file_util::ReadFileToString(expected_result_path, |
274 expected_result_value); | 274 expected_result_value); |
275 } | 275 } |
OLD | NEW |