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

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

Issue 6478005: GTTF: Use a fresh TestingBrowserProcess for each test, part #1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make more tests use the new base class Created 9 years, 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/autofill/autofill_common_test.h" 12 #include "chrome/browser/autofill/autofill_common_test.h"
13 #include "chrome/browser/autofill/autofill_profile.h" 13 #include "chrome/browser/autofill/autofill_profile.h"
14 #include "chrome/browser/autofill/form_structure.h" 14 #include "chrome/browser/autofill/form_structure.h"
15 #include "chrome/browser/autofill/personal_data_manager.h" 15 #include "chrome/browser/autofill/personal_data_manager.h"
16 #include "chrome/browser/browser_thread.h" 16 #include "chrome/browser/browser_thread.h"
17 #include "chrome/browser/password_manager/encryptor.h" 17 #include "chrome/browser/password_manager/encryptor.h"
18 #include "chrome/common/guid.h" 18 #include "chrome/common/guid.h"
19 #include "chrome/common/notification_details.h" 19 #include "chrome/common/notification_details.h"
20 #include "chrome/common/notification_observer_mock.h" 20 #include "chrome/common/notification_observer_mock.h"
21 #include "chrome/common/notification_registrar.h" 21 #include "chrome/common/notification_registrar.h"
22 #include "chrome/common/notification_source.h" 22 #include "chrome/common/notification_source.h"
23 #include "chrome/common/notification_type.h" 23 #include "chrome/common/notification_type.h"
24 #include "chrome/test/testing_browser_process.h"
24 #include "chrome/test/testing_profile.h" 25 #include "chrome/test/testing_profile.h"
25 #include "webkit/glue/form_data.h" 26 #include "webkit/glue/form_data.h"
26 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 29
29 using webkit_glue::FormData; 30 using webkit_glue::FormData;
30 31
31 ACTION(QuitUIMessageLoop) { 32 ACTION(QuitUIMessageLoop) {
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
33 MessageLoop::current()->Quit(); 34 MessageLoop::current()->Quit();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); 68 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask);
68 MessageLoop::current()->Run(); 69 MessageLoop::current()->Run();
69 } 70 }
70 71
71 void ResetPersonalDataManager() { 72 void ResetPersonalDataManager() {
72 personal_data_ = new PersonalDataManager(); 73 personal_data_ = new PersonalDataManager();
73 personal_data_->Init(profile_.get()); 74 personal_data_->Init(profile_.get());
74 personal_data_->SetObserver(&personal_data_observer_); 75 personal_data_->SetObserver(&personal_data_observer_);
75 } 76 }
76 77
78 ScopedTestingBrowserProcess browser_process_;
77 MessageLoopForUI message_loop_; 79 MessageLoopForUI message_loop_;
78 BrowserThread ui_thread_; 80 BrowserThread ui_thread_;
79 BrowserThread db_thread_; 81 BrowserThread db_thread_;
80 scoped_ptr<TestingProfile> profile_; 82 scoped_ptr<TestingProfile> profile_;
81 scoped_refptr<PersonalDataManager> personal_data_; 83 scoped_refptr<PersonalDataManager> personal_data_;
82 NotificationRegistrar registrar_; 84 NotificationRegistrar registrar_;
83 NotificationObserverMock observer_; 85 NotificationObserverMock observer_;
84 PersonalDataLoadedObserverMock personal_data_observer_; 86 PersonalDataLoadedObserverMock personal_data_observer_;
85 }; 87 };
86 88
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 1620
1619 // Expect that the newer information is saved. In this case the year is 1621 // Expect that the newer information is saved. In this case the year is
1620 // added to the existing credit card. 1622 // added to the existing credit card.
1621 CreditCard expected2; 1623 CreditCard expected2;
1622 autofill_test::SetCreditCardInfo(&expected2, 1624 autofill_test::SetCreditCardInfo(&expected2,
1623 "L1", "Biggie Smalls", "4111111111111111", "01", "2011"); 1625 "L1", "Biggie Smalls", "4111111111111111", "01", "2011");
1624 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); 1626 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards();
1625 ASSERT_EQ(1U, results2.size()); 1627 ASSERT_EQ(1U, results2.size());
1626 EXPECT_EQ(0, expected2.Compare(*results2[0])); 1628 EXPECT_EQ(0, expected2.Compare(*results2[0]));
1627 } 1629 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_metrics_unittest.cc ('k') | chrome/browser/automation/automation_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698