OLD | NEW |
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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/task.h" | 15 #include "base/task.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/waitable_event.h" | |
19 #include "chrome/browser/autofill/autofill_common_unittest.h" | 18 #include "chrome/browser/autofill/autofill_common_unittest.h" |
20 #include "chrome/browser/chrome_thread.h" | 19 #include "chrome/browser/chrome_thread.h" |
21 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 20 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
22 #include "chrome/browser/sync/engine/syncapi.h" | 21 #include "chrome/browser/sync/engine/syncapi.h" |
23 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 22 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
24 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 23 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
25 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 24 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
26 #include "chrome/browser/sync/profile_sync_factory.h" | 25 #include "chrome/browser/sync/profile_sync_factory.h" |
27 #include "chrome/browser/sync/profile_sync_service.h" | 26 #include "chrome/browser/sync/profile_sync_service.h" |
28 #include "chrome/browser/sync/profile_sync_test_util.h" | 27 #include "chrome/browser/sync/profile_sync_test_util.h" |
29 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" | 28 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" |
30 #include "chrome/browser/sync/syncable/model_type.h" | 29 #include "chrome/browser/sync/syncable/model_type.h" |
31 #include "chrome/browser/sync/test_profile_sync_service.h" | 30 #include "chrome/browser/sync/test_profile_sync_service.h" |
32 #include "chrome/browser/webdata/autofill_change.h" | 31 #include "chrome/browser/webdata/autofill_change.h" |
33 #include "chrome/browser/webdata/autofill_entry.h" | 32 #include "chrome/browser/webdata/autofill_entry.h" |
34 #include "chrome/browser/webdata/web_database.h" | 33 #include "chrome/browser/webdata/web_database.h" |
35 #include "chrome/common/notification_source.h" | 34 #include "chrome/common/notification_source.h" |
36 #include "chrome/common/notification_type.h" | 35 #include "chrome/common/notification_type.h" |
37 #include "chrome/test/profile_mock.h" | 36 #include "chrome/test/profile_mock.h" |
38 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
39 | 38 |
40 using base::Time; | 39 using base::Time; |
41 using base::WaitableEvent; | |
42 using browser_sync::AutofillChangeProcessor; | 40 using browser_sync::AutofillChangeProcessor; |
43 using browser_sync::AutofillDataTypeController; | 41 using browser_sync::AutofillDataTypeController; |
44 using browser_sync::AutofillModelAssociator; | 42 using browser_sync::AutofillModelAssociator; |
45 using syncable::WriteTransaction; | 43 using syncable::WriteTransaction; |
46 using testing::_; | 44 using testing::_; |
47 using testing::DoAll; | 45 using testing::DoAll; |
48 using testing::DoDefault; | 46 using testing::DoDefault; |
49 using testing::ElementsAre; | 47 using testing::ElementsAre; |
50 using testing::Eq; | 48 using testing::Eq; |
51 using testing::Invoke; | 49 using testing::Invoke; |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 service_->AddObserver(&observer); | 974 service_->AddObserver(&observer); |
977 EXPECT_CALL(observer, OnStateChanged()).WillOnce(QuitUIMessageLoop()); | 975 EXPECT_CALL(observer, OnStateChanged()).WillOnce(QuitUIMessageLoop()); |
978 MessageLoop::current()->Run(); | 976 MessageLoop::current()->Run(); |
979 EXPECT_TRUE(service_->unrecoverable_error_detected()); | 977 EXPECT_TRUE(service_->unrecoverable_error_detected()); |
980 | 978 |
981 // Ensure future autofill notifications don't crash. | 979 // Ensure future autofill notifications don't crash. |
982 notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, | 980 notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, |
983 Source<WebDataService>(web_data_service_.get()), | 981 Source<WebDataService>(web_data_service_.get()), |
984 Details<AutofillChangeList>(&changes)); | 982 Details<AutofillChangeList>(&changes)); |
985 } | 983 } |
OLD | NEW |