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

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: 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 server_experiment_id_ = server_experiment_id; 167 server_experiment_id_ = server_experiment_id;
168 } 168 }
169 169
170 private: 170 private:
171 std::string server_experiment_id_; 171 std::string server_experiment_id_;
172 DISALLOW_COPY_AND_ASSIGN(TestFormStructure); 172 DISALLOW_COPY_AND_ASSIGN(TestFormStructure);
173 }; 173 };
174 174
175 class TestAutofillManager : public AutofillManager { 175 class TestAutofillManager : public AutofillManager {
176 public: 176 public:
177 TestAutofillManager(autofill::AutofillManagerDelegate* manager_delegate, 177 TestAutofillManager(content::WebContents* web_contents,
178 TabContents* tab_contents, 178 autofill::AutofillManagerDelegate* manager_delegate,
179 TestPersonalDataManager* personal_manager) 179 TestPersonalDataManager* personal_manager)
180 : AutofillManager(manager_delegate, tab_contents, personal_manager), 180 : AutofillManager(web_contents, manager_delegate, personal_manager),
181 autofill_enabled_(true), 181 autofill_enabled_(true),
182 did_finish_async_form_submit_(false), 182 did_finish_async_form_submit_(false),
183 message_loop_is_running_(false) { 183 message_loop_is_running_(false) {
184 set_metric_logger(new MockAutofillMetrics); 184 set_metric_logger(new MockAutofillMetrics);
185 } 185 }
186 186
187 virtual bool IsAutofillEnabled() const { return autofill_enabled_; } 187 virtual bool IsAutofillEnabled() const { return autofill_enabled_; }
188 188
189 void set_autofill_enabled(bool autofill_enabled) { 189 void set_autofill_enabled(bool autofill_enabled) {
190 autofill_enabled_ = autofill_enabled; 190 autofill_enabled_ = autofill_enabled;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 void AutofillMetricsTest::SetUp() { 294 void AutofillMetricsTest::SetUp() {
295 Profile* profile = new TestingProfile(); 295 Profile* profile = new TestingProfile();
296 browser_context_.reset(profile); 296 browser_context_.reset(profile);
297 PersonalDataManagerFactory::GetInstance()->SetTestingFactory( 297 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(
298 profile, NULL); 298 profile, NULL);
299 299
300 TabContentsTestHarness::SetUp(); 300 TabContentsTestHarness::SetUp();
301 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); 301 TabAutofillManagerDelegate::CreateForWebContents(web_contents());
302 autofill_manager_ = new TestAutofillManager( 302 autofill_manager_ = new TestAutofillManager(
303 web_contents(),
303 TabAutofillManagerDelegate::FromWebContents(web_contents()), 304 TabAutofillManagerDelegate::FromWebContents(web_contents()),
304 tab_contents(),
305 &personal_data_); 305 &personal_data_);
306 306
307 file_thread_.Start(); 307 file_thread_.Start();
308 } 308 }
309 309
310 void AutofillMetricsTest::TearDown() { 310 void AutofillMetricsTest::TearDown() {
311 file_thread_.Stop(); 311 file_thread_.Stop();
312 TabContentsTestHarness::TearDown(); 312 TabContentsTestHarness::TearDown();
313 } 313 }
314 314
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1468 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1469 TimeTicks::FromInternalValue(3)); 1469 TimeTicks::FromInternalValue(3));
1470 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1470 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1471 autofill_manager_->Reset(); 1471 autofill_manager_->Reset();
1472 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1472 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1473 } 1473 }
1474 1474
1475 // Restore the global Gmock verbosity level to its default value. 1475 // Restore the global Gmock verbosity level to its default value.
1476 ::testing::FLAGS_gmock_verbose = "warning"; 1476 ::testing::FLAGS_gmock_verbose = "warning";
1477 } 1477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698