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_[BOOKMARKS] = GROUP_UI; | 45 routes_[BOOKMARKS] = GROUP_UI; |
57 routes_[AUTOFILL] = GROUP_DB; | 46 routes_[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, |
| 64 NULL, |
| 65 workers, |
| 66 &extensions_activity_monitor_, |
| 67 throttled_data_type_tracker_.get(), |
| 68 std::vector<SyncEngineEventListener*>(), |
| 69 NULL, |
| 70 NULL)); |
| 71 context_->set_routing_info(routes_); |
| 72 |
68 session_.reset(MakeSession()); | 73 session_.reset(MakeSession()); |
69 throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); | 74 throttled_data_type_tracker_.reset(new ThrottledDataTypeTracker(NULL)); |
70 } | 75 } |
71 virtual void TearDown() { | 76 virtual void TearDown() { |
72 session_.reset(); | 77 session_.reset(); |
73 context_.reset(); | 78 context_.reset(); |
74 } | 79 } |
75 | 80 |
76 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE { | 81 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) OVERRIDE { |
77 FailControllerInvocationIfDisabled("OnSilencedUntil"); | 82 FailControllerInvocationIfDisabled("OnSilencedUntil"); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 495 |
491 ASSERT_EQ(3U, types_with_payloads.size()); | 496 ASSERT_EQ(3U, types_with_payloads.size()); |
492 EXPECT_EQ(types_with_payloads[BOOKMARKS], payload); | 497 EXPECT_EQ(types_with_payloads[BOOKMARKS], payload); |
493 EXPECT_EQ(types_with_payloads[PASSWORDS], payload); | 498 EXPECT_EQ(types_with_payloads[PASSWORDS], payload); |
494 EXPECT_EQ(types_with_payloads[AUTOFILL], payload); | 499 EXPECT_EQ(types_with_payloads[AUTOFILL], payload); |
495 } | 500 } |
496 | 501 |
497 } // namespace | 502 } // namespace |
498 } // namespace sessions | 503 } // namespace sessions |
499 } // namespace syncer | 504 } // namespace syncer |
OLD | NEW |