OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drive_file_system.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
14 #include "base/json/json_file_value_serializer.h" | 14 #include "base/json/json_file_value_serializer.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 20 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
21 #include "chrome/browser/chromeos/drive/drive.pb.h" | 21 #include "chrome/browser/chromeos/drive/drive.pb.h" |
22 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 22 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
23 #include "chrome/browser/chromeos/drive/drive_scheduler.h" | |
24 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" | 23 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" |
25 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 24 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 25 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
26 #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h" | 26 #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h" |
27 #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h" | 27 #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h" |
28 #include "chrome/browser/chromeos/drive/test_util.h" | 28 #include "chrome/browser/chromeos/drive/test_util.h" |
29 #include "chrome/browser/google_apis/drive_api_parser.h" | 29 #include "chrome/browser/google_apis/drive_api_parser.h" |
30 #include "chrome/browser/google_apis/fake_drive_service.h" | 30 #include "chrome/browser/google_apis/fake_drive_service.h" |
31 #include "chrome/browser/google_apis/test_util.h" | 31 #include "chrome/browser/google_apis/test_util.h" |
32 #include "chrome/test/base/testing_profile.h" | 32 #include "chrome/test/base/testing_profile.h" |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/test/test_browser_thread.h" | 34 #include "content/public/test/test_browser_thread.h" |
35 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // The fake object will be manually deleted in TearDown(). | 128 // The fake object will be manually deleted in TearDown(). |
129 fake_drive_service_.reset(new google_apis::FakeDriveService); | 129 fake_drive_service_.reset(new google_apis::FakeDriveService); |
130 fake_drive_service_->LoadResourceListForWapi( | 130 fake_drive_service_->LoadResourceListForWapi( |
131 "chromeos/gdata/root_feed.json"); | 131 "chromeos/gdata/root_feed.json"); |
132 fake_drive_service_->LoadAccountMetadataForWapi( | 132 fake_drive_service_->LoadAccountMetadataForWapi( |
133 "chromeos/gdata/account_metadata.json"); | 133 "chromeos/gdata/account_metadata.json"); |
134 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json"); | 134 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json"); |
135 | 135 |
136 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); | 136 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); |
137 | 137 |
138 scheduler_.reset(new DriveScheduler(profile_.get(), | 138 scheduler_.reset(new JobScheduler(profile_.get(), |
139 fake_drive_service_.get())); | 139 fake_drive_service_.get())); |
140 | 140 |
141 scoped_refptr<base::SequencedWorkerPool> pool = | 141 scoped_refptr<base::SequencedWorkerPool> pool = |
142 content::BrowserThread::GetBlockingPool(); | 142 content::BrowserThread::GetBlockingPool(); |
143 blocking_task_runner_ = | 143 blocking_task_runner_ = |
144 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 144 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
145 | 145 |
146 cache_.reset(new DriveCache(DriveCache::GetCacheRootPath(profile_.get()), | 146 cache_.reset(new DriveCache(DriveCache::GetCacheRootPath(profile_.get()), |
147 blocking_task_runner_, | 147 blocking_task_runner_, |
148 fake_free_disk_space_getter_.get())); | 148 fake_free_disk_space_getter_.get())); |
149 | 149 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 | 443 |
444 MessageLoopForUI message_loop_; | 444 MessageLoopForUI message_loop_; |
445 content::TestBrowserThread ui_thread_; | 445 content::TestBrowserThread ui_thread_; |
446 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 446 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
447 scoped_ptr<TestingProfile> profile_; | 447 scoped_ptr<TestingProfile> profile_; |
448 | 448 |
449 scoped_ptr<DriveCache, test_util::DestroyHelperForTests> cache_; | 449 scoped_ptr<DriveCache, test_util::DestroyHelperForTests> cache_; |
450 scoped_ptr<DriveFileSystem> file_system_; | 450 scoped_ptr<DriveFileSystem> file_system_; |
451 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; | 451 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; |
452 scoped_ptr<DriveScheduler> scheduler_; | 452 scoped_ptr<JobScheduler> scheduler_; |
453 scoped_ptr<DriveWebAppsRegistry> drive_webapps_registry_; | 453 scoped_ptr<DriveWebAppsRegistry> drive_webapps_registry_; |
454 scoped_ptr<DriveResourceMetadata, test_util::DestroyHelperForTests> | 454 scoped_ptr<DriveResourceMetadata, test_util::DestroyHelperForTests> |
455 resource_metadata_; | 455 resource_metadata_; |
456 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; | 456 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; |
457 scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_; | 457 scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_; |
458 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; | 458 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; |
459 | 459 |
460 int root_feed_changestamp_; | 460 int root_feed_changestamp_; |
461 }; | 461 }; |
462 | 462 |
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 entry->resource_id(), | 2192 entry->resource_id(), |
2193 entry->file_specific_info().file_md5(), | 2193 entry->file_specific_info().file_md5(), |
2194 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); | 2194 google_apis::test_util::CreateCopyResultCallback(&success, &cache_entry)); |
2195 google_apis::test_util::RunBlockingPoolTask(); | 2195 google_apis::test_util::RunBlockingPoolTask(); |
2196 | 2196 |
2197 EXPECT_TRUE(success); | 2197 EXPECT_TRUE(success); |
2198 EXPECT_FALSE(cache_entry.is_mounted()); | 2198 EXPECT_FALSE(cache_entry.is_mounted()); |
2199 } | 2199 } |
2200 | 2200 |
2201 } // namespace drive | 2201 } // namespace drive |
OLD | NEW |