| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/sync_file_system/drive_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 base_dir_ = base::FilePath(); | 158 base_dir_ = base::FilePath(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 void SetUpForTestCase() { | 162 void SetUpForTestCase() { |
| 163 fake_api_util_ = new drive::FakeAPIUtil; | 163 fake_api_util_ = new drive::FakeAPIUtil; |
| 164 fake_remote_processor_.reset(new FakeRemoteChangeProcessor); | 164 fake_remote_processor_.reset(new FakeRemoteChangeProcessor); |
| 165 | 165 |
| 166 metadata_store_ = new DriveMetadataStore( | 166 metadata_store_ = new DriveMetadataStore( |
| 167 base_dir_, | 167 base_dir_, base::MessageLoopProxy::current().get()); |
| 168 base::MessageLoopProxy::current()); | |
| 169 | 168 |
| 170 bool done = false; | 169 bool done = false; |
| 171 metadata_store_->Initialize(base::Bind(&DidInitialize, &done)); | 170 metadata_store_->Initialize(base::Bind(&DidInitialize, &done)); |
| 172 message_loop_.RunUntilIdle(); | 171 message_loop_.RunUntilIdle(); |
| 173 EXPECT_TRUE(done); | 172 EXPECT_TRUE(done); |
| 174 | 173 |
| 175 metadata_store_->SetSyncRootDirectory(kSyncRootResourceId); | 174 metadata_store_->SetSyncRootDirectory(kSyncRootResourceId); |
| 176 metadata_store_->AddIncrementalSyncOrigin(GURL(kAppOrigin), | 175 metadata_store_->AddIncrementalSyncOrigin(GURL(kAppOrigin), |
| 177 kParentResourceId); | 176 kParentResourceId); |
| 178 | 177 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 243 } |
| 245 | 244 |
| 246 void RelaunchService() { | 245 void RelaunchService() { |
| 247 metadata_store_ = NULL; | 246 metadata_store_ = NULL; |
| 248 scoped_ptr<drive::APIUtilInterface> api_util = | 247 scoped_ptr<drive::APIUtilInterface> api_util = |
| 249 DriveFileSyncService::DestroyAndPassAPIUtilForTesting( | 248 DriveFileSyncService::DestroyAndPassAPIUtilForTesting( |
| 250 sync_service_.Pass()); | 249 sync_service_.Pass()); |
| 251 message_loop_.RunUntilIdle(); | 250 message_loop_.RunUntilIdle(); |
| 252 | 251 |
| 253 metadata_store_ = new DriveMetadataStore( | 252 metadata_store_ = new DriveMetadataStore( |
| 254 base_dir_, | 253 base_dir_, base::MessageLoopProxy::current().get()); |
| 255 base::MessageLoopProxy::current()); | |
| 256 | 254 |
| 257 bool done = false; | 255 bool done = false; |
| 258 metadata_store_->Initialize(base::Bind(&DidInitialize, &done)); | 256 metadata_store_->Initialize(base::Bind(&DidInitialize, &done)); |
| 259 message_loop_.RunUntilIdle(); | 257 message_loop_.RunUntilIdle(); |
| 260 EXPECT_TRUE(done); | 258 EXPECT_TRUE(done); |
| 261 | 259 |
| 262 sync_service_ = DriveFileSyncService::CreateForTesting( | 260 sync_service_ = DriveFileSyncService::CreateForTesting( |
| 263 &profile_, | 261 &profile_, |
| 264 base_dir_, | 262 base_dir_, |
| 265 api_util.Pass(), | 263 api_util.Pass(), |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 TEST_F(DriveFileSyncServiceSyncTest, DeleteDirectoryTest) { | 434 TEST_F(DriveFileSyncServiceSyncTest, DeleteDirectoryTest) { |
| 437 std::string kDir = "dir title"; | 435 std::string kDir = "dir title"; |
| 438 SyncEvent sync_event[] = { | 436 SyncEvent sync_event[] = { |
| 439 CreateRemoteDirectoryAddEvent(kDir), | 437 CreateRemoteDirectoryAddEvent(kDir), |
| 440 CreateRemoteFileDeleteEvent(kDir), | 438 CreateRemoteFileDeleteEvent(kDir), |
| 441 }; | 439 }; |
| 442 RunTest(CreateTestCase(sync_event)); | 440 RunTest(CreateTestCase(sync_event)); |
| 443 } | 441 } |
| 444 | 442 |
| 445 } // namespace sync_file_system | 443 } // namespace sync_file_system |
| OLD | NEW |