| 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/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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |