| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 const base::FilePath& GetTestDataDir() { | 41 const base::FilePath& GetTestDataDir() { |
| 42 CR_DEFINE_STATIC_LOCAL(base::FilePath, dir, ()); | 42 CR_DEFINE_STATIC_LOCAL(base::FilePath, dir, ()); |
| 43 if (dir.empty()) | 43 if (dir.empty()) |
| 44 PathService::Get(chrome::DIR_TEST_DATA, &dir); | 44 PathService::Get(chrome::DIR_TEST_DATA, &dir); |
| 45 return dir; | 45 return dir; |
| 46 } | 46 } |
| 47 | 47 |
| 48 const std::vector<base::FilePath> GetTestFiles() { | 48 const std::vector<base::FilePath> GetTestFiles() { |
| 49 static const base::FilePath::CharType* const kFilesToSkip[] = { | |
| 50 FILE_PATH_LITERAL("bug_459132.html"), | |
| 51 FILE_PATH_LITERAL("bug_454366b.html"), | |
| 52 FILE_PATH_LITERAL("bug_454366.html"), | |
| 53 FILE_PATH_LITERAL("25_checkout_m_llbean.com.html"), | |
| 54 }; | |
| 55 std::set<base::FilePath> set_of_files_to_skip; | |
| 56 for (size_t i = 0; i < arraysize(kFilesToSkip); ++i) | |
| 57 set_of_files_to_skip.insert(base::FilePath(kFilesToSkip[i])); | |
| 58 | |
| 59 base::FilePath dir; | 49 base::FilePath dir; |
| 60 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &dir)); | 50 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &dir)); |
| 61 dir = dir.AppendASCII("chrome/test/data/autofill") | 51 dir = dir.AppendASCII("chrome/test/data/autofill") |
| 62 .Append(kTestName) | 52 .Append(kTestName) |
| 63 .AppendASCII("input"); | 53 .AppendASCII("input"); |
| 64 base::FileEnumerator input_files(dir, false, base::FileEnumerator::FILES); | 54 base::FileEnumerator input_files(dir, false, base::FileEnumerator::FILES); |
| 65 std::vector<base::FilePath> files; | 55 std::vector<base::FilePath> files; |
| 66 for (base::FilePath input_file = input_files.Next(); !input_file.empty(); | 56 for (base::FilePath input_file = input_files.Next(); !input_file.empty(); |
| 67 input_file = input_files.Next()) { | 57 input_file = input_files.Next()) { |
| 68 if (!ContainsKey(set_of_files_to_skip, input_file.BaseName())) | 58 files.push_back(input_file); |
| 69 files.push_back(input_file); | |
| 70 } | 59 } |
| 71 std::sort(files.begin(), files.end()); | 60 std::sort(files.begin(), files.end()); |
| 72 | 61 |
| 73 #if defined(OS_MACOSX) | 62 #if defined(OS_MACOSX) |
| 74 base::mac::ClearAmIBundledCache(); | 63 base::mac::ClearAmIBundledCache(); |
| 75 #endif // defined(OS_MACOSX) | 64 #endif // defined(OS_MACOSX) |
| 76 | 65 |
| 77 return files; | 66 return files; |
| 78 } | 67 } |
| 79 | 68 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 131 |
| 143 IN_PROC_BROWSER_TEST_P(FormStructureBrowserTest, DataDrivenHeuristics) { | 132 IN_PROC_BROWSER_TEST_P(FormStructureBrowserTest, DataDrivenHeuristics) { |
| 144 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); | 133 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); |
| 145 } | 134 } |
| 146 | 135 |
| 147 INSTANTIATE_TEST_CASE_P(AllForms, | 136 INSTANTIATE_TEST_CASE_P(AllForms, |
| 148 FormStructureBrowserTest, | 137 FormStructureBrowserTest, |
| 149 testing::ValuesIn(GetTestFiles())); | 138 testing::ValuesIn(GetTestFiles())); |
| 150 | 139 |
| 151 } // namespace autofill | 140 } // namespace autofill |
| OLD | NEW |