OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/glue/sync_backend_registrar.h" | 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/change_processor_mock.h" | 7 #include "chrome/browser/sync/glue/change_processor_mock.h" |
8 #include "chrome/browser/sync/glue/ui_model_worker.h" | 8 #include "chrome/browser/sync/glue/ui_model_worker.h" |
9 #include "chrome/browser/sync/syncable/model_type.h" | 9 #include "chrome/browser/sync/syncable/model_type.h" |
10 #include "chrome/browser/sync/test/engine/test_user_share.h" | 10 #include "chrome/browser/sync/test/engine/test_user_share.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 BrowserThread ui_thread_; | 72 BrowserThread ui_thread_; |
73 }; | 73 }; |
74 | 74 |
75 TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) { | 75 TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) { |
76 TestingProfile profile; | 76 TestingProfile profile; |
77 SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_); | 77 SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_); |
78 EXPECT_FALSE(registrar.IsNigoriEnabled()); | 78 EXPECT_FALSE(registrar.IsNigoriEnabled()); |
79 { | 79 { |
80 std::vector<ModelSafeWorker*> workers; | 80 std::vector<ModelSafeWorker*> workers; |
81 registrar.GetWorkers(&workers); | 81 registrar.GetWorkers(&workers); |
82 EXPECT_EQ(3u, workers.size()); | 82 EXPECT_EQ(4u, workers.size()); |
83 } | 83 } |
84 ExpectRoutingInfo(®istrar, ModelSafeRoutingInfo()); | 84 ExpectRoutingInfo(®istrar, ModelSafeRoutingInfo()); |
85 ExpectHasProcessorsForTypes(®istrar, ModelTypeSet()); | 85 ExpectHasProcessorsForTypes(®istrar, ModelTypeSet()); |
86 registrar.OnSyncerShutdownComplete(); | 86 registrar.OnSyncerShutdownComplete(); |
87 registrar.StopOnUIThread(); | 87 registrar.StopOnUIThread(); |
88 } | 88 } |
89 | 89 |
90 TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { | 90 TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { |
91 TestingProfile profile; | 91 TestingProfile profile; |
92 ModelTypeSet initial_types; | 92 ModelTypeSet initial_types; |
93 initial_types.insert(BOOKMARKS); | 93 initial_types.insert(BOOKMARKS); |
94 initial_types.insert(NIGORI); | 94 initial_types.insert(NIGORI); |
95 initial_types.insert(PASSWORDS); | 95 initial_types.insert(PASSWORDS); |
96 SyncBackendRegistrar registrar(initial_types, "test", &profile, &loop_); | 96 SyncBackendRegistrar registrar(initial_types, "test", &profile, &loop_); |
97 EXPECT_TRUE(registrar.IsNigoriEnabled()); | 97 EXPECT_TRUE(registrar.IsNigoriEnabled()); |
98 { | 98 { |
99 std::vector<ModelSafeWorker*> workers; | 99 std::vector<ModelSafeWorker*> workers; |
100 registrar.GetWorkers(&workers); | 100 registrar.GetWorkers(&workers); |
101 EXPECT_EQ(3u, workers.size()); | 101 EXPECT_EQ(4u, workers.size()); |
102 } | 102 } |
103 { | 103 { |
104 ModelSafeRoutingInfo expected_routing_info; | 104 ModelSafeRoutingInfo expected_routing_info; |
105 expected_routing_info[BOOKMARKS] = GROUP_PASSIVE; | 105 expected_routing_info[BOOKMARKS] = GROUP_PASSIVE; |
106 expected_routing_info[NIGORI] = GROUP_PASSIVE; | 106 expected_routing_info[NIGORI] = GROUP_PASSIVE; |
107 // Passwords dropped because of no password store. | 107 // Passwords dropped because of no password store. |
108 ExpectRoutingInfo(®istrar, expected_routing_info); | 108 ExpectRoutingInfo(®istrar, expected_routing_info); |
109 } | 109 } |
110 ExpectHasProcessorsForTypes(®istrar, ModelTypeSet()); | 110 ExpectHasProcessorsForTypes(®istrar, ModelTypeSet()); |
111 registrar.OnSyncerShutdownComplete(); | 111 registrar.OnSyncerShutdownComplete(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 registrar.OnSyncerShutdownComplete(); | 219 registrar.OnSyncerShutdownComplete(); |
220 registrar.StopOnUIThread(); | 220 registrar.StopOnUIThread(); |
221 } | 221 } |
222 | 222 |
223 // TODO(akalin): Add tests for non-UI non-passive data types (see | 223 // TODO(akalin): Add tests for non-UI non-passive data types (see |
224 // http://crbug.com/93456). | 224 // http://crbug.com/93456). |
225 | 225 |
226 } // namespace | 226 } // namespace |
227 | 227 |
228 } // namespace browser_sync | 228 } // namespace browser_sync |
OLD | NEW |