Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc

Issue 14118006: Change owner of DriveScheduler from DriveFileSystem to DriveSystemService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/create_directory_operation_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/chromeos/drive/drive.pb.h" 16 #include "chrome/browser/chromeos/drive/drive.pb.h"
17 #include "chrome/browser/chromeos/drive/drive_file_system.h" 17 #include "chrome/browser/chromeos/drive/drive_file_system.h"
18 #include "chrome/browser/chromeos/drive/drive_scheduler.h"
18 #include "chrome/browser/chromeos/drive/drive_test_util.h" 19 #include "chrome/browser/chromeos/drive/drive_test_util.h"
19 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" 20 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h"
20 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" 21 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
21 #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h" 22 #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h"
22 #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h" 23 #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h"
23 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h" 24 #include "chrome/browser/chromeos/drive/stale_cache_files_remover.h"
24 #include "chrome/browser/google_apis/drive_api_parser.h" 25 #include "chrome/browser/google_apis/drive_api_parser.h"
25 #include "chrome/browser/google_apis/fake_drive_service.h" 26 #include "chrome/browser/google_apis/fake_drive_service.h"
26 #include "chrome/browser/google_apis/test_util.h" 27 #include "chrome/browser/google_apis/test_util.h"
27 #include "chrome/browser/google_apis/time_util.h" 28 #include "chrome/browser/google_apis/time_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 62
62 fake_drive_service_.reset(new google_apis::FakeDriveService); 63 fake_drive_service_.reset(new google_apis::FakeDriveService);
63 fake_drive_service_->LoadResourceListForWapi( 64 fake_drive_service_->LoadResourceListForWapi(
64 "chromeos/gdata/root_feed.json"); 65 "chromeos/gdata/root_feed.json");
65 fake_drive_service_->LoadAccountMetadataForWapi( 66 fake_drive_service_->LoadAccountMetadataForWapi(
66 "chromeos/gdata/account_metadata.json"); 67 "chromeos/gdata/account_metadata.json");
67 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json"); 68 fake_drive_service_->LoadAppListForDriveApi("chromeos/drive/applist.json");
68 69
69 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); 70 fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter);
70 71
72 scheduler_.reset(new DriveScheduler(profile_.get(),
73 fake_drive_service_.get()));
74
71 scoped_refptr<base::SequencedWorkerPool> pool = 75 scoped_refptr<base::SequencedWorkerPool> pool =
72 content::BrowserThread::GetBlockingPool(); 76 content::BrowserThread::GetBlockingPool();
73 blocking_task_runner_ = 77 blocking_task_runner_ =
74 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); 78 pool->GetSequencedTaskRunner(pool->GetSequenceToken());
75 79
76 // Likewise, this will be owned by DriveFileSystem. 80 // Likewise, this will be owned by DriveFileSystem.
77 cache_.reset(new DriveCache(DriveCache::GetCacheRootPath(profile_.get()), 81 cache_.reset(new DriveCache(DriveCache::GetCacheRootPath(profile_.get()),
78 blocking_task_runner_, 82 blocking_task_runner_,
79 fake_free_disk_space_getter_.get())); 83 fake_free_disk_space_getter_.get()));
80 84
81 drive_webapps_registry_.reset(new DriveWebAppsRegistry); 85 drive_webapps_registry_.reset(new DriveWebAppsRegistry);
82 86
83 resource_metadata_.reset(new DriveResourceMetadata( 87 resource_metadata_.reset(new DriveResourceMetadata(
84 cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META), 88 cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META),
85 blocking_task_runner_)); 89 blocking_task_runner_));
86 90
87 ASSERT_FALSE(file_system_); 91 ASSERT_FALSE(file_system_);
88 file_system_ = new DriveFileSystem(profile_.get(), 92 file_system_ = new DriveFileSystem(profile_.get(),
89 cache_.get(), 93 cache_.get(),
90 fake_drive_service_.get(), 94 fake_drive_service_.get(),
95 scheduler_.get(),
91 drive_webapps_registry_.get(), 96 drive_webapps_registry_.get(),
92 resource_metadata_.get(), 97 resource_metadata_.get(),
93 blocking_task_runner_); 98 blocking_task_runner_);
94 99
95 mock_cache_observer_.reset(new StrictMock<MockDriveCacheObserver>); 100 mock_cache_observer_.reset(new StrictMock<MockDriveCacheObserver>);
96 cache_->AddObserver(mock_cache_observer_.get()); 101 cache_->AddObserver(mock_cache_observer_.get());
97 102
98 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); 103 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>);
99 file_system_->AddObserver(mock_directory_observer_.get()); 104 file_system_->AddObserver(mock_directory_observer_.get());
100 105
(...skipping 24 matching lines...) Expand all
125 130
126 MessageLoopForUI message_loop_; 131 MessageLoopForUI message_loop_;
127 // The order of the test threads is important, do not change the order. 132 // The order of the test threads is important, do not change the order.
128 // See also content/browser/browser_thread_impl.cc. 133 // See also content/browser/browser_thread_impl.cc.
129 content::TestBrowserThread ui_thread_; 134 content::TestBrowserThread ui_thread_;
130 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 135 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
131 scoped_ptr<TestingProfile> profile_; 136 scoped_ptr<TestingProfile> profile_;
132 scoped_ptr<DriveCache, test_util::DestroyHelperForTests> cache_; 137 scoped_ptr<DriveCache, test_util::DestroyHelperForTests> cache_;
133 DriveFileSystem* file_system_; 138 DriveFileSystem* file_system_;
134 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_; 139 scoped_ptr<google_apis::FakeDriveService> fake_drive_service_;
140 scoped_ptr<DriveScheduler> scheduler_;
135 scoped_ptr<DriveWebAppsRegistry> drive_webapps_registry_; 141 scoped_ptr<DriveWebAppsRegistry> drive_webapps_registry_;
136 scoped_ptr<DriveResourceMetadata, test_util::DestroyHelperForTests> 142 scoped_ptr<DriveResourceMetadata, test_util::DestroyHelperForTests>
137 resource_metadata_; 143 resource_metadata_;
138 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_; 144 scoped_ptr<FakeFreeDiskSpaceGetter> fake_free_disk_space_getter_;
139 scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_; 145 scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_;
140 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; 146 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_;
141 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; 147 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_;
142 148
143 int root_feed_changestamp_; 149 int root_feed_changestamp_;
144 }; 150 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 191
186 // Verify that the cache entry is deleted. 192 // Verify that the cache entry is deleted.
187 cache_->GetCacheEntry(resource_id, md5, 193 cache_->GetCacheEntry(resource_id, md5,
188 google_apis::test_util::CreateCopyResultCallback( 194 google_apis::test_util::CreateCopyResultCallback(
189 &success, &cache_entry)); 195 &success, &cache_entry));
190 google_apis::test_util::RunBlockingPoolTask(); 196 google_apis::test_util::RunBlockingPoolTask();
191 EXPECT_FALSE(success); 197 EXPECT_FALSE(success);
192 } 198 }
193 199
194 } // namespace drive 200 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/create_directory_operation_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698