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

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

Issue 2606473003: Use AutofillDriver* in ContentAutofillDriverFactory when possible (Closed)
Patch Set: Fix Android compilation Created 3 years, 12 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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 FormStructureBrowserTest::~FormStructureBrowserTest() { 108 FormStructureBrowserTest::~FormStructureBrowserTest() {
109 } 109 }
110 110
111 void FormStructureBrowserTest::GenerateResults(const std::string& input, 111 void FormStructureBrowserTest::GenerateResults(const std::string& input,
112 std::string* output) { 112 std::string* output) {
113 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 113 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
114 HTMLToDataURI(input))); 114 HTMLToDataURI(input)));
115 115
116 content::WebContents* web_contents = 116 content::WebContents* web_contents =
117 browser()->tab_strip_model()->GetActiveWebContents(); 117 browser()->tab_strip_model()->GetActiveWebContents();
118 ContentAutofillDriver* autofill_driver = 118 ContentAutofillDriver* autofill_driver = static_cast<ContentAutofillDriver*>(
119 ContentAutofillDriverFactory::FromWebContents(web_contents) 119 ContentAutofillDriverFactory::FromWebContents(web_contents)
120 ->DriverForFrame(web_contents->GetMainFrame()); 120 ->DriverForFrame(web_contents->GetMainFrame()));
121 ASSERT_NE(nullptr, autofill_driver); 121 ASSERT_NE(nullptr, autofill_driver);
122 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); 122 AutofillManager* autofill_manager = autofill_driver->autofill_manager();
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) {
(...skipping 15 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698