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

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

Issue 673923002: Add the identified form section to the autofill tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/test/data/autofill/heuristics/output/00_i18n_de.out » ('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 <vector> 5 #include <vector>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 69 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
70 HTMLToDataURI(input))); 70 HTMLToDataURI(input)));
71 71
72 ContentAutofillDriver* autofill_driver = 72 ContentAutofillDriver* autofill_driver =
73 ContentAutofillDriver::FromWebContents( 73 ContentAutofillDriver::FromWebContents(
74 browser()->tab_strip_model()->GetActiveWebContents()); 74 browser()->tab_strip_model()->GetActiveWebContents());
75 ASSERT_NE(static_cast<ContentAutofillDriver*>(NULL), autofill_driver); 75 ASSERT_NE(static_cast<ContentAutofillDriver*>(NULL), autofill_driver);
76 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); 76 AutofillManager* autofill_manager = autofill_driver->autofill_manager();
77 ASSERT_NE(static_cast<AutofillManager*>(NULL), autofill_manager); 77 ASSERT_NE(static_cast<AutofillManager*>(NULL), autofill_manager);
78 std::vector<FormStructure*> forms = autofill_manager->form_structures_.get(); 78 std::vector<FormStructure*> forms = autofill_manager->form_structures_.get();
79 *output = FormStructureBrowserTest::FormStructuresToString(forms); 79 *output = FormStructuresToString(forms);
80 } 80 }
81 81
82 std::string FormStructureBrowserTest::FormStructuresToString( 82 std::string FormStructureBrowserTest::FormStructuresToString(
83 const std::vector<FormStructure*>& forms) { 83 const std::vector<FormStructure*>& forms) {
84 std::string forms_string; 84 std::string forms_string;
85 for (std::vector<FormStructure*>::const_iterator iter = forms.begin(); 85 for (const FormStructure* form : forms) {
86 iter != forms.end(); 86 for (const AutofillField* field : *form) {
87 ++iter) { 87 forms_string += field->Type().ToString();
88 88 forms_string += " | " + base::UTF16ToUTF8(field->name);
89 for (std::vector<AutofillField*>::const_iterator field_iter = 89 forms_string += " | " + base::UTF16ToUTF8(field->label);
90 (*iter)->begin(); 90 forms_string += " | " + base::UTF16ToUTF8(field->value);
91 field_iter != (*iter)->end(); 91 forms_string += " | " + field->section();
92 ++field_iter) {
93 forms_string += (*field_iter)->Type().ToString();
94 forms_string += " | " + base::UTF16ToUTF8((*field_iter)->name);
95 forms_string += " | " + base::UTF16ToUTF8((*field_iter)->label);
96 forms_string += " | " + base::UTF16ToUTF8((*field_iter)->value);
97 forms_string += "\n"; 92 forms_string += "\n";
98 } 93 }
99 } 94 }
100 return forms_string; 95 return forms_string;
101 } 96 }
102 97
103 // Heuristics tests time out on Windows (http://crbug.com/85276) and Chrome OS 98 // Heuristics tests time out on Windows (http://crbug.com/85276) and Chrome OS
104 // (http://crbug.com/423791). 99 // (http://crbug.com/423791).
105 #if defined(OS_WIN) || defined(OS_CHROMEOS) 100 #if defined(OS_WIN) || defined(OS_CHROMEOS)
106 #define MAYBE_DataDrivenHeuristics(n) DISABLED_DataDrivenHeuristics##n 101 #define MAYBE_DataDrivenHeuristics(n) DISABLED_DataDrivenHeuristics##n
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, 266 IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest,
272 MAYBE_DataDrivenHeuristics(20)) { 267 MAYBE_DataDrivenHeuristics(20)) {
273 const base::FilePath::CharType kFileNamePattern[] = 268 const base::FilePath::CharType kFileNamePattern[] =
274 FILE_PATH_LITERAL("20_*.html"); 269 FILE_PATH_LITERAL("20_*.html");
275 RunDataDrivenTest(GetInputDirectory(kTestName), 270 RunDataDrivenTest(GetInputDirectory(kTestName),
276 GetOutputDirectory(kTestName), 271 GetOutputDirectory(kTestName),
277 kFileNamePattern); 272 kFileNamePattern);
278 } 273 }
279 274
280 } // namespace autofill 275 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/autofill/heuristics/output/00_i18n_de.out » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698