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 "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/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 content::TestBrowserThread ui_thread_; | 115 content::TestBrowserThread ui_thread_; |
116 content::TestBrowserThread db_thread_; | 116 content::TestBrowserThread db_thread_; |
117 content::TestBrowserThread file_thread_; | 117 content::TestBrowserThread file_thread_; |
118 content::TestBrowserThread io_thread_; | 118 content::TestBrowserThread io_thread_; |
119 }; | 119 }; |
120 | 120 |
121 TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) { | 121 TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) { |
122 registrar_->SetInitialTypes(ModelTypeSet()); | 122 registrar_->SetInitialTypes(ModelTypeSet()); |
123 EXPECT_FALSE(registrar_->IsNigoriEnabled()); | 123 EXPECT_FALSE(registrar_->IsNigoriEnabled()); |
124 { | 124 { |
125 std::vector<syncer::ModelSafeWorker*> workers; | 125 std::vector<scoped_refptr<syncer::ModelSafeWorker> > workers; |
126 registrar_->GetWorkers(&workers); | 126 registrar_->GetWorkers(&workers); |
127 EXPECT_EQ(4u, workers.size()); | 127 EXPECT_EQ(4u, workers.size()); |
128 } | 128 } |
129 ExpectRoutingInfo(registrar_.get(), syncer::ModelSafeRoutingInfo()); | 129 ExpectRoutingInfo(registrar_.get(), syncer::ModelSafeRoutingInfo()); |
130 ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); | 130 ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); |
131 } | 131 } |
132 | 132 |
133 TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { | 133 TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { |
134 const ModelTypeSet initial_types(BOOKMARKS, NIGORI, PASSWORDS); | 134 const ModelTypeSet initial_types(BOOKMARKS, NIGORI, PASSWORDS); |
135 registrar_->SetInitialTypes(initial_types); | 135 registrar_->SetInitialTypes(initial_types); |
136 EXPECT_TRUE(registrar_->IsNigoriEnabled()); | 136 EXPECT_TRUE(registrar_->IsNigoriEnabled()); |
137 { | 137 { |
138 std::vector<syncer::ModelSafeWorker*> workers; | 138 std::vector<scoped_refptr<syncer::ModelSafeWorker> > workers; |
139 registrar_->GetWorkers(&workers); | 139 registrar_->GetWorkers(&workers); |
140 EXPECT_EQ(4u, workers.size()); | 140 EXPECT_EQ(4u, workers.size()); |
141 } | 141 } |
142 { | 142 { |
143 syncer::ModelSafeRoutingInfo expected_routing_info; | 143 syncer::ModelSafeRoutingInfo expected_routing_info; |
144 expected_routing_info[BOOKMARKS] = syncer::GROUP_PASSIVE; | 144 expected_routing_info[BOOKMARKS] = syncer::GROUP_PASSIVE; |
145 expected_routing_info[NIGORI] = syncer::GROUP_PASSIVE; | 145 expected_routing_info[NIGORI] = syncer::GROUP_PASSIVE; |
146 // Passwords dropped because of no password store. | 146 // Passwords dropped because of no password store. |
147 ExpectRoutingInfo(registrar_.get(), expected_routing_info); | 147 ExpectRoutingInfo(registrar_.get(), expected_routing_info); |
148 } | 148 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 ExpectRoutingInfo(registrar_.get(), syncer::ModelSafeRoutingInfo()); | 262 ExpectRoutingInfo(registrar_.get(), syncer::ModelSafeRoutingInfo()); |
263 ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); | 263 ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); |
264 | 264 |
265 // Should do nothing. | 265 // Should do nothing. |
266 TriggerChanges(registrar_.get(), AUTOFILL); | 266 TriggerChanges(registrar_.get(), AUTOFILL); |
267 } | 267 } |
268 | 268 |
269 } // namespace | 269 } // namespace |
270 | 270 |
271 } // namespace browser_sync | 271 } // namespace browser_sync |
OLD | NEW |