Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: components/sync/engine/sync_backend_registrar_unittest.cc

Issue 2942773002: Task Scheduler API migration: change BrowserThreadModelWorker to SequencedModelWorker (Closed)
Patch Set: Updated more comments to reflect thread -> sequence migration. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/sync/engine/sync_backend_registrar.h" 5 #include "components/sync/engine/sync_backend_registrar.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "components/sync/engine/browser_thread_model_worker.h"
14 #include "components/sync/engine/passive_model_worker.h" 13 #include "components/sync/engine/passive_model_worker.h"
14 #include "components/sync/engine/sequenced_model_worker.h"
15 #include "components/sync/model/change_processor_mock.h" 15 #include "components/sync/model/change_processor_mock.h"
16 #include "components/sync/syncable/test_user_share.h" 16 #include "components/sync/syncable/test_user_share.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace syncer { 20 namespace syncer {
21 21
22 namespace { 22 namespace {
23 23
24 using ::testing::_; 24 using ::testing::_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 UserShare* user_share() { return test_user_share_.user_share(); } 89 UserShare* user_share() { return test_user_share_.user_share(); }
90 scoped_refptr<base::SingleThreadTaskRunner> db_task_runner() { 90 scoped_refptr<base::SingleThreadTaskRunner> db_task_runner() {
91 return db_thread_.task_runner(); 91 return db_thread_.task_runner();
92 } 92 }
93 93
94 private: 94 private:
95 scoped_refptr<ModelSafeWorker> CreateModelWorkerForGroup( 95 scoped_refptr<ModelSafeWorker> CreateModelWorkerForGroup(
96 ModelSafeGroup group) { 96 ModelSafeGroup group) {
97 switch (group) { 97 switch (group) {
98 case GROUP_UI: 98 case GROUP_UI:
99 return new BrowserThreadModelWorker(message_loop_.task_runner(), group); 99 return new SequencedModelWorker(message_loop_.task_runner(), group);
100 case GROUP_DB: 100 case GROUP_DB:
101 return new BrowserThreadModelWorker(db_thread_.task_runner(), group); 101 return new SequencedModelWorker(db_thread_.task_runner(), group);
102 case GROUP_FILE: 102 case GROUP_FILE:
103 return new BrowserThreadModelWorker(file_thread_.task_runner(), group); 103 return new SequencedModelWorker(file_thread_.task_runner(), group);
104 case GROUP_PASSIVE: 104 case GROUP_PASSIVE:
105 return new PassiveModelWorker(); 105 return new PassiveModelWorker();
106 default: 106 default:
107 return nullptr; 107 return nullptr;
108 } 108 }
109 } 109 }
110 110
111 base::MessageLoop message_loop_; 111 base::MessageLoop message_loop_;
112 base::Thread db_thread_; 112 base::Thread db_thread_;
113 base::Thread file_thread_; 113 base::Thread file_thread_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 registrar()->ConfigureDataTypes(types_to_add, ModelTypeSet()); 264 registrar()->ConfigureDataTypes(types_to_add, ModelTypeSet());
265 EXPECT_EQ(ModelTypeSet(BOOKMARKS), newly_added_types); 265 EXPECT_EQ(ModelTypeSet(BOOKMARKS), newly_added_types);
266 EXPECT_EQ(types_to_add, registrar()->GetLastConfiguredTypes()); 266 EXPECT_EQ(types_to_add, registrar()->GetLastConfiguredTypes());
267 ExpectRoutingInfo( 267 ExpectRoutingInfo(
268 {{AUTOFILL, GROUP_NON_BLOCKING}, {BOOKMARKS, GROUP_NON_BLOCKING}}); 268 {{AUTOFILL, GROUP_NON_BLOCKING}, {BOOKMARKS, GROUP_NON_BLOCKING}});
269 } 269 }
270 270
271 } // namespace 271 } // namespace
272 272
273 } // namespace syncer 273 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/sync_backend_registrar.cc ('k') | components/sync/engine/ui_model_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698