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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Runs the new layout test. | 229 // Runs the new layout test. |
230 scoped_refptr<TabProxy> tab(GetActiveTab()); | 230 scoped_refptr<TabProxy> tab(GetActiveTab()); |
231 ASSERT_TRUE(tab.get()); | 231 ASSERT_TRUE(tab.get()); |
232 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); | 232 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); |
233 std::string escaped_value = | 233 std::string escaped_value = |
234 WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), | 234 WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), |
235 status_cookie.c_str(), TestTimeouts::action_max_timeout_ms()); | 235 status_cookie.c_str(), TestTimeouts::action_max_timeout_ms()); |
236 | 236 |
237 // Unescapes and normalizes the actual result. | 237 // Unescapes and normalizes the actual result. |
238 std::string value = net::UnescapeURLComponent(escaped_value, | 238 std::string value = net::UnescapeURLComponent(escaped_value, |
239 UnescapeRule::NORMAL | UnescapeRule::SPACES | | 239 net::UnescapeRule::NORMAL | net::UnescapeRule::SPACES | |
240 UnescapeRule::URL_SPECIAL_CHARS | UnescapeRule::CONTROL_CHARS); | 240 net::UnescapeRule::URL_SPECIAL_CHARS | net::UnescapeRule::CONTROL_CHARS); |
241 value += "\n"; | 241 value += "\n"; |
242 ReplaceSubstringsAfterOffset(&value, 0, "\r", ""); | 242 ReplaceSubstringsAfterOffset(&value, 0, "\r", ""); |
243 | 243 |
244 // Reads the expected result. First try to read from rebase directory. | 244 // Reads the expected result. First try to read from rebase directory. |
245 // If failed, read from original directory. | 245 // If failed, read from original directory. |
246 std::string expected_result_value; | 246 std::string expected_result_value; |
247 if (!ReadExpectedResult(rebase_result_dir_, | 247 if (!ReadExpectedResult(rebase_result_dir_, |
248 test_case_file_name, | 248 test_case_file_name, |
249 &expected_result_value) && | 249 &expected_result_value) && |
250 !ReadExpectedResult(rebase_result_chromium_dir_, | 250 !ReadExpectedResult(rebase_result_chromium_dir_, |
(...skipping 24 matching lines...) Expand all Loading... |
275 std::string* expected_result_value) { | 275 std::string* expected_result_value) { |
276 FilePath expected_result_path(result_dir_path); | 276 FilePath expected_result_path(result_dir_path); |
277 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); | 277 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); |
278 expected_result_path = expected_result_path.InsertBeforeExtension( | 278 expected_result_path = expected_result_path.InsertBeforeExtension( |
279 FILE_PATH_LITERAL("-expected")); | 279 FILE_PATH_LITERAL("-expected")); |
280 expected_result_path = | 280 expected_result_path = |
281 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); | 281 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); |
282 return file_util::ReadFileToString(expected_result_path, | 282 return file_util::ReadFileToString(expected_result_path, |
283 expected_result_value); | 283 expected_result_value); |
284 } | 284 } |
OLD | NEW |