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 <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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 82 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
83 done.Wait(); | 83 done.Wait(); |
84 base::MessageLoop::current()->PostTask(FROM_HERE, | 84 base::MessageLoop::current()->PostTask(FROM_HERE, |
85 base::MessageLoop::QuitClosure()); | 85 base::MessageLoop::QuitClosure()); |
86 base::MessageLoop::current()->Run(); | 86 base::MessageLoop::current()->Run(); |
87 db_thread_.Stop(); | 87 db_thread_.Stop(); |
88 } | 88 } |
89 | 89 |
90 void ResetPersonalDataManager() { | 90 void ResetPersonalDataManager() { |
91 personal_data_.reset(new PersonalDataManager("en-US")); | 91 personal_data_.reset(new PersonalDataManager("en-US")); |
92 personal_data_->Init(profile_.get(), | 92 // TODO(blundell): Will have to construct an AutofillWebDataService. |
| 93 personal_data_->Init(scoped_refptr<AutofillWebDataService>(NULL), |
93 profile_->GetPrefs(), | 94 profile_->GetPrefs(), |
94 profile_->IsOffTheRecord()); | 95 profile_->IsOffTheRecord()); |
95 personal_data_->AddObserver(&personal_data_observer_); | 96 personal_data_->AddObserver(&personal_data_observer_); |
96 | 97 |
97 // Verify that the web database has been updated and the notification sent. | 98 // Verify that the web database has been updated and the notification sent. |
98 EXPECT_CALL(personal_data_observer_, | 99 EXPECT_CALL(personal_data_observer_, |
99 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 100 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
100 base::MessageLoop::current()->Run(); | 101 base::MessageLoop::current()->Run(); |
101 } | 102 } |
102 | 103 |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 AutofillProfile space_invader(base::GenerateGUID(), "Chrome settings"); | 2484 AutofillProfile space_invader(base::GenerateGUID(), "Chrome settings"); |
2484 test::SetProfileInfo(&space_invader, "Marty", "", "Martian", | 2485 test::SetProfileInfo(&space_invader, "Marty", "", "Martian", |
2485 "mm@example.com", "", "1 Flying Object", "", "Valles Marineris", "", | 2486 "mm@example.com", "", "1 Flying Object", "", "Valles Marineris", "", |
2486 "", "XX", ""); | 2487 "", "XX", ""); |
2487 personal_data_->AddProfile(moose); | 2488 personal_data_->AddProfile(moose); |
2488 ResetPersonalDataManager(); | 2489 ResetPersonalDataManager(); |
2489 EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress()); | 2490 EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress()); |
2490 } | 2491 } |
2491 | 2492 |
2492 } // namespace autofill | 2493 } // namespace autofill |
OLD | NEW |