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

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

Issue 10987100: Switch AutofillManager to be UserData on WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix external delegate Created 8 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 | Annotate | Revision Log
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/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 server_experiment_id_ = server_experiment_id; 165 server_experiment_id_ = server_experiment_id;
166 } 166 }
167 167
168 private: 168 private:
169 std::string server_experiment_id_; 169 std::string server_experiment_id_;
170 DISALLOW_COPY_AND_ASSIGN(TestFormStructure); 170 DISALLOW_COPY_AND_ASSIGN(TestFormStructure);
171 }; 171 };
172 172
173 class TestAutofillManager : public AutofillManager { 173 class TestAutofillManager : public AutofillManager {
174 public: 174 public:
175 TestAutofillManager(autofill::AutofillManagerDelegate* manager_delegate, 175 TestAutofillManager(content::WebContents* web_contents,
176 TabContents* tab_contents, 176 autofill::AutofillManagerDelegate* manager_delegate,
177 TestPersonalDataManager* personal_manager) 177 TestPersonalDataManager* personal_manager)
178 : AutofillManager(manager_delegate, tab_contents, personal_manager), 178 : AutofillManager(web_contents, manager_delegate, personal_manager),
179 autofill_enabled_(true), 179 autofill_enabled_(true),
180 did_finish_async_form_submit_(false), 180 did_finish_async_form_submit_(false),
181 message_loop_is_running_(false) { 181 message_loop_is_running_(false) {
182 set_metric_logger(new MockAutofillMetrics); 182 set_metric_logger(new MockAutofillMetrics);
183 } 183 }
184 184
185 virtual bool IsAutofillEnabled() const { return autofill_enabled_; } 185 virtual bool IsAutofillEnabled() const { return autofill_enabled_; }
186 186
187 void set_autofill_enabled(bool autofill_enabled) { 187 void set_autofill_enabled(bool autofill_enabled) {
188 autofill_enabled_ = autofill_enabled; 188 autofill_enabled_ = autofill_enabled;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 void AutofillMetricsTest::SetUp() { 292 void AutofillMetricsTest::SetUp() {
293 Profile* profile = new TestingProfile(); 293 Profile* profile = new TestingProfile();
294 browser_context_.reset(profile); 294 browser_context_.reset(profile);
295 PersonalDataManagerFactory::GetInstance()->SetTestingFactory( 295 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(
296 profile, NULL); 296 profile, NULL);
297 297
298 TabContentsTestHarness::SetUp(); 298 TabContentsTestHarness::SetUp();
299 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); 299 TabAutofillManagerDelegate::CreateForWebContents(web_contents());
300 autofill_manager_ = new TestAutofillManager( 300 autofill_manager_ = new TestAutofillManager(
301 web_contents(),
301 TabAutofillManagerDelegate::FromWebContents(web_contents()), 302 TabAutofillManagerDelegate::FromWebContents(web_contents()),
302 tab_contents(),
303 &personal_data_); 303 &personal_data_);
304 304
305 file_thread_.Start(); 305 file_thread_.Start();
306 } 306 }
307 307
308 void AutofillMetricsTest::TearDown() { 308 void AutofillMetricsTest::TearDown() {
309 file_thread_.Stop(); 309 file_thread_.Stop();
310 TabContentsTestHarness::TearDown(); 310 TabContentsTestHarness::TearDown();
311 } 311 }
312 312
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1466 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1467 TimeTicks::FromInternalValue(3)); 1467 TimeTicks::FromInternalValue(3));
1468 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1468 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1469 autofill_manager_->Reset(); 1469 autofill_manager_->Reset();
1470 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1470 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1471 } 1471 }
1472 1472
1473 // Restore the global Gmock verbosity level to its default value. 1473 // Restore the global Gmock verbosity level to its default value.
1474 ::testing::FLAGS_gmock_verbose = "warning"; 1474 ::testing::FLAGS_gmock_verbose = "warning";
1475 } 1475 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager_unittest.cc ('k') | chrome/browser/autofill/form_structure_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698