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 "components/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 scoped_ptr<AutofillExternalDelegate> external_delegate_; | 275 scoped_ptr<AutofillExternalDelegate> external_delegate_; |
276 }; | 276 }; |
277 | 277 |
278 AutofillMetricsTest::~AutofillMetricsTest() { | 278 AutofillMetricsTest::~AutofillMetricsTest() { |
279 // Order of destruction is important as AutofillManager relies on | 279 // Order of destruction is important as AutofillManager relies on |
280 // PersonalDataManager to be around when it gets destroyed. | 280 // PersonalDataManager to be around when it gets destroyed. |
281 autofill_manager_.reset(); | 281 autofill_manager_.reset(); |
282 } | 282 } |
283 | 283 |
284 void AutofillMetricsTest::SetUp() { | 284 void AutofillMetricsTest::SetUp() { |
285 TestingProfile* profile = new TestingProfile(); | 285 ChromeRenderViewHostTestHarness::SetUp(); |
286 | 286 |
287 // Ensure Mac OS X does not pop up a modal dialog for the Address Book. | 287 // Ensure Mac OS X does not pop up a modal dialog for the Address Book. |
288 autofill::test::DisableSystemServices(profile); | 288 autofill::test::DisableSystemServices(profile()); |
289 | 289 |
290 profile->CreateRequestContext(); | 290 profile()->CreateRequestContext(); |
291 browser_context_.reset(profile); | 291 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile(), NULL); |
292 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(profile, NULL); | |
293 | 292 |
294 ChromeRenderViewHostTestHarness::SetUp(); | |
295 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); | 293 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); |
296 | 294 |
297 personal_data_.reset(new TestPersonalDataManager()); | 295 personal_data_.reset(new TestPersonalDataManager()); |
298 personal_data_->SetBrowserContext(profile); | 296 personal_data_->SetBrowserContext(profile()); |
299 autofill_driver_.reset(new TestAutofillDriver(web_contents())); | 297 autofill_driver_.reset(new TestAutofillDriver(web_contents())); |
300 autofill_manager_.reset(new TestAutofillManager( | 298 autofill_manager_.reset(new TestAutofillManager( |
301 autofill_driver_.get(), | 299 autofill_driver_.get(), |
302 TabAutofillManagerDelegate::FromWebContents(web_contents()), | 300 TabAutofillManagerDelegate::FromWebContents(web_contents()), |
303 personal_data_.get())); | 301 personal_data_.get())); |
304 | 302 |
305 external_delegate_.reset(new AutofillExternalDelegate( | 303 external_delegate_.reset(new AutofillExternalDelegate( |
306 web_contents(), | 304 web_contents(), |
307 autofill_manager_.get(), | 305 autofill_manager_.get(), |
308 autofill_driver_.get())); | 306 autofill_driver_.get())); |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 TimeTicks::FromInternalValue(5)); | 1557 TimeTicks::FromInternalValue(5)); |
1560 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | 1558 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), |
1561 TimeTicks::FromInternalValue(3)); | 1559 TimeTicks::FromInternalValue(3)); |
1562 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); | 1560 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); |
1563 autofill_manager_->Reset(); | 1561 autofill_manager_->Reset(); |
1564 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); | 1562 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); |
1565 } | 1563 } |
1566 } | 1564 } |
1567 | 1565 |
1568 } // namespace autofill | 1566 } // namespace autofill |
OLD | NEW |