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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_cache.h

Issue 10830181: Implement initialization for GDataCache to use in-memory metadata for tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add 'ForTesting' versions. Created 8 years, 4 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
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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 const CacheOperationCallback& callback); 265 const CacheOperationCallback& callback);
266 266
267 // Does the following: 267 // Does the following:
268 // - remove all the files in the cache directory. 268 // - remove all the files in the cache directory.
269 // - re-create the |metadata_| instance. 269 // - re-create the |metadata_| instance.
270 void ClearAllOnUIThread(const ChangeCacheStateCallback& callback); 270 void ClearAllOnUIThread(const ChangeCacheStateCallback& callback);
271 271
272 // Utility method to call Initialize on UI thread. 272 // Utility method to call Initialize on UI thread.
273 void RequestInitializeOnUIThread(); 273 void RequestInitializeOnUIThread();
274 274
275 // Utility method to call InitializeForTesting on UI thread.
276 void RequestInitializeOnUIThreadForTesting();
277
275 // Force a rescan of cache files, for testing. 278 // Force a rescan of cache files, for testing.
276 void ForceRescanOnUIThreadForTesting(); 279 void ForceRescanOnUIThreadForTesting();
277 280
278 // Gets the cache entry for file corresponding to |resource_id| and |md5| 281 // Gets the cache entry for file corresponding to |resource_id| and |md5|
279 // and returns true if entry exists in cache map. Otherwise, returns false. 282 // and returns true if entry exists in cache map. Otherwise, returns false.
280 // |md5| can be empty if only matching |resource_id| is desired, which may 283 // |md5| can be empty if only matching |resource_id| is desired, which may
281 // happen when looking for pinned entries where symlinks' filenames have no 284 // happen when looking for pinned entries where symlinks' filenames have no
282 // extension and hence no md5. 285 // extension and hence no md5.
283 bool GetCacheEntry(const std::string& resource_id, 286 bool GetCacheEntry(const std::string& resource_id,
284 const std::string& md5, 287 const std::string& md5,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 base::SequencedTaskRunner* blocking_task_runner); 325 base::SequencedTaskRunner* blocking_task_runner);
323 virtual ~GDataCache(); 326 virtual ~GDataCache();
324 327
325 // Checks whether the current thread is on the right sequenced worker pool 328 // Checks whether the current thread is on the right sequenced worker pool
326 // with the right sequence ID. If not, DCHECK will fail. 329 // with the right sequence ID. If not, DCHECK will fail.
327 void AssertOnSequencedWorkerPool(); 330 void AssertOnSequencedWorkerPool();
328 331
329 // Initializes the cache. 332 // Initializes the cache.
330 void Initialize(); 333 void Initialize();
331 334
335 // Initializes the cache with in-memory cache for testing.
achuithb 2012/08/08 05:07:31 nit: maybe add a comment saying that the in-memory
Haruki Sato 2012/08/08 05:57:38 Done. Thanks.
336 void InitializeForTesting();
337
332 // Deletes the cache. 338 // Deletes the cache.
333 void Destroy(); 339 void Destroy();
334 340
335 // Force a rescan of cache directories. 341 // Force a rescan of cache directories.
336 void ForceRescanForTesting(); 342 void ForceRescanForTesting();
337 343
338 // Used to implement GetResourceIdsOfBacklogOnUIThread. 344 // Used to implement GetResourceIdsOfBacklogOnUIThread.
339 void GetResourceIdsOfBacklog( 345 void GetResourceIdsOfBacklog(
340 std::vector<std::string>* to_fetch, 346 std::vector<std::string>* to_fetch,
341 std::vector<std::string>* to_upload); 347 std::vector<std::string>* to_upload);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 }; 471 };
466 472
467 // Sets the free disk space getter for testing. 473 // Sets the free disk space getter for testing.
468 // The existing getter is deleted. 474 // The existing getter is deleted.
469 void SetFreeDiskSpaceGetterForTesting( 475 void SetFreeDiskSpaceGetterForTesting(
470 FreeDiskSpaceGetterInterface* getter); 476 FreeDiskSpaceGetterInterface* getter);
471 477
472 } // namespace gdata 478 } // namespace gdata
473 479
474 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ 480 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_cache.cc » ('j') | chrome/browser/chromeos/gdata/gdata_cache_metadata.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698