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

Side by Side Diff: chrome/browser/sync/engine/mock_model_safe_workers.h

Issue 5939006: sync: beginnings of MessageLoop based SyncerThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review+tests Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_ 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_ 6 #define CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/sync/engine/model_safe_worker.h" 9 #include "chrome/browser/sync/engine/model_safe_worker.h"
10 10
11 namespace browser_sync { 11 namespace browser_sync {
12 12
13 class MockUIModelWorker : public ModelSafeWorker { 13 class MockUIModelWorker : public ModelSafeWorker {
14 public: 14 public:
15 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_UI; } 15 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_UI; }
16 virtual bool CurrentThreadIsWorkThread() { return true; } 16 virtual bool CurrentThreadIsWorkThread() { return true; }
17 }; 17 };
18 18
19 class MockDBModelWorker : public ModelSafeWorker { 19 class MockDBModelWorker : public ModelSafeWorker {
20 public: 20 public:
21 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; } 21 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; }
22 virtual bool CurrentThreadIsWorkThread() { return true; } 22 virtual bool CurrentThreadIsWorkThread() { return true; }
23 }; 23 };
24 24
25 class MockModelSafeWorkerRegistrar : public ModelSafeWorkerRegistrar {
akalin 2011/01/25 06:09:53 Move the bodies into a .cc file, please (and move
26 public:
27 virtual ~MockModelSafeWorkerRegistrar() {}
28 static MockModelSafeWorkerRegistrar* PassiveBookmarks() {
29 ModelSafeRoutingInfo routes;
30 routes[syncable::BOOKMARKS] = GROUP_PASSIVE;
31 MockModelSafeWorkerRegistrar* m = new MockModelSafeWorkerRegistrar(routes);
32 m->passive_worker_ = new ModelSafeWorker();
33 return m;
34 }
35 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) {
36 if (passive_worker_.get())
37 out->push_back(passive_worker_.get());
38 }
39
40 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
41 *out = routes_;
42 }
43 private:
44 explicit MockModelSafeWorkerRegistrar(const ModelSafeRoutingInfo& routes) {
45 routes_ = routes;
46 }
47 scoped_refptr<ModelSafeWorker> passive_worker_;
48 ModelSafeRoutingInfo routes_;
49 };
50
25 } // namespace browser_sync 51 } // namespace browser_sync
26 52
27 #endif // CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_ 53 #endif // CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_
28 54
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/nudge_source.h » ('j') | chrome/browser/sync/engine/syncer_thread2_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698