OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 local_sync_service_.reset(new LocalFileSyncService(&profile_)); | 139 local_sync_service_.reset(new LocalFileSyncService(&profile_)); |
140 | 140 |
141 fake_drive_service_ = new ::drive::FakeDriveService(); | 141 fake_drive_service_ = new ::drive::FakeDriveService(); |
142 fake_drive_service_->Initialize(&profile_); | 142 fake_drive_service_->Initialize(&profile_); |
143 ASSERT_TRUE(fake_drive_service_->LoadAccountMetadataForWapi( | 143 ASSERT_TRUE(fake_drive_service_->LoadAccountMetadataForWapi( |
144 "chromeos/sync_file_system/account_metadata.json")); | 144 "chromeos/sync_file_system/account_metadata.json")); |
145 ASSERT_TRUE(fake_drive_service_->LoadResourceListForWapi( | 145 ASSERT_TRUE(fake_drive_service_->LoadResourceListForWapi( |
146 "chromeos/gdata/root_feed.json")); | 146 "chromeos/gdata/root_feed.json")); |
147 | 147 |
148 drive_uploader_ = new ::drive::DriveUploader( | 148 drive_uploader_ = new ::drive::DriveUploader( |
149 fake_drive_service_, base::MessageLoopProxy::current()); | 149 fake_drive_service_, base::MessageLoopProxy::current().get()); |
150 | 150 |
151 bool done = false; | 151 bool done = false; |
152 SyncStatusCode status = SYNC_STATUS_UNKNOWN; | 152 SyncStatusCode status = SYNC_STATUS_UNKNOWN; |
153 bool created = false; | 153 bool created = false; |
154 scoped_ptr<DriveMetadataStore> metadata_store( | 154 scoped_ptr<DriveMetadataStore> metadata_store(new DriveMetadataStore( |
155 new DriveMetadataStore(base_dir_.path(), | 155 base_dir_.path(), base::MessageLoopProxy::current().get())); |
156 base::MessageLoopProxy::current())); | |
157 metadata_store->Initialize( | 156 metadata_store->Initialize( |
158 base::Bind(&DatabaseInitResultCallback, &done, &status, &created)); | 157 base::Bind(&DatabaseInitResultCallback, &done, &status, &created)); |
159 FlushMessageLoop(); | 158 FlushMessageLoop(); |
160 EXPECT_TRUE(done); | 159 EXPECT_TRUE(done); |
161 EXPECT_EQ(SYNC_STATUS_OK, status); | 160 EXPECT_EQ(SYNC_STATUS_OK, status); |
162 EXPECT_TRUE(created); | 161 EXPECT_TRUE(created); |
163 | 162 |
164 scoped_ptr<drive::APIUtil> api_util( | 163 scoped_ptr<drive::APIUtil> api_util( |
165 drive::APIUtil::CreateForTesting( | 164 drive::APIUtil::CreateForTesting( |
166 &profile_, | 165 &profile_, |
(...skipping 26 matching lines...) Expand all Loading... |
193 | 192 |
194 FlushMessageLoop(); | 193 FlushMessageLoop(); |
195 RevokeSyncableFileSystem(); | 194 RevokeSyncableFileSystem(); |
196 } | 195 } |
197 | 196 |
198 protected: | 197 protected: |
199 void RegisterOrigin(const GURL& origin) { | 198 void RegisterOrigin(const GURL& origin) { |
200 if (!ContainsKey(file_systems_, origin)) { | 199 if (!ContainsKey(file_systems_, origin)) { |
201 CannedSyncableFileSystem* file_system = new CannedSyncableFileSystem( | 200 CannedSyncableFileSystem* file_system = new CannedSyncableFileSystem( |
202 origin, | 201 origin, |
203 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 202 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 203 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
| 204 .get()); |
205 | 205 |
206 bool done = false; | 206 bool done = false; |
207 SyncStatusCode status = SYNC_STATUS_UNKNOWN; | 207 SyncStatusCode status = SYNC_STATUS_UNKNOWN; |
208 file_system->SetUp(); | 208 file_system->SetUp(); |
209 local_sync_service_->MaybeInitializeFileSystemContext( | 209 local_sync_service_->MaybeInitializeFileSystemContext( |
210 origin, file_system->file_system_context(), | 210 origin, file_system->file_system_context(), |
211 base::Bind(&SyncStatusResultCallback, &done, &status)); | 211 base::Bind(&SyncStatusResultCallback, &done, &status)); |
212 FlushMessageLoop(); | 212 FlushMessageLoop(); |
213 EXPECT_TRUE(done); | 213 EXPECT_TRUE(done); |
214 EXPECT_EQ(SYNC_STATUS_OK, status); | 214 EXPECT_EQ(SYNC_STATUS_OK, status); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 ASSERT_FALSE(IsDriveAPIDisabled()); | 784 ASSERT_FALSE(IsDriveAPIDisabled()); |
785 TestLocalFileDeletion(); | 785 TestLocalFileDeletion(); |
786 } | 786 } |
787 | 787 |
788 TEST_F(DriveFileSyncServiceSyncTest, LocalFileDeletionTest_WAPI) { | 788 TEST_F(DriveFileSyncServiceSyncTest, LocalFileDeletionTest_WAPI) { |
789 ScopedDisableDriveAPI disable_drive_api; | 789 ScopedDisableDriveAPI disable_drive_api; |
790 TestLocalFileDeletion(); | 790 TestLocalFileDeletion(); |
791 } | 791 } |
792 | 792 |
793 } // namespace sync_file_system | 793 } // namespace sync_file_system |
OLD | NEW |