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

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

Issue 2609703002: Remove ScopedVector from autofill. (Closed)
Patch Set: drop the using Created 3 years, 11 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 | components/autofill/content/renderer/form_autofill_util.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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 base::mac::ClearAmIBundledCache(); 67 base::mac::ClearAmIBundledCache();
68 #endif // defined(OS_MACOSX) 68 #endif // defined(OS_MACOSX)
69 69
70 return files; 70 return files;
71 } 71 }
72 72
73 } // namespace 73 } // namespace
74 74
75 // A data-driven test for verifying Autofill heuristics. Each input is an HTML 75 // A data-driven test for verifying Autofill heuristics. Each input is an HTML
76 // file that contains one or more forms. The corresponding output file lists the 76 // file that contains one or more forms. The corresponding output file lists the
77 // heuristically detected type for eachfield. 77 // heuristically detected type for each field.
78 class FormStructureBrowserTest 78 class FormStructureBrowserTest
79 : public InProcessBrowserTest, 79 : public InProcessBrowserTest,
80 public DataDrivenTest, 80 public DataDrivenTest,
81 public ::testing::WithParamInterface<base::FilePath> { 81 public ::testing::WithParamInterface<base::FilePath> {
82 protected: 82 protected:
83 FormStructureBrowserTest(); 83 FormStructureBrowserTest();
84 ~FormStructureBrowserTest() override; 84 ~FormStructureBrowserTest() override;
85 85
86 // InProcessBrowserTest 86 // InProcessBrowserTest
87 void SetUpCommandLine(base::CommandLine* command_line) override { 87 void SetUpCommandLine(base::CommandLine* command_line) override {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT_NE(nullptr, autofill_manager); 123 ASSERT_NE(nullptr, autofill_manager);
124 const std::vector<std::unique_ptr<FormStructure>>& forms = 124 const std::vector<std::unique_ptr<FormStructure>>& forms =
125 autofill_manager->form_structures_; 125 autofill_manager->form_structures_;
126 *output = FormStructuresToString(forms); 126 *output = FormStructuresToString(forms);
127 } 127 }
128 128
129 std::string FormStructureBrowserTest::FormStructuresToString( 129 std::string FormStructureBrowserTest::FormStructuresToString(
130 const std::vector<std::unique_ptr<FormStructure>>& forms) { 130 const std::vector<std::unique_ptr<FormStructure>>& forms) {
131 std::string forms_string; 131 std::string forms_string;
132 for (const auto& form : forms) { 132 for (const auto& form : forms) {
133 for (const AutofillField* field : *form) { 133 for (const auto& field : *form) {
134 forms_string += field->Type().ToString(); 134 forms_string += field->Type().ToString();
135 forms_string += " | " + base::UTF16ToUTF8(field->name); 135 forms_string += " | " + base::UTF16ToUTF8(field->name);
136 forms_string += " | " + base::UTF16ToUTF8(field->label); 136 forms_string += " | " + base::UTF16ToUTF8(field->label);
137 forms_string += " | " + base::UTF16ToUTF8(field->value); 137 forms_string += " | " + base::UTF16ToUTF8(field->value);
138 forms_string += " | " + field->section(); 138 forms_string += " | " + field->section();
139 forms_string += "\n"; 139 forms_string += "\n";
140 } 140 }
141 } 141 }
142 return forms_string; 142 return forms_string;
143 } 143 }
144 144
145 IN_PROC_BROWSER_TEST_P(FormStructureBrowserTest, DataDrivenHeuristics) { 145 IN_PROC_BROWSER_TEST_P(FormStructureBrowserTest, DataDrivenHeuristics) {
146 // Prints the path of the test to be executed. 146 // Prints the path of the test to be executed.
147 LOG(INFO) << GetParam().MaybeAsASCII(); 147 LOG(INFO) << GetParam().MaybeAsASCII();
148 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); 148 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName));
149 } 149 }
150 150
151 INSTANTIATE_TEST_CASE_P(AllForms, 151 INSTANTIATE_TEST_CASE_P(AllForms,
152 FormStructureBrowserTest, 152 FormStructureBrowserTest,
153 testing::ValuesIn(GetTestFiles())); 153 testing::ValuesIn(GetTestFiles()));
154 154
155 } // namespace autofill 155 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_autofill_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698