OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class ProfileSyncServiceSessionTest | 52 class ProfileSyncServiceSessionTest |
53 : public BrowserWithTestWindowTest, | 53 : public BrowserWithTestWindowTest, |
54 public NotificationObserver { | 54 public NotificationObserver { |
55 public: | 55 public: |
56 ProfileSyncServiceSessionTest() | 56 ProfileSyncServiceSessionTest() |
57 : window_bounds_(0, 1, 2, 3), | 57 : window_bounds_(0, 1, 2, 3), |
58 notified_of_update_(false) {} | 58 notified_of_update_(false) {} |
59 | 59 |
60 ProfileSyncService* sync_service() { return sync_service_.get(); } | 60 ProfileSyncService* sync_service() { return sync_service_.get(); } |
61 | 61 |
62 TestIdFactory* ids() { return &ids_; } | 62 TestIdFactory* ids() { return sync_service_->id_factory(); } |
63 | 63 |
64 protected: | 64 protected: |
65 SessionService* service() { return helper_.service(); } | 65 SessionService* service() { return helper_.service(); } |
66 | 66 |
67 virtual void SetUp() { | 67 virtual void SetUp() { |
68 BrowserWithTestWindowTest::SetUp(); | 68 BrowserWithTestWindowTest::SetUp(); |
69 profile()->set_has_history_service(true); | 69 profile()->set_has_history_service(true); |
70 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 70 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
71 SessionService* session_service = new SessionService(temp_dir_.path()); | 71 SessionService* session_service = new SessionService(temp_dir_.path()); |
72 helper_.set_service(session_service); | 72 helper_.set_service(session_service); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SyncBackendHost* backend() { return sync_service_->backend(); } | 126 SyncBackendHost* backend() { return sync_service_->backend(); } |
127 | 127 |
128 // Path used in testing. | 128 // Path used in testing. |
129 ScopedTempDir temp_dir_; | 129 ScopedTempDir temp_dir_; |
130 SessionServiceTestHelper helper_; | 130 SessionServiceTestHelper helper_; |
131 SessionModelAssociator* model_associator_; | 131 SessionModelAssociator* model_associator_; |
132 SessionChangeProcessor* change_processor_; | 132 SessionChangeProcessor* change_processor_; |
133 SessionID window_id_; | 133 SessionID window_id_; |
134 ProfileSyncFactoryMock factory_; | 134 ProfileSyncFactoryMock factory_; |
135 scoped_ptr<TestProfileSyncService> sync_service_; | 135 scoped_ptr<TestProfileSyncService> sync_service_; |
136 TestIdFactory ids_; | |
137 const gfx::Rect window_bounds_; | 136 const gfx::Rect window_bounds_; |
138 bool notified_of_update_; | 137 bool notified_of_update_; |
139 NotificationRegistrar registrar_; | 138 NotificationRegistrar registrar_; |
140 }; | 139 }; |
141 | 140 |
142 class CreateRootTask : public Task { | 141 class CreateRootTask : public Task { |
143 public: | 142 public: |
144 explicit CreateRootTask(ProfileSyncServiceSessionTest* test) | 143 explicit CreateRootTask(ProfileSyncServiceSessionTest* test) |
145 : test_(test), success_(false) { | 144 : test_(test), success_(false) { |
146 } | 145 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 ASSERT_FALSE(model_associator_->tab_pool_.full()); | 416 ASSERT_FALSE(model_associator_->tab_pool_.full()); |
418 for (size_t i = 0; i < num_ids; ++i) { | 417 for (size_t i = 0; i < num_ids; ++i) { |
419 model_associator_->tab_pool_.FreeTabNode(node_ids[i]); | 418 model_associator_->tab_pool_.FreeTabNode(node_ids[i]); |
420 } | 419 } |
421 ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity()); | 420 ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity()); |
422 ASSERT_FALSE(model_associator_->tab_pool_.empty()); | 421 ASSERT_FALSE(model_associator_->tab_pool_.empty()); |
423 ASSERT_TRUE(model_associator_->tab_pool_.full()); | 422 ASSERT_TRUE(model_associator_->tab_pool_.full()); |
424 } | 423 } |
425 | 424 |
426 } // namespace browser_sync | 425 } // namespace browser_sync |
OLD | NEW |