| 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 "sync/sessions/sync_session.h" | 5 #include "sync/sessions/sync_session.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 SyncSessionTest() : controller_invocations_allowed_(false) {} | 34 SyncSessionTest() : controller_invocations_allowed_(false) {} |
| 35 | 35 |
| 36 SyncSession* MakeSession() { | 36 SyncSession* MakeSession() { |
| 37 std::vector<ModelSafeWorker*> workers; | 37 std::vector<ModelSafeWorker*> workers; |
| 38 GetWorkers(&workers); | 38 GetWorkers(&workers); |
| 39 return new SyncSession(context_.get(), this, SyncSourceInfo(), | 39 return new SyncSession(context_.get(), this, SyncSourceInfo(), |
| 40 routes_, workers); | 40 routes_, workers); |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void SetUp() { | 43 virtual void SetUp() { |
| 44 ModelSafeRoutingInfo routing_info; | |
| 45 std::vector<ModelSafeWorker*> workers; | |
| 46 | |
| 47 GetModelSafeRoutingInfo(&routing_info); | |
| 48 GetWorkers(&workers); | |
| 49 | |
| 50 context_.reset( | |
| 51 new SyncSessionContext( | |
| 52 NULL, NULL, routing_info, workers, &extensions_activity_monitor_, | |
| 53 throttled_data_type_tracker_.get(), | |
| 54 std::vector<SyncEngineEventListener*>(), NULL, NULL)); | |
| 55 routes_.clear(); | 44 routes_.clear(); |
| 56 routes_[syncer::BOOKMARKS] = GROUP_UI; | 45 routes_[syncer::BOOKMARKS] = GROUP_UI; |
| 57 routes_[syncer::AUTOFILL] = GROUP_DB; | 46 routes_[syncer::AUTOFILL] = GROUP_DB; |
| 58 scoped_refptr<ModelSafeWorker> passive_worker( | 47 scoped_refptr<ModelSafeWorker> passive_worker( |
| 59 new FakeModelWorker(GROUP_PASSIVE)); | 48 new FakeModelWorker(GROUP_PASSIVE)); |
| 60 scoped_refptr<ModelSafeWorker> ui_worker( | 49 scoped_refptr<ModelSafeWorker> ui_worker( |
| 61 new FakeModelWorker(GROUP_UI)); | 50 new FakeModelWorker(GROUP_UI)); |
| 62 scoped_refptr<ModelSafeWorker> db_worker( | 51 scoped_refptr<ModelSafeWorker> db_worker( |
| 63 new FakeModelWorker(GROUP_DB)); | 52 new FakeModelWorker(GROUP_DB)); |
| 64 workers_.clear(); | 53 workers_.clear(); |
| 65 workers_.push_back(passive_worker); | 54 workers_.push_back(passive_worker); |
| 66 workers_.push_back(ui_worker); | 55 workers_.push_back(ui_worker); |
| 67 workers_.push_back(db_worker); | 56 workers_.push_back(db_worker); |
| 57 |
| 58 std::vector<ModelSafeWorker*> workers; |
| 59 GetWorkers(&workers); |
| 60 |
| 61 context_.reset( |
| 62 new SyncSessionContext( |
| 63 NULL, NULL, workers, &extensions_activity_monitor_, |
| 64 throttled_data_type_tracker_.get(), |
| 65 std::vector<SyncEngineEventListener*>(), NULL, NULL)); |
| 66 context_->set_routing_info(routes_); |
| 67 |
| 68 session_.reset(MakeSession()); | 68 session_.reset(MakeSession()); |
| 69 throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); | 69 throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); |
| 70 } | 70 } |
| 71 virtual void TearDown() { | 71 virtual void TearDown() { |
| 72 session_.reset(); | 72 session_.reset(); |
| 73 context_.reset(); | 73 context_.reset(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE { | 76 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE { |
| 77 FailControllerInvocationIfDisabled("OnSilencedUntil"); | 77 FailControllerInvocationIfDisabled("OnSilencedUntil"); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 ASSERT_EQ(3U, types_with_payloads.size()); | 492 ASSERT_EQ(3U, types_with_payloads.size()); |
| 493 EXPECT_EQ(types_with_payloads[syncer::BOOKMARKS], payload); | 493 EXPECT_EQ(types_with_payloads[syncer::BOOKMARKS], payload); |
| 494 EXPECT_EQ(types_with_payloads[syncer::PASSWORDS], payload); | 494 EXPECT_EQ(types_with_payloads[syncer::PASSWORDS], payload); |
| 495 EXPECT_EQ(types_with_payloads[syncer::AUTOFILL], payload); | 495 EXPECT_EQ(types_with_payloads[syncer::AUTOFILL], payload); |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace | 498 } // namespace |
| 499 } // namespace sessions | 499 } // namespace sessions |
| 500 } // namespace syncer | 500 } // namespace syncer |
| OLD | NEW |