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

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: comment Created 10 years 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 "base/scoped_vector.h"
9 #include "chrome/browser/sync/engine/model_safe_worker.h" 10 #include "chrome/browser/sync/engine/model_safe_worker.h"
10 11
11 namespace browser_sync { 12 namespace browser_sync {
12 13
13 class MockUIModelWorker : public ModelSafeWorker { 14 class MockUIModelWorker : public ModelSafeWorker {
14 public: 15 public:
15 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_UI; } 16 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_UI; }
16 virtual bool CurrentThreadIsWorkThread() { return true; } 17 virtual bool CurrentThreadIsWorkThread() { return true; }
17 }; 18 };
18 19
19 class MockDBModelWorker : public ModelSafeWorker { 20 class MockDBModelWorker : public ModelSafeWorker {
20 public: 21 public:
21 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; } 22 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_DB; }
22 virtual bool CurrentThreadIsWorkThread() { return true; } 23 virtual bool CurrentThreadIsWorkThread() { return true; }
23 }; 24 };
24 25
26 class MockModelSafeWorkerRegistrar : public ModelSafeWorkerRegistrar {
27 public:
28 virtual ~MockModelSafeWorkerRegistrar() {}
29 static MockModelSafeWorkerRegistrar* PassiveBookmarks() {
30 ModelSafeRoutingInfo routes;
31 routes[syncable::BOOKMARKS] = GROUP_PASSIVE;
32 MockModelSafeWorkerRegistrar* m = new MockModelSafeWorkerRegistrar(routes);
33 m->passive_worker_ = new ModelSafeWorker();
34 return m;
35 }
36 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) {
37 if (passive_worker_.get())
38 out->push_back(passive_worker_.get());
39 }
40
41 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
42 *out = routes_;
43 }
44 private:
45 explicit MockModelSafeWorkerRegistrar(const ModelSafeRoutingInfo& routes) {
46 routes_ = routes;
47 }
48 scoped_refptr<ModelSafeWorker> passive_worker_;
49 ModelSafeRoutingInfo routes_;
50 };
51
25 } // namespace browser_sync 52 } // namespace browser_sync
26 53
27 #endif // CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_ 54 #endif // CHROME_BROWSER_SYNC_ENGINE_MOCK_MODEL_SAFE_WORKERS_H_
28 55
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/nudge_source.h » ('j') | chrome/browser/sync/engine/syncer_thread2.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698