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" |
11 #include "sync/engine/conflict_resolver.h" | 11 #include "sync/engine/conflict_resolver.h" |
| 12 #include "sync/engine/throttled_data_type_tracker.h" |
12 #include "sync/engine/syncer_types.h" | 13 #include "sync/engine/syncer_types.h" |
13 #include "sync/sessions/session_state.h" | 14 #include "sync/sessions/session_state.h" |
14 #include "sync/sessions/status_controller.h" | 15 #include "sync/sessions/status_controller.h" |
15 #include "sync/syncable/model_type.h" | 16 #include "sync/syncable/model_type.h" |
16 #include "sync/syncable/syncable.h" | 17 #include "sync/syncable/syncable.h" |
17 #include "sync/syncable/syncable_id.h" | 18 #include "sync/syncable/syncable_id.h" |
18 #include "sync/test/engine/fake_model_worker.h" | 19 #include "sync/test/engine/fake_model_worker.h" |
19 #include "sync/test/engine/test_directory_setter_upper.h" | 20 #include "sync/test/engine/test_directory_setter_upper.h" |
20 #include "sync/test/fake_extensions_activity_monitor.h" | 21 #include "sync/test/fake_extensions_activity_monitor.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 14 matching lines...) Expand all Loading... |
36 std::vector<ModelSafeWorker*> workers; | 37 std::vector<ModelSafeWorker*> workers; |
37 GetWorkers(&workers); | 38 GetWorkers(&workers); |
38 return new SyncSession(context_.get(), this, SyncSourceInfo(), | 39 return new SyncSession(context_.get(), this, SyncSourceInfo(), |
39 routes_, workers); | 40 routes_, workers); |
40 } | 41 } |
41 | 42 |
42 virtual void SetUp() { | 43 virtual void SetUp() { |
43 context_.reset( | 44 context_.reset( |
44 new SyncSessionContext( | 45 new SyncSessionContext( |
45 NULL, NULL, this, &extensions_activity_monitor_, | 46 NULL, NULL, this, &extensions_activity_monitor_, |
| 47 &throttled_data_type_tracker_, |
46 std::vector<SyncEngineEventListener*>(), NULL, NULL)); | 48 std::vector<SyncEngineEventListener*>(), NULL, NULL)); |
47 routes_.clear(); | 49 routes_.clear(); |
48 routes_[syncable::BOOKMARKS] = GROUP_UI; | 50 routes_[syncable::BOOKMARKS] = GROUP_UI; |
49 routes_[syncable::AUTOFILL] = GROUP_DB; | 51 routes_[syncable::AUTOFILL] = GROUP_DB; |
50 scoped_refptr<ModelSafeWorker> passive_worker( | 52 scoped_refptr<ModelSafeWorker> passive_worker( |
51 new FakeModelWorker(GROUP_PASSIVE)); | 53 new FakeModelWorker(GROUP_PASSIVE)); |
52 scoped_refptr<ModelSafeWorker> ui_worker( | 54 scoped_refptr<ModelSafeWorker> ui_worker( |
53 new FakeModelWorker(GROUP_UI)); | 55 new FakeModelWorker(GROUP_UI)); |
54 scoped_refptr<ModelSafeWorker> db_worker( | 56 scoped_refptr<ModelSafeWorker> db_worker( |
55 new FakeModelWorker(GROUP_DB)); | 57 new FakeModelWorker(GROUP_DB)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return syncable::ModelTypeSet(syncable::AUTOFILL); | 122 return syncable::ModelTypeSet(syncable::AUTOFILL); |
121 } | 123 } |
122 | 124 |
123 MessageLoop message_loop_; | 125 MessageLoop message_loop_; |
124 bool controller_invocations_allowed_; | 126 bool controller_invocations_allowed_; |
125 scoped_ptr<SyncSession> session_; | 127 scoped_ptr<SyncSession> session_; |
126 scoped_ptr<SyncSessionContext> context_; | 128 scoped_ptr<SyncSessionContext> context_; |
127 std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 129 std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
128 ModelSafeRoutingInfo routes_; | 130 ModelSafeRoutingInfo routes_; |
129 FakeExtensionsActivityMonitor extensions_activity_monitor_; | 131 FakeExtensionsActivityMonitor extensions_activity_monitor_; |
| 132 ThrottledDataTypeTracker throttled_data_type_tracker_; |
130 }; | 133 }; |
131 | 134 |
132 TEST_F(SyncSessionTest, EnabledGroupsEmpty) { | 135 TEST_F(SyncSessionTest, EnabledGroupsEmpty) { |
133 routes_.clear(); | 136 routes_.clear(); |
134 workers_.clear(); | 137 workers_.clear(); |
135 scoped_ptr<SyncSession> session(MakeSession()); | 138 scoped_ptr<SyncSession> session(MakeSession()); |
136 std::set<ModelSafeGroup> expected_enabled_groups; | 139 std::set<ModelSafeGroup> expected_enabled_groups; |
137 expected_enabled_groups.insert(GROUP_PASSIVE); | 140 expected_enabled_groups.insert(GROUP_PASSIVE); |
138 EXPECT_EQ(expected_enabled_groups, session->GetEnabledGroups()); | 141 EXPECT_EQ(expected_enabled_groups, session->GetEnabledGroups()); |
139 } | 142 } |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); | 526 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); |
524 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); | 527 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); |
525 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); | 528 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); |
526 EXPECT_EQ(payload2, original[syncable::SESSIONS]); | 529 EXPECT_EQ(payload2, original[syncable::SESSIONS]); |
527 EXPECT_EQ(payload3, original[syncable::THEMES]); | 530 EXPECT_EQ(payload3, original[syncable::THEMES]); |
528 } | 531 } |
529 | 532 |
530 } // namespace | 533 } // namespace |
531 } // namespace sessions | 534 } // namespace sessions |
532 } // namespace browser_sync | 535 } // namespace browser_sync |
OLD | NEW |