| 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/chromeos/drive/file_system/operation_test_base.h" | 5 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
| 6 | 6 |
| 7 #include "base/threading/sequenced_worker_pool.h" | 7 #include "base/threading/sequenced_worker_pool.h" |
| 8 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 8 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| 9 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 9 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 10 #include "chrome/browser/chromeos/drive/file_cache.h" | 10 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 11 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 11 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| 12 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 12 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 13 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 13 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| 14 #include "chrome/browser/chromeos/drive/test_util.h" | 14 #include "chrome/browser/chromeos/drive/test_util.h" |
| 15 #include "chrome/browser/google_apis/fake_drive_service.h" | 15 #include "chrome/browser/google_apis/fake_drive_service.h" |
| 16 #include "chrome/browser/google_apis/test_util.h" | 16 #include "chrome/browser/google_apis/test_util.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 18 | 18 |
| 19 namespace drive { | 19 namespace drive { |
| 20 namespace file_system { | 20 namespace file_system { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 const int64 kLotsOfSpace = internal::kMinFreeSpace * 10; | 23 const int64 kLotsOfSpace = internal::kMinFreeSpace * 10; |
| 24 } | 24 } |
| 25 | 25 |
| 26 OperationTestBase::LoggingObserver::LoggingObserver() { |
| 27 } |
| 28 |
| 29 OperationTestBase::LoggingObserver::~LoggingObserver() { |
| 30 } |
| 31 |
| 32 void OperationTestBase::LoggingObserver::OnDirectoryChangedByOperation( |
| 33 const base::FilePath& path) { |
| 34 changed_paths_.insert(path); |
| 35 } |
| 36 |
| 26 OperationTestBase::OperationTestBase() | 37 OperationTestBase::OperationTestBase() |
| 27 : ui_thread_(content::BrowserThread::UI, &message_loop_) { | 38 : ui_thread_(content::BrowserThread::UI, &message_loop_) { |
| 28 } | 39 } |
| 29 | 40 |
| 30 OperationTestBase::~OperationTestBase() { | 41 OperationTestBase::~OperationTestBase() { |
| 31 } | 42 } |
| 32 | 43 |
| 33 void OperationTestBase::SetUp() { | 44 void OperationTestBase::SetUp() { |
| 34 scoped_refptr<base::SequencedWorkerPool> pool = | 45 scoped_refptr<base::SequencedWorkerPool> pool = |
| 35 content::BrowserThread::GetBlockingPool(); | 46 content::BrowserThread::GetBlockingPool(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 cache_.reset(); | 91 cache_.reset(); |
| 81 fake_free_disk_space_getter_.reset(); | 92 fake_free_disk_space_getter_.reset(); |
| 82 metadata_.reset(); | 93 metadata_.reset(); |
| 83 scheduler_.reset(); | 94 scheduler_.reset(); |
| 84 fake_drive_service_.reset(); | 95 fake_drive_service_.reset(); |
| 85 profile_.reset(); | 96 profile_.reset(); |
| 86 | 97 |
| 87 blocking_task_runner_ = NULL; | 98 blocking_task_runner_ = NULL; |
| 88 } | 99 } |
| 89 | 100 |
| 101 FileError OperationTestBase::GetLocalResourceEntry(const base::FilePath& path, |
| 102 ResourceEntry* entry) { |
| 103 FileError error = FILE_ERROR_FAILED; |
| 104 base::PostTaskAndReplyWithResult( |
| 105 blocking_task_runner(), |
| 106 FROM_HERE, |
| 107 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, |
| 108 base::Unretained(metadata()), path, entry), |
| 109 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error))); |
| 110 google_apis::test_util::RunBlockingPoolTask(); |
| 111 return error; |
| 112 } |
| 113 |
| 90 } // namespace file_system | 114 } // namespace file_system |
| 91 } // namespace drive | 115 } // namespace drive |
| OLD | NEW |