| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ASSERT_NE(nullptr, autofill_manager); | 124 ASSERT_NE(nullptr, autofill_manager); |
| 125 const std::vector<std::unique_ptr<FormStructure>>& forms = | 125 const std::vector<std::unique_ptr<FormStructure>>& forms = |
| 126 autofill_manager->form_structures_; | 126 autofill_manager->form_structures_; |
| 127 *output = FormStructureBrowserTest::FormStructuresToString(forms); | 127 *output = FormStructureBrowserTest::FormStructuresToString(forms); |
| 128 } | 128 } |
| 129 | 129 |
| 130 std::string FormStructureBrowserTest::FormStructuresToString( | 130 std::string FormStructureBrowserTest::FormStructuresToString( |
| 131 const std::vector<std::unique_ptr<FormStructure>>& forms) { | 131 const std::vector<std::unique_ptr<FormStructure>>& forms) { |
| 132 std::string forms_string; | 132 std::string forms_string; |
| 133 for (const std::unique_ptr<FormStructure>& form : forms) { | 133 for (const std::unique_ptr<FormStructure>& form : forms) { |
| 134 for (const AutofillField* field : *form) { | 134 for (const auto& field : *form) { |
| 135 forms_string += field->Type().ToString(); | 135 forms_string += field->Type().ToString(); |
| 136 forms_string += " | " + base::UTF16ToUTF8(field->name); | 136 forms_string += " | " + base::UTF16ToUTF8(field->name); |
| 137 forms_string += " | " + base::UTF16ToUTF8(field->label); | 137 forms_string += " | " + base::UTF16ToUTF8(field->label); |
| 138 forms_string += " | " + base::UTF16ToUTF8(field->value); | 138 forms_string += " | " + base::UTF16ToUTF8(field->value); |
| 139 forms_string += " | " + field->section(); | 139 forms_string += " | " + field->section(); |
| 140 forms_string += "\n"; | 140 forms_string += "\n"; |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 return forms_string; | 143 return forms_string; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Disabled because the tests don't pass yet: http://crbug.com/427614 | 146 // Disabled because the tests don't pass yet: http://crbug.com/427614 |
| 147 // Disabled because the tests crash flakily: http://crbug.com/464383 | 147 // Disabled because the tests crash flakily: http://crbug.com/464383 |
| 148 TEST_P(FormStructureBrowserTest, DISABLED_DataDrivenHeuristics) { | 148 TEST_P(FormStructureBrowserTest, DISABLED_DataDrivenHeuristics) { |
| 149 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); | 149 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 INSTANTIATE_TEST_CASE_P(AllForms, | 152 INSTANTIATE_TEST_CASE_P(AllForms, |
| 153 FormStructureBrowserTest, | 153 FormStructureBrowserTest, |
| 154 testing::ValuesIn(GetTestFiles())); | 154 testing::ValuesIn(GetTestFiles())); |
| 155 | 155 |
| 156 } // namespace autofill | 156 } // namespace autofill |
| OLD | NEW |