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

Side by Side Diff: components/autofill/core/browser/personal_data_manager_unittest.cc

Issue 17893010: In components/autofill, move notification handling into content driver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 7 years, 5 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
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "chrome/test/base/testing_browser_process.h" 13 #include "chrome/test/base/testing_browser_process.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "components/autofill/core/browser/autofill_common_test.h" 15 #include "components/autofill/core/browser/autofill_common_test.h"
16 #include "components/autofill/core/browser/autofill_metrics.h" 16 #include "components/autofill/core/browser/autofill_metrics.h"
17 #include "components/autofill/core/browser/autofill_profile.h" 17 #include "components/autofill/core/browser/autofill_profile.h"
18 #include "components/autofill/core/browser/form_structure.h" 18 #include "components/autofill/core/browser/form_structure.h"
19 #include "components/autofill/core/browser/personal_data_manager.h" 19 #include "components/autofill/core/browser/personal_data_manager.h"
20 #include "components/autofill/core/browser/personal_data_manager_observer.h" 20 #include "components/autofill/core/browser/personal_data_manager_observer.h"
21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
22 #include "components/autofill/core/common/form_data.h" 22 #include "components/autofill/core/common/form_data.h"
23 #include "components/webdata/encryptor/encryptor.h" 23 #include "components/webdata/encryptor/encryptor.h"
24 #include "content/public/browser/notification_details.h"
25 #include "content/public/browser/notification_registrar.h"
26 #include "content/public/browser/notification_source.h"
27 #include "content/public/browser/notification_types.h"
28 #include "content/public/test/mock_notification_observer.h"
29 #include "content/public/test/test_browser_thread.h" 24 #include "content/public/test/test_browser_thread.h"
30 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
31 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
32 27
33 using content::BrowserThread; 28 using content::BrowserThread;
34 29
35 namespace autofill { 30 namespace autofill {
36 namespace { 31 namespace {
37 32
38 ACTION(QuitUIMessageLoop) { 33 ACTION(QuitUIMessageLoop) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 101
107 void MakeProfileIncognito() { 102 void MakeProfileIncognito() {
108 profile_->set_incognito(true); 103 profile_->set_incognito(true);
109 } 104 }
110 105
111 base::MessageLoopForUI message_loop_; 106 base::MessageLoopForUI message_loop_;
112 content::TestBrowserThread ui_thread_; 107 content::TestBrowserThread ui_thread_;
113 content::TestBrowserThread db_thread_; 108 content::TestBrowserThread db_thread_;
114 scoped_ptr<TestingProfile> profile_; 109 scoped_ptr<TestingProfile> profile_;
115 scoped_ptr<PersonalDataManager> personal_data_; 110 scoped_ptr<PersonalDataManager> personal_data_;
116 content::NotificationRegistrar registrar_;
117 content::MockNotificationObserver observer_;
118 PersonalDataLoadedObserverMock personal_data_observer_; 111 PersonalDataLoadedObserverMock personal_data_observer_;
119 }; 112 };
120 113
121 TEST_F(PersonalDataManagerTest, AddProfile) { 114 TEST_F(PersonalDataManagerTest, AddProfile) {
122 // Add profile0 to the database. 115 // Add profile0 to the database.
123 AutofillProfile profile0(autofill::test::GetFullProfile()); 116 AutofillProfile profile0(autofill::test::GetFullProfile());
124 profile0.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("j@s.com")); 117 profile0.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("j@s.com"));
125 personal_data_->AddProfile(profile0); 118 personal_data_->AddProfile(profile0);
126 119
127 // Reload the database. 120 // Reload the database.
(...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 // Removing shouldn't work. 2410 // Removing shouldn't work.
2418 personal_data_->RemoveByGUID(steve_jobs.guid()); 2411 personal_data_->RemoveByGUID(steve_jobs.guid());
2419 personal_data_->RemoveByGUID(bill_gates.guid()); 2412 personal_data_->RemoveByGUID(bill_gates.guid());
2420 2413
2421 ResetPersonalDataManager(); 2414 ResetPersonalDataManager();
2422 EXPECT_EQ(1U, personal_data_->GetProfiles().size()); 2415 EXPECT_EQ(1U, personal_data_->GetProfiles().size());
2423 EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); 2416 EXPECT_EQ(1U, personal_data_->GetCreditCards().size());
2424 } 2417 }
2425 2418
2426 } // namespace autofill 2419 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698