| OLD | NEW |
| 1 // Copyright (c) 2010 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" |
| 11 #include "base/test/test_timeouts.h" |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/test/automation/tab_proxy.h" | 14 #include "chrome/test/automation/tab_proxy.h" |
| 14 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
| 15 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
| 16 | 17 |
| 17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 18 static const char kPlatformName[] = "chromium-win"; | 19 static const char kPlatformName[] = "chromium-win"; |
| 19 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
| 20 static const char kPlatformName[] = "chromium-mac"; | 21 static const char kPlatformName[] = "chromium-mac"; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 test_case_file_name)); | 214 test_case_file_name)); |
| 214 else | 215 else |
| 215 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))); |
| 216 | 217 |
| 217 // Runs the new layout test. | 218 // Runs the new layout test. |
| 218 scoped_refptr<TabProxy> tab(GetActiveTab()); | 219 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 219 ASSERT_TRUE(tab.get()); | 220 ASSERT_TRUE(tab.get()); |
| 220 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); | 221 ASSERT_TRUE(tab->NavigateToURL(*new_test_url.get())); |
| 221 std::string escaped_value = | 222 std::string escaped_value = |
| 222 WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), | 223 WaitUntilCookieNonEmpty(tab.get(), *new_test_url.get(), |
| 223 status_cookie.c_str(), action_max_timeout_ms()); | 224 status_cookie.c_str(), TestTimeouts::action_max_timeout_ms()); |
| 224 | 225 |
| 225 // Unescapes and normalizes the actual result. | 226 // Unescapes and normalizes the actual result. |
| 226 std::string value = UnescapeURLComponent(escaped_value, | 227 std::string value = UnescapeURLComponent(escaped_value, |
| 227 UnescapeRule::NORMAL | UnescapeRule::SPACES | | 228 UnescapeRule::NORMAL | UnescapeRule::SPACES | |
| 228 UnescapeRule::URL_SPECIAL_CHARS | UnescapeRule::CONTROL_CHARS); | 229 UnescapeRule::URL_SPECIAL_CHARS | UnescapeRule::CONTROL_CHARS); |
| 229 value += "\n"; | 230 value += "\n"; |
| 230 ReplaceSubstringsAfterOffset(&value, 0, "\r", ""); | 231 ReplaceSubstringsAfterOffset(&value, 0, "\r", ""); |
| 231 | 232 |
| 232 // Reads the expected result. First try to read from rebase directory. | 233 // Reads the expected result. First try to read from rebase directory. |
| 233 // If failed, read from original directory. | 234 // If failed, read from original directory. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 263 std::string* expected_result_value) { | 264 std::string* expected_result_value) { |
| 264 FilePath expected_result_path(result_dir_path); | 265 FilePath expected_result_path(result_dir_path); |
| 265 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); | 266 expected_result_path = expected_result_path.AppendASCII(test_case_file_name); |
| 266 expected_result_path = expected_result_path.InsertBeforeExtension( | 267 expected_result_path = expected_result_path.InsertBeforeExtension( |
| 267 FILE_PATH_LITERAL("-expected")); | 268 FILE_PATH_LITERAL("-expected")); |
| 268 expected_result_path = | 269 expected_result_path = |
| 269 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); | 270 expected_result_path.ReplaceExtension(FILE_PATH_LITERAL("txt")); |
| 270 return file_util::ReadFileToString(expected_result_path, | 271 return file_util::ReadFileToString(expected_result_path, |
| 271 expected_result_value); | 272 expected_result_value); |
| 272 } | 273 } |
| OLD | NEW |