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 "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" | 5 #include "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} | 195 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} |
196 | 196 |
197 void CannedSyncableFileSystem::SetUp() { | 197 void CannedSyncableFileSystem::SetUp() { |
198 ASSERT_FALSE(is_filesystem_set_up_); | 198 ASSERT_FALSE(is_filesystem_set_up_); |
199 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 199 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
200 | 200 |
201 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 201 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
202 new quota::MockSpecialStoragePolicy(); | 202 new quota::MockSpecialStoragePolicy(); |
203 | 203 |
204 quota_manager_ = new QuotaManager( | 204 quota_manager_ = new QuotaManager(false /* is_incognito */, |
205 false /* is_incognito */, | 205 data_dir_.path(), |
206 data_dir_.path(), | 206 io_task_runner_.get(), |
207 io_task_runner_, | 207 base::MessageLoopProxy::current(), |
208 base::MessageLoopProxy::current(), | 208 storage_policy.get()); |
209 storage_policy); | |
210 | 209 |
211 file_system_context_ = new FileSystemContext( | 210 file_system_context_ = new FileSystemContext( |
212 make_scoped_ptr(new fileapi::FileSystemTaskRunners( | 211 make_scoped_ptr( |
213 io_task_runner_, | 212 new fileapi::FileSystemTaskRunners(io_task_runner_.get(), |
214 file_task_runner_, | 213 file_task_runner_.get(), |
215 file_task_runner_)), | 214 file_task_runner_.get())), |
216 fileapi::ExternalMountPoints::CreateRefCounted().get(), | 215 fileapi::ExternalMountPoints::CreateRefCounted().get(), |
217 storage_policy, | 216 storage_policy.get(), |
218 quota_manager_->proxy(), | 217 quota_manager_->proxy(), |
219 ScopedVector<fileapi::FileSystemMountPointProvider>(), | 218 ScopedVector<fileapi::FileSystemMountPointProvider>(), |
220 data_dir_.path(), | 219 data_dir_.path(), |
221 fileapi::CreateAllowFileAccessOptions()); | 220 fileapi::CreateAllowFileAccessOptions()); |
222 | 221 |
223 // In testing we override this setting to support directory operations | 222 // In testing we override this setting to support directory operations |
224 // by default. | 223 // by default. |
225 SetEnableSyncFSDirectoryOperation(true); | 224 SetEnableSyncFSDirectoryOperation(true); |
226 | 225 |
227 is_filesystem_set_up_ = true; | 226 is_filesystem_set_up_ = true; |
228 } | 227 } |
229 | 228 |
230 void CannedSyncableFileSystem::TearDown() { | 229 void CannedSyncableFileSystem::TearDown() { |
231 quota_manager_ = NULL; | 230 quota_manager_ = NULL; |
232 file_system_context_ = NULL; | 231 file_system_context_ = NULL; |
233 SetEnableSyncFSDirectoryOperation(false); | 232 SetEnableSyncFSDirectoryOperation(false); |
234 | 233 |
235 // Make sure we give some more time to finish tasks on other threads. | 234 // Make sure we give some more time to finish tasks on other threads. |
236 EnsureLastTaskRuns(io_task_runner_); | 235 EnsureLastTaskRuns(io_task_runner_.get()); |
237 EnsureLastTaskRuns(file_task_runner_); | 236 EnsureLastTaskRuns(file_task_runner_.get()); |
238 } | 237 } |
239 | 238 |
240 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { | 239 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { |
241 EXPECT_TRUE(is_filesystem_set_up_); | 240 EXPECT_TRUE(is_filesystem_set_up_); |
242 EXPECT_TRUE(is_filesystem_opened_); | 241 EXPECT_TRUE(is_filesystem_opened_); |
243 | 242 |
244 GURL url(root_url_.spec() + path); | 243 GURL url(root_url_.spec() + path); |
245 return file_system_context_->CrackURL(url); | 244 return file_system_context_->CrackURL(url); |
246 } | 245 } |
247 | 246 |
248 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { | 247 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { |
249 EXPECT_TRUE(is_filesystem_set_up_); | 248 EXPECT_TRUE(is_filesystem_set_up_); |
250 EXPECT_FALSE(is_filesystem_opened_); | 249 EXPECT_FALSE(is_filesystem_opened_); |
251 file_system_context_->OpenSyncableFileSystem( | 250 file_system_context_->OpenSyncableFileSystem( |
252 service_name_, origin_, type_, | 251 service_name_, origin_, type_, |
253 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 252 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
254 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, | 253 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, |
255 base::Unretained(this))); | 254 base::Unretained(this))); |
256 base::MessageLoop::current()->Run(); | 255 base::MessageLoop::current()->Run(); |
257 if (file_system_context_->sync_context()) { | 256 if (file_system_context_->sync_context()) { |
258 // Register 'this' as a sync status observer. | 257 // Register 'this' as a sync status observer. |
259 RunOnThread(io_task_runner_, | 258 RunOnThread( |
260 FROM_HERE, | 259 io_task_runner_.get(), |
261 base::Bind( | 260 FROM_HERE, |
262 &CannedSyncableFileSystem::InitializeSyncStatusObserver, | 261 base::Bind(&CannedSyncableFileSystem::InitializeSyncStatusObserver, |
263 base::Unretained(this))); | 262 base::Unretained(this))); |
264 } | 263 } |
265 return result_; | 264 return result_; |
266 } | 265 } |
267 | 266 |
268 void CannedSyncableFileSystem::AddSyncStatusObserver( | 267 void CannedSyncableFileSystem::AddSyncStatusObserver( |
269 LocalFileSyncStatus::Observer* observer) { | 268 LocalFileSyncStatus::Observer* observer) { |
270 sync_status_observers_->AddObserver(observer); | 269 sync_status_observers_->AddObserver(observer); |
271 } | 270 } |
272 | 271 |
273 void CannedSyncableFileSystem::RemoveSyncStatusObserver( | 272 void CannedSyncableFileSystem::RemoveSyncStatusObserver( |
274 LocalFileSyncStatus::Observer* observer) { | 273 LocalFileSyncStatus::Observer* observer) { |
275 sync_status_observers_->RemoveObserver(observer); | 274 sync_status_observers_->RemoveObserver(observer); |
276 } | 275 } |
277 | 276 |
278 SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext( | 277 SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext( |
279 LocalFileSyncContext* sync_context) { | 278 LocalFileSyncContext* sync_context) { |
280 DCHECK(sync_context); | 279 DCHECK(sync_context); |
281 sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN; | 280 sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN; |
282 VerifySameTaskRunner(io_task_runner_, sync_context->io_task_runner_); | 281 VerifySameTaskRunner(io_task_runner_.get(), |
| 282 sync_context->io_task_runner_.get()); |
283 sync_context->MaybeInitializeFileSystemContext( | 283 sync_context->MaybeInitializeFileSystemContext( |
284 origin_, service_name_, file_system_context_, | 284 origin_, |
| 285 service_name_, |
| 286 file_system_context_.get(), |
285 base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext, | 287 base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext, |
286 base::Unretained(this))); | 288 base::Unretained(this))); |
287 base::MessageLoop::current()->Run(); | 289 base::MessageLoop::current()->Run(); |
288 return sync_status_; | 290 return sync_status_; |
289 } | 291 } |
290 | 292 |
291 PlatformFileError CannedSyncableFileSystem::CreateDirectory( | 293 PlatformFileError CannedSyncableFileSystem::CreateDirectory( |
292 const FileSystemURL& url) { | 294 const FileSystemURL& url) { |
293 return RunOnThread<PlatformFileError>( | 295 return RunOnThread<PlatformFileError>( |
294 io_task_runner_, | 296 io_task_runner_.get(), |
295 FROM_HERE, | 297 FROM_HERE, |
296 base::Bind(&CannedSyncableFileSystem::DoCreateDirectory, | 298 base::Bind(&CannedSyncableFileSystem::DoCreateDirectory, |
297 base::Unretained(this), url)); | 299 base::Unretained(this), |
| 300 url)); |
298 } | 301 } |
299 | 302 |
300 PlatformFileError CannedSyncableFileSystem::CreateFile( | 303 PlatformFileError CannedSyncableFileSystem::CreateFile( |
301 const FileSystemURL& url) { | 304 const FileSystemURL& url) { |
302 return RunOnThread<PlatformFileError>( | 305 return RunOnThread<PlatformFileError>( |
303 io_task_runner_, | 306 io_task_runner_.get(), |
304 FROM_HERE, | 307 FROM_HERE, |
305 base::Bind(&CannedSyncableFileSystem::DoCreateFile, | 308 base::Bind(&CannedSyncableFileSystem::DoCreateFile, |
306 base::Unretained(this), url)); | 309 base::Unretained(this), |
| 310 url)); |
307 } | 311 } |
308 | 312 |
309 PlatformFileError CannedSyncableFileSystem::Copy( | 313 PlatformFileError CannedSyncableFileSystem::Copy( |
310 const FileSystemURL& src_url, const FileSystemURL& dest_url) { | 314 const FileSystemURL& src_url, const FileSystemURL& dest_url) { |
311 return RunOnThread<PlatformFileError>( | 315 return RunOnThread<PlatformFileError>( |
312 io_task_runner_, | 316 io_task_runner_.get(), |
313 FROM_HERE, | 317 FROM_HERE, |
314 base::Bind(&CannedSyncableFileSystem::DoCopy, | 318 base::Bind(&CannedSyncableFileSystem::DoCopy, |
315 base::Unretained(this), src_url, dest_url)); | 319 base::Unretained(this), |
| 320 src_url, |
| 321 dest_url)); |
316 } | 322 } |
317 | 323 |
318 PlatformFileError CannedSyncableFileSystem::Move( | 324 PlatformFileError CannedSyncableFileSystem::Move( |
319 const FileSystemURL& src_url, const FileSystemURL& dest_url) { | 325 const FileSystemURL& src_url, const FileSystemURL& dest_url) { |
320 return RunOnThread<PlatformFileError>( | 326 return RunOnThread<PlatformFileError>( |
321 io_task_runner_, | 327 io_task_runner_.get(), |
322 FROM_HERE, | 328 FROM_HERE, |
323 base::Bind(&CannedSyncableFileSystem::DoMove, | 329 base::Bind(&CannedSyncableFileSystem::DoMove, |
324 base::Unretained(this), src_url, dest_url)); | 330 base::Unretained(this), |
| 331 src_url, |
| 332 dest_url)); |
325 } | 333 } |
326 | 334 |
327 PlatformFileError CannedSyncableFileSystem::TruncateFile( | 335 PlatformFileError CannedSyncableFileSystem::TruncateFile( |
328 const FileSystemURL& url, int64 size) { | 336 const FileSystemURL& url, int64 size) { |
329 return RunOnThread<PlatformFileError>( | 337 return RunOnThread<PlatformFileError>( |
330 io_task_runner_, | 338 io_task_runner_.get(), |
331 FROM_HERE, | 339 FROM_HERE, |
332 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, | 340 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, |
333 base::Unretained(this), url, size)); | 341 base::Unretained(this), |
| 342 url, |
| 343 size)); |
334 } | 344 } |
335 | 345 |
336 PlatformFileError CannedSyncableFileSystem::TouchFile( | 346 PlatformFileError CannedSyncableFileSystem::TouchFile( |
337 const FileSystemURL& url, | 347 const FileSystemURL& url, |
338 const base::Time& last_access_time, | 348 const base::Time& last_access_time, |
339 const base::Time& last_modified_time) { | 349 const base::Time& last_modified_time) { |
340 return RunOnThread<PlatformFileError>( | 350 return RunOnThread<PlatformFileError>( |
341 io_task_runner_, | 351 io_task_runner_.get(), |
342 FROM_HERE, | 352 FROM_HERE, |
343 base::Bind(&CannedSyncableFileSystem::DoTouchFile, | 353 base::Bind(&CannedSyncableFileSystem::DoTouchFile, |
344 base::Unretained(this), url, | 354 base::Unretained(this), |
345 last_access_time, last_modified_time)); | 355 url, |
| 356 last_access_time, |
| 357 last_modified_time)); |
346 } | 358 } |
347 | 359 |
348 PlatformFileError CannedSyncableFileSystem::Remove( | 360 PlatformFileError CannedSyncableFileSystem::Remove( |
349 const FileSystemURL& url, bool recursive) { | 361 const FileSystemURL& url, bool recursive) { |
350 return RunOnThread<PlatformFileError>( | 362 return RunOnThread<PlatformFileError>( |
351 io_task_runner_, | 363 io_task_runner_.get(), |
352 FROM_HERE, | 364 FROM_HERE, |
353 base::Bind(&CannedSyncableFileSystem::DoRemove, | 365 base::Bind(&CannedSyncableFileSystem::DoRemove, |
354 base::Unretained(this), url, recursive)); | 366 base::Unretained(this), |
| 367 url, |
| 368 recursive)); |
355 } | 369 } |
356 | 370 |
357 PlatformFileError CannedSyncableFileSystem::FileExists( | 371 PlatformFileError CannedSyncableFileSystem::FileExists( |
358 const FileSystemURL& url) { | 372 const FileSystemURL& url) { |
359 return RunOnThread<PlatformFileError>( | 373 return RunOnThread<PlatformFileError>( |
360 io_task_runner_, | 374 io_task_runner_.get(), |
361 FROM_HERE, | 375 FROM_HERE, |
362 base::Bind(&CannedSyncableFileSystem::DoFileExists, | 376 base::Bind(&CannedSyncableFileSystem::DoFileExists, |
363 base::Unretained(this), url)); | 377 base::Unretained(this), |
| 378 url)); |
364 } | 379 } |
365 | 380 |
366 PlatformFileError CannedSyncableFileSystem::DirectoryExists( | 381 PlatformFileError CannedSyncableFileSystem::DirectoryExists( |
367 const FileSystemURL& url) { | 382 const FileSystemURL& url) { |
368 return RunOnThread<PlatformFileError>( | 383 return RunOnThread<PlatformFileError>( |
369 io_task_runner_, | 384 io_task_runner_.get(), |
370 FROM_HERE, | 385 FROM_HERE, |
371 base::Bind(&CannedSyncableFileSystem::DoDirectoryExists, | 386 base::Bind(&CannedSyncableFileSystem::DoDirectoryExists, |
372 base::Unretained(this), url)); | 387 base::Unretained(this), |
| 388 url)); |
373 } | 389 } |
374 | 390 |
375 PlatformFileError CannedSyncableFileSystem::VerifyFile( | 391 PlatformFileError CannedSyncableFileSystem::VerifyFile( |
376 const FileSystemURL& url, | 392 const FileSystemURL& url, |
377 const std::string& expected_data) { | 393 const std::string& expected_data) { |
378 return RunOnThread<PlatformFileError>( | 394 return RunOnThread<PlatformFileError>( |
379 io_task_runner_, | 395 io_task_runner_.get(), |
380 FROM_HERE, | 396 FROM_HERE, |
381 base::Bind(&CannedSyncableFileSystem::DoVerifyFile, | 397 base::Bind(&CannedSyncableFileSystem::DoVerifyFile, |
382 base::Unretained(this), url, expected_data)); | 398 base::Unretained(this), |
| 399 url, |
| 400 expected_data)); |
383 } | 401 } |
384 | 402 |
385 PlatformFileError CannedSyncableFileSystem::GetMetadata( | 403 PlatformFileError CannedSyncableFileSystem::GetMetadata( |
386 const FileSystemURL& url, | 404 const FileSystemURL& url, |
387 base::PlatformFileInfo* info, | 405 base::PlatformFileInfo* info, |
388 base::FilePath* platform_path) { | 406 base::FilePath* platform_path) { |
389 return RunOnThread<PlatformFileError>( | 407 return RunOnThread<PlatformFileError>( |
390 io_task_runner_, | 408 io_task_runner_.get(), |
391 FROM_HERE, | 409 FROM_HERE, |
392 base::Bind(&CannedSyncableFileSystem::DoGetMetadata, | 410 base::Bind(&CannedSyncableFileSystem::DoGetMetadata, |
393 base::Unretained(this), url, info, platform_path)); | 411 base::Unretained(this), |
| 412 url, |
| 413 info, |
| 414 platform_path)); |
394 } | 415 } |
395 | 416 |
396 int64 CannedSyncableFileSystem::Write( | 417 int64 CannedSyncableFileSystem::Write( |
397 net::URLRequestContext* url_request_context, | 418 net::URLRequestContext* url_request_context, |
398 const FileSystemURL& url, const GURL& blob_url) { | 419 const FileSystemURL& url, const GURL& blob_url) { |
399 return RunOnThread<int64>( | 420 return RunOnThread<int64>(io_task_runner_.get(), |
400 io_task_runner_, | 421 FROM_HERE, |
401 FROM_HERE, | 422 base::Bind(&CannedSyncableFileSystem::DoWrite, |
402 base::Bind(&CannedSyncableFileSystem::DoWrite, | 423 base::Unretained(this), |
403 base::Unretained(this), url_request_context, url, blob_url)); | 424 url_request_context, |
| 425 url, |
| 426 blob_url)); |
404 } | 427 } |
405 | 428 |
406 int64 CannedSyncableFileSystem::WriteString( | 429 int64 CannedSyncableFileSystem::WriteString( |
407 const FileSystemURL& url, const std::string& data) { | 430 const FileSystemURL& url, const std::string& data) { |
408 return RunOnThread<int64>( | 431 return RunOnThread<int64>(io_task_runner_.get(), |
409 io_task_runner_, | 432 FROM_HERE, |
410 FROM_HERE, | 433 base::Bind(&CannedSyncableFileSystem::DoWriteString, |
411 base::Bind(&CannedSyncableFileSystem::DoWriteString, | 434 base::Unretained(this), |
412 base::Unretained(this), url, data)); | 435 url, |
| 436 data)); |
413 } | 437 } |
414 | 438 |
415 PlatformFileError CannedSyncableFileSystem::DeleteFileSystem() { | 439 PlatformFileError CannedSyncableFileSystem::DeleteFileSystem() { |
416 EXPECT_TRUE(is_filesystem_set_up_); | 440 EXPECT_TRUE(is_filesystem_set_up_); |
417 return RunOnThread<PlatformFileError>( | 441 return RunOnThread<PlatformFileError>( |
418 io_task_runner_, | 442 io_task_runner_.get(), |
419 FROM_HERE, | 443 FROM_HERE, |
420 base::Bind(&FileSystemContext::DeleteFileSystem, | 444 base::Bind(&FileSystemContext::DeleteFileSystem, |
421 file_system_context_, origin_, type_)); | 445 file_system_context_, |
| 446 origin_, |
| 447 type_)); |
422 } | 448 } |
423 | 449 |
424 quota::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota( | 450 quota::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota( |
425 int64* usage, int64* quota) { | 451 int64* usage, int64* quota) { |
426 return RunOnThread<quota::QuotaStatusCode>( | 452 return RunOnThread<quota::QuotaStatusCode>( |
427 io_task_runner_, | 453 io_task_runner_.get(), |
428 FROM_HERE, | 454 FROM_HERE, |
429 base::Bind(&CannedSyncableFileSystem::DoGetUsageAndQuota, | 455 base::Bind(&CannedSyncableFileSystem::DoGetUsageAndQuota, |
430 base::Unretained(this), usage, quota)); | 456 base::Unretained(this), |
| 457 usage, |
| 458 quota)); |
431 } | 459 } |
432 | 460 |
433 void CannedSyncableFileSystem::GetChangedURLsInTracker( | 461 void CannedSyncableFileSystem::GetChangedURLsInTracker( |
434 FileSystemURLSet* urls) { | 462 FileSystemURLSet* urls) { |
435 return RunOnThread( | 463 return RunOnThread( |
436 file_task_runner_, | 464 file_task_runner_.get(), |
437 FROM_HERE, | 465 FROM_HERE, |
438 base::Bind(&LocalFileChangeTracker::GetAllChangedURLs, | 466 base::Bind(&LocalFileChangeTracker::GetAllChangedURLs, |
439 base::Unretained(file_system_context_->change_tracker()), | 467 base::Unretained(file_system_context_->change_tracker()), |
440 urls)); | 468 urls)); |
441 } | 469 } |
442 | 470 |
443 void CannedSyncableFileSystem::ClearChangeForURLInTracker( | 471 void CannedSyncableFileSystem::ClearChangeForURLInTracker( |
444 const FileSystemURL& url) { | 472 const FileSystemURL& url) { |
445 return RunOnThread( | 473 return RunOnThread( |
446 file_task_runner_, | 474 file_task_runner_.get(), |
447 FROM_HERE, | 475 FROM_HERE, |
448 base::Bind(&LocalFileChangeTracker::ClearChangesForURL, | 476 base::Bind(&LocalFileChangeTracker::ClearChangesForURL, |
449 base::Unretained(file_system_context_->change_tracker()), | 477 base::Unretained(file_system_context_->change_tracker()), |
450 url)); | 478 url)); |
451 } | 479 } |
452 | 480 |
453 FileSystemOperation* CannedSyncableFileSystem::NewOperation() { | 481 FileSystemOperation* CannedSyncableFileSystem::NewOperation() { |
454 return file_system_context_->CreateFileSystemOperation(URL(std::string()), | 482 return file_system_context_->CreateFileSystemOperation(URL(std::string()), |
455 NULL); | 483 NULL); |
456 } | 484 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 NewOperation()->Write(url_request_context, url, blob_url, 0, | 589 NewOperation()->Write(url_request_context, url, blob_url, 0, |
562 base::Bind(&WriteHelper::DidWrite, | 590 base::Bind(&WriteHelper::DidWrite, |
563 base::Owned(helper), callback)); | 591 base::Owned(helper), callback)); |
564 } | 592 } |
565 | 593 |
566 void CannedSyncableFileSystem::DoWriteString( | 594 void CannedSyncableFileSystem::DoWriteString( |
567 const FileSystemURL& url, | 595 const FileSystemURL& url, |
568 const std::string& data, | 596 const std::string& data, |
569 const WriteCallback& callback) { | 597 const WriteCallback& callback) { |
570 MockBlobURLRequestContext* url_request_context( | 598 MockBlobURLRequestContext* url_request_context( |
571 new MockBlobURLRequestContext(file_system_context_)); | 599 new MockBlobURLRequestContext(file_system_context_.get())); |
572 const GURL blob_url(std::string("blob:") + data); | 600 const GURL blob_url(std::string("blob:") + data); |
573 WriteHelper* helper = new WriteHelper(url_request_context, blob_url, data); | 601 WriteHelper* helper = new WriteHelper(url_request_context, blob_url, data); |
574 NewOperation()->Write(url_request_context, url, blob_url, 0, | 602 NewOperation()->Write(url_request_context, url, blob_url, 0, |
575 base::Bind(&WriteHelper::DidWrite, | 603 base::Bind(&WriteHelper::DidWrite, |
576 base::Owned(helper), callback)); | 604 base::Owned(helper), callback)); |
577 } | 605 } |
578 | 606 |
579 void CannedSyncableFileSystem::DoGetUsageAndQuota( | 607 void CannedSyncableFileSystem::DoGetUsageAndQuota( |
580 int64* usage, | 608 int64* usage, |
581 int64* quota, | 609 int64* quota, |
(...skipping 16 matching lines...) Expand all Loading... |
598 sync_status_ = status; | 626 sync_status_ = status; |
599 base::MessageLoop::current()->Quit(); | 627 base::MessageLoop::current()->Quit(); |
600 } | 628 } |
601 | 629 |
602 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 630 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
603 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 631 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
604 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 632 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
605 } | 633 } |
606 | 634 |
607 } // namespace sync_file_system | 635 } // namespace sync_file_system |
OLD | NEW |