| 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/test/engine/fake_model_safe_worker_registrar.h" | 5 #include "chrome/browser/sync/test/engine/fake_model_safe_worker_registrar.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/test/engine/fake_model_worker.h" | 7 #include "chrome/browser/sync/test/engine/fake_model_worker.h" |
| 8 | 8 |
| 9 namespace browser_sync { | 9 namespace browser_sync { |
| 10 | 10 |
| 11 FakeModelSafeWorkerRegistrar::FakeModelSafeWorkerRegistrar( | 11 FakeModelSafeWorkerRegistrar::FakeModelSafeWorkerRegistrar( |
| 12 const ModelSafeRoutingInfo& routes) : routes_(routes) { | 12 const ModelSafeRoutingInfo& routes) : routes_(routes) { |
| 13 std::set<ModelSafeGroup> groups; | 13 std::set<ModelSafeGroup> groups; |
| 14 for (ModelSafeRoutingInfo::const_iterator it = routes_.begin(); | 14 for (ModelSafeRoutingInfo::const_iterator it = routes_.begin(); |
| 15 it != routes_.end(); ++it) { | 15 it != routes_.end(); ++it) { |
| 16 groups.insert(it->second); | 16 groups.insert(it->second); |
| 17 } | 17 } |
| 18 // Sessions always expect a passive worker to be present. | |
| 19 groups.insert(GROUP_PASSIVE); | |
| 20 | 18 |
| 21 for (std::set<ModelSafeGroup>::const_iterator it = groups.begin(); | 19 for (std::set<ModelSafeGroup>::const_iterator it = groups.begin(); |
| 22 it != groups.end(); ++it) { | 20 it != groups.end(); ++it) { |
| 23 workers_.push_back(make_scoped_refptr(new FakeModelWorker(*it))); | 21 workers_.push_back(make_scoped_refptr(new FakeModelWorker(*it))); |
| 24 } | 22 } |
| 25 } | 23 } |
| 26 | 24 |
| 27 FakeModelSafeWorkerRegistrar::~FakeModelSafeWorkerRegistrar() {} | 25 FakeModelSafeWorkerRegistrar::~FakeModelSafeWorkerRegistrar() {} |
| 28 | 26 |
| 29 void FakeModelSafeWorkerRegistrar::GetWorkers( | 27 void FakeModelSafeWorkerRegistrar::GetWorkers( |
| 30 std::vector<ModelSafeWorker*>* out) { | 28 std::vector<ModelSafeWorker*>* out) { |
| 31 for (std::vector<scoped_refptr<ModelSafeWorker> >::const_iterator it = | 29 for (std::vector<scoped_refptr<ModelSafeWorker> >::const_iterator it = |
| 32 workers_.begin(); it != workers_.end(); ++it) { | 30 workers_.begin(); it != workers_.end(); ++it) { |
| 33 out->push_back(it->get()); | 31 out->push_back(it->get()); |
| 34 } | 32 } |
| 35 } | 33 } |
| 36 | 34 |
| 37 void FakeModelSafeWorkerRegistrar::GetModelSafeRoutingInfo( | 35 void FakeModelSafeWorkerRegistrar::GetModelSafeRoutingInfo( |
| 38 ModelSafeRoutingInfo* out) { | 36 ModelSafeRoutingInfo* out) { |
| 39 *out = routes_; | 37 *out = routes_; |
| 40 } | 38 } |
| 41 | 39 |
| 42 } // namespace browser_sync | 40 } // namespace browser_sync |
| OLD | NEW |