| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class ProfileSyncServiceSessionTest | 53 class ProfileSyncServiceSessionTest |
| 54 : public BrowserWithTestWindowTest, | 54 : public BrowserWithTestWindowTest, |
| 55 public NotificationObserver { | 55 public NotificationObserver { |
| 56 public: | 56 public: |
| 57 ProfileSyncServiceSessionTest() | 57 ProfileSyncServiceSessionTest() |
| 58 : window_bounds_(0, 1, 2, 3), | 58 : window_bounds_(0, 1, 2, 3), |
| 59 notified_of_update_(false) {} | 59 notified_of_update_(false) {} |
| 60 | 60 |
| 61 ProfileSyncService* sync_service() { return sync_service_.get(); } | 61 ProfileSyncService* sync_service() { return sync_service_.get(); } |
| 62 | 62 |
| 63 TestIdFactory* ids() { return &ids_; } | 63 TestIdFactory* ids() { return sync_service_->id_factory(); } |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 SessionService* service() { return helper_.service(); } | 66 SessionService* service() { return helper_.service(); } |
| 67 | 67 |
| 68 virtual void SetUp() { | 68 virtual void SetUp() { |
| 69 BrowserWithTestWindowTest::SetUp(); | 69 BrowserWithTestWindowTest::SetUp(); |
| 70 profile()->set_has_history_service(true); | 70 profile()->set_has_history_service(true); |
| 71 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 71 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 72 SessionService* session_service = new SessionService(temp_dir_.path()); | 72 SessionService* session_service = new SessionService(temp_dir_.path()); |
| 73 helper_.set_service(session_service); | 73 helper_.set_service(session_service); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 SyncBackendHost* backend() { return sync_service_->backend(); } | 127 SyncBackendHost* backend() { return sync_service_->backend(); } |
| 128 | 128 |
| 129 // Path used in testing. | 129 // Path used in testing. |
| 130 ScopedTempDir temp_dir_; | 130 ScopedTempDir temp_dir_; |
| 131 SessionServiceTestHelper helper_; | 131 SessionServiceTestHelper helper_; |
| 132 SessionModelAssociator* model_associator_; | 132 SessionModelAssociator* model_associator_; |
| 133 SessionChangeProcessor* change_processor_; | 133 SessionChangeProcessor* change_processor_; |
| 134 SessionID window_id_; | 134 SessionID window_id_; |
| 135 ProfileSyncFactoryMock factory_; | 135 ProfileSyncFactoryMock factory_; |
| 136 scoped_ptr<TestProfileSyncService> sync_service_; | 136 scoped_ptr<TestProfileSyncService> sync_service_; |
| 137 TestIdFactory ids_; | |
| 138 const gfx::Rect window_bounds_; | 137 const gfx::Rect window_bounds_; |
| 139 bool notified_of_update_; | 138 bool notified_of_update_; |
| 140 NotificationRegistrar registrar_; | 139 NotificationRegistrar registrar_; |
| 141 }; | 140 }; |
| 142 | 141 |
| 143 class CreateRootTask : public Task { | 142 class CreateRootTask : public Task { |
| 144 public: | 143 public: |
| 145 explicit CreateRootTask(ProfileSyncServiceSessionTest* test) | 144 explicit CreateRootTask(ProfileSyncServiceSessionTest* test) |
| 146 : test_(test), success_(false) { | 145 : test_(test), success_(false) { |
| 147 } | 146 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 ASSERT_FALSE(notified_of_update_); | 394 ASSERT_FALSE(notified_of_update_); |
| 396 { | 395 { |
| 397 sync_api::WriteTransaction trans(backend()->GetUserShareHandle()); | 396 sync_api::WriteTransaction trans(backend()->GetUserShareHandle()); |
| 398 change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1); | 397 change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1); |
| 399 } | 398 } |
| 400 ASSERT_TRUE(notified_of_update_); | 399 ASSERT_TRUE(notified_of_update_); |
| 401 } | 400 } |
| 402 | 401 |
| 403 } // namespace browser_sync | 402 } // namespace browser_sync |
| 404 | 403 |
| OLD | NEW |