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 "components/autofill/browser/data_driven_test.h" | 5 #include "components/autofill/browser/data_driven_test.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_enumerator.h" | |
9 #include "base/path_service.h" | 8 #include "base/path_service.h" |
10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
11 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 | 12 |
14 namespace autofill { | 13 namespace autofill { |
15 namespace { | 14 namespace { |
16 | 15 |
17 // Reads |file| into |content|, and converts Windows line-endings to Unix ones. | 16 // Reads |file| into |content|, and converts Windows line-endings to Unix ones. |
18 // Returns true on success. | 17 // Returns true on success. |
(...skipping 11 matching lines...) Expand all Loading... |
30 content.length()); | 29 content.length()); |
31 return write_size == static_cast<int>(content.length()); | 30 return write_size == static_cast<int>(content.length()); |
32 } | 31 } |
33 | 32 |
34 } // namespace | 33 } // namespace |
35 | 34 |
36 void DataDrivenTest::RunDataDrivenTest( | 35 void DataDrivenTest::RunDataDrivenTest( |
37 const base::FilePath& input_directory, | 36 const base::FilePath& input_directory, |
38 const base::FilePath& output_directory, | 37 const base::FilePath& output_directory, |
39 const base::FilePath::StringType& file_name_pattern) { | 38 const base::FilePath::StringType& file_name_pattern) { |
40 base::FileEnumerator input_files(input_directory, | 39 file_util::FileEnumerator input_files(input_directory, |
41 false, | 40 false, |
42 base::FileEnumerator::FILES, | 41 file_util::FileEnumerator::FILES, |
43 file_name_pattern); | 42 file_name_pattern); |
44 | 43 |
45 for (base::FilePath input_file = input_files.Next(); | 44 for (base::FilePath input_file = input_files.Next(); |
46 !input_file.empty(); | 45 !input_file.empty(); |
47 input_file = input_files.Next()) { | 46 input_file = input_files.Next()) { |
48 SCOPED_TRACE(input_file.BaseName().value()); | 47 SCOPED_TRACE(input_file.BaseName().value()); |
49 | 48 |
50 std::string input; | 49 std::string input; |
51 ASSERT_TRUE(ReadFile(input_file, &input)); | 50 ASSERT_TRUE(ReadFile(input_file, &input)); |
52 | 51 |
53 std::string output; | 52 std::string output; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return test_data_dir_; | 84 return test_data_dir_; |
86 } | 85 } |
87 | 86 |
88 DataDrivenTest::DataDrivenTest() { | 87 DataDrivenTest::DataDrivenTest() { |
89 } | 88 } |
90 | 89 |
91 DataDrivenTest::~DataDrivenTest() { | 90 DataDrivenTest::~DataDrivenTest() { |
92 } | 91 } |
93 | 92 |
94 } // namespace autofill | 93 } // namespace autofill |
OLD | NEW |