| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/autofill/autofill_common_test.h" | 11 #include "chrome/browser/autofill/autofill_common_test.h" |
| 12 #include "chrome/browser/autofill/autofill_profile.h" | 12 #include "chrome/browser/autofill/autofill_profile.h" |
| 13 #include "chrome/browser/autofill/form_structure.h" | 13 #include "chrome/browser/autofill/form_structure.h" |
| 14 #include "chrome/browser/autofill/personal_data_manager.h" | 14 #include "chrome/browser/autofill/personal_data_manager.h" |
| 15 #include "chrome/browser/autofill/personal_data_manager_observer.h" | 15 #include "chrome/browser/autofill/personal_data_manager_observer.h" |
| 16 #include "chrome/browser/password_manager/encryptor.h" | 16 #include "chrome/browser/password_manager/encryptor.h" |
| 17 #include "chrome/browser/webdata/web_data_service_factory.h" | 17 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 18 #include "chrome/common/guid.h" | 18 #include "chrome/common/guid.h" |
| 19 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
| 20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 21 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 24 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
| 25 #include "content/test/notification_observer_mock.h" | 25 #include "content/public/test/mock_notification_observer.h" |
| 26 #include "content/test/test_browser_thread.h" | 26 #include "content/test/test_browser_thread.h" |
| 27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 29 #include "webkit/forms/form_data.h" | 29 #include "webkit/forms/form_data.h" |
| 30 | 30 |
| 31 using content::BrowserThread; | 31 using content::BrowserThread; |
| 32 using webkit::forms::FormData; | 32 using webkit::forms::FormData; |
| 33 | 33 |
| 34 ACTION(QuitUIMessageLoop) { | 34 ACTION(QuitUIMessageLoop) { |
| 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); | 81 OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
| 82 MessageLoop::current()->Run(); | 82 MessageLoop::current()->Run(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 MessageLoopForUI message_loop_; | 85 MessageLoopForUI message_loop_; |
| 86 content::TestBrowserThread ui_thread_; | 86 content::TestBrowserThread ui_thread_; |
| 87 content::TestBrowserThread db_thread_; | 87 content::TestBrowserThread db_thread_; |
| 88 scoped_ptr<TestingProfile> profile_; | 88 scoped_ptr<TestingProfile> profile_; |
| 89 scoped_ptr<PersonalDataManager> personal_data_; | 89 scoped_ptr<PersonalDataManager> personal_data_; |
| 90 content::NotificationRegistrar registrar_; | 90 content::NotificationRegistrar registrar_; |
| 91 content::NotificationObserverMock observer_; | 91 content::MockNotificationObserver observer_; |
| 92 PersonalDataLoadedObserverMock personal_data_observer_; | 92 PersonalDataLoadedObserverMock personal_data_observer_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 TEST_F(PersonalDataManagerTest, AddProfile) { | 95 TEST_F(PersonalDataManagerTest, AddProfile) { |
| 96 AutofillProfile profile0; | 96 AutofillProfile profile0; |
| 97 autofill_test::SetProfileInfo(&profile0, | 97 autofill_test::SetProfileInfo(&profile0, |
| 98 "John", "Mitchell", "Smith", | 98 "John", "Mitchell", "Smith", |
| 99 "j@s.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco", "CA", | 99 "j@s.com", "Acme Inc.", "1 Main", "Apt A", "San Francisco", "CA", |
| 100 "94102", "USA", "4158889999"); | 100 "94102", "USA", "4158889999"); |
| 101 | 101 |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 | 1951 |
| 1952 // Modify expected to include multi-valued fields. | 1952 // Modify expected to include multi-valued fields. |
| 1953 std::vector<string16> values; | 1953 std::vector<string16> values; |
| 1954 expected.GetMultiInfo(PHONE_HOME_CITY_AND_NUMBER, &values); | 1954 expected.GetMultiInfo(PHONE_HOME_CITY_AND_NUMBER, &values); |
| 1955 values.push_back(ASCIIToUTF16("214-555-1234")); | 1955 values.push_back(ASCIIToUTF16("214-555-1234")); |
| 1956 expected.SetMultiInfo(PHONE_HOME_CITY_AND_NUMBER, values); | 1956 expected.SetMultiInfo(PHONE_HOME_CITY_AND_NUMBER, values); |
| 1957 | 1957 |
| 1958 ASSERT_EQ(1U, results2.size()); | 1958 ASSERT_EQ(1U, results2.size()); |
| 1959 EXPECT_EQ(0, expected.Compare(*results2[0])); | 1959 EXPECT_EQ(0, expected.Compare(*results2[0])); |
| 1960 } | 1960 } |
| OLD | NEW |