| OLD | NEW |
| 1 // Copyright (c) 2010 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_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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 &expected_result_value); | 248 &expected_result_value); |
| 249 } | 249 } |
| 250 ASSERT_TRUE(!expected_result_value.empty()); | 250 ASSERT_TRUE(!expected_result_value.empty()); |
| 251 | 251 |
| 252 // Normalizes the expected result. | 252 // Normalizes the expected result. |
| 253 ReplaceSubstringsAfterOffset(&expected_result_value, 0, "\r", ""); | 253 ReplaceSubstringsAfterOffset(&expected_result_value, 0, "\r", ""); |
| 254 | 254 |
| 255 // Compares the results. | 255 // Compares the results. |
| 256 EXPECT_STREQ(expected_result_value.c_str(), value.c_str()); | 256 EXPECT_STREQ(expected_result_value.c_str(), value.c_str()); |
| 257 | 257 |
| 258 LOG(INFO) << "Test " << test_case_file_name << " took " | 258 VLOG(1) << "Test " << test_case_file_name |
| 259 << (base::Time::Now() - start).InMilliseconds() << "ms"; | 259 << " took " << (base::Time::Now() - start).InMilliseconds() << "ms"; |
| 260 } | 260 } |
| 261 | 261 |
| 262 bool UILayoutTest::ReadExpectedResult(const FilePath& result_dir_path, | 262 bool UILayoutTest::ReadExpectedResult(const FilePath& result_dir_path, |
| 263 const std::string test_case_file_name, | 263 const std::string test_case_file_name, |
| 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 |