Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: chrome/browser/autofill/form_structure_browsertest.cc

Issue 964453004: Autofill: Disable autofill for fields outside of forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minimize diff Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/autofill/autofill_renderer_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
49 base::FilePath dir; 59 base::FilePath dir;
50 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &dir)); 60 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &dir));
51 dir = dir.AppendASCII("chrome/test/data/autofill") 61 dir = dir.AppendASCII("chrome/test/data/autofill")
52 .Append(kTestName) 62 .Append(kTestName)
53 .AppendASCII("input"); 63 .AppendASCII("input");
54 base::FileEnumerator input_files(dir, false, base::FileEnumerator::FILES); 64 base::FileEnumerator input_files(dir, false, base::FileEnumerator::FILES);
55 std::vector<base::FilePath> files; 65 std::vector<base::FilePath> files;
56 for (base::FilePath input_file = input_files.Next(); !input_file.empty(); 66 for (base::FilePath input_file = input_files.Next(); !input_file.empty();
57 input_file = input_files.Next()) { 67 input_file = input_files.Next()) {
58 files.push_back(input_file); 68 if (!ContainsKey(set_of_files_to_skip, input_file.BaseName()))
69 files.push_back(input_file);
59 } 70 }
60 std::sort(files.begin(), files.end()); 71 std::sort(files.begin(), files.end());
61 72
62 #if defined(OS_MACOSX) 73 #if defined(OS_MACOSX)
63 base::mac::ClearAmIBundledCache(); 74 base::mac::ClearAmIBundledCache();
64 #endif // defined(OS_MACOSX) 75 #endif // defined(OS_MACOSX)
65 76
66 return files; 77 return files;
67 } 78 }
68 79
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 142
132 IN_PROC_BROWSER_TEST_P(FormStructureBrowserTest, DataDrivenHeuristics) { 143 IN_PROC_BROWSER_TEST_P(FormStructureBrowserTest, DataDrivenHeuristics) {
133 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); 144 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName));
134 } 145 }
135 146
136 INSTANTIATE_TEST_CASE_P(AllForms, 147 INSTANTIATE_TEST_CASE_P(AllForms,
137 FormStructureBrowserTest, 148 FormStructureBrowserTest,
138 testing::ValuesIn(GetTestFiles())); 149 testing::ValuesIn(GetTestFiles()));
139 150
140 } // namespace autofill 151 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/autofill/autofill_renderer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698