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 21 matching lines...) Expand all Loading... |
32 SyncSessionTest() : controller_invocations_allowed_(false) {} | 32 SyncSessionTest() : controller_invocations_allowed_(false) {} |
33 | 33 |
34 SyncSession* MakeSession() { | 34 SyncSession* MakeSession() { |
35 std::vector<ModelSafeWorker*> workers; | 35 std::vector<ModelSafeWorker*> workers; |
36 GetWorkers(&workers); | 36 GetWorkers(&workers); |
37 return new SyncSession(context_.get(), this, SyncSourceInfo(), | 37 return new SyncSession(context_.get(), this, SyncSourceInfo(), |
38 routes_, workers); | 38 routes_, workers); |
39 } | 39 } |
40 | 40 |
41 virtual void SetUp() { | 41 virtual void SetUp() { |
42 ModelSafeRoutingInfo routing_info; | |
43 std::vector<ModelSafeWorker*> workers; | |
44 | |
45 GetModelSafeRoutingInfo(&routing_info); | |
46 GetWorkers(&workers); | |
47 | |
48 context_.reset( | |
49 new SyncSessionContext( | |
50 NULL, NULL, routing_info, workers, &extensions_activity_monitor_, | |
51 std::vector<SyncEngineEventListener*>(), NULL, NULL)); | |
52 routes_.clear(); | 42 routes_.clear(); |
53 routes_[syncable::BOOKMARKS] = GROUP_UI; | 43 routes_[syncable::BOOKMARKS] = GROUP_UI; |
54 routes_[syncable::AUTOFILL] = GROUP_DB; | 44 routes_[syncable::AUTOFILL] = GROUP_DB; |
55 scoped_refptr<ModelSafeWorker> passive_worker( | 45 scoped_refptr<ModelSafeWorker> passive_worker( |
56 new FakeModelWorker(GROUP_PASSIVE)); | 46 new FakeModelWorker(GROUP_PASSIVE)); |
57 scoped_refptr<ModelSafeWorker> ui_worker( | 47 scoped_refptr<ModelSafeWorker> ui_worker( |
58 new FakeModelWorker(GROUP_UI)); | 48 new FakeModelWorker(GROUP_UI)); |
59 scoped_refptr<ModelSafeWorker> db_worker( | 49 scoped_refptr<ModelSafeWorker> db_worker( |
60 new FakeModelWorker(GROUP_DB)); | 50 new FakeModelWorker(GROUP_DB)); |
61 workers_.clear(); | 51 workers_.clear(); |
62 workers_.push_back(passive_worker); | 52 workers_.push_back(passive_worker); |
63 workers_.push_back(ui_worker); | 53 workers_.push_back(ui_worker); |
64 workers_.push_back(db_worker); | 54 workers_.push_back(db_worker); |
| 55 |
| 56 std::vector<ModelSafeWorker*> workers; |
| 57 GetWorkers(&workers); |
| 58 |
| 59 context_.reset( |
| 60 new SyncSessionContext( |
| 61 NULL, NULL, workers, &extensions_activity_monitor_, |
| 62 std::vector<SyncEngineEventListener*>(), NULL, NULL)); |
| 63 context_->set_routing_info(routes_); |
| 64 |
65 session_.reset(MakeSession()); | 65 session_.reset(MakeSession()); |
66 } | 66 } |
67 virtual void TearDown() { | 67 virtual void TearDown() { |
68 session_.reset(); | 68 session_.reset(); |
69 context_.reset(); | 69 context_.reset(); |
70 } | 70 } |
71 | 71 |
72 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE { | 72 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE { |
73 FailControllerInvocationIfDisabled("OnSilencedUntil"); | 73 FailControllerInvocationIfDisabled("OnSilencedUntil"); |
74 } | 74 } |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); | 527 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); |
528 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); | 528 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); |
529 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); | 529 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); |
530 EXPECT_EQ(payload2, original[syncable::SESSIONS]); | 530 EXPECT_EQ(payload2, original[syncable::SESSIONS]); |
531 EXPECT_EQ(payload3, original[syncable::THEMES]); | 531 EXPECT_EQ(payload3, original[syncable::THEMES]); |
532 } | 532 } |
533 | 533 |
534 } // namespace | 534 } // namespace |
535 } // namespace sessions | 535 } // namespace sessions |
536 } // namespace browser_sync | 536 } // namespace browser_sync |
OLD | NEW |