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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_cache_metadata_unittest.cc

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: 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 #include "chrome/browser/chromeos/gdata/gdata_cache_metadata.h" 5 #include "chrome/browser/chromeos/gdata/gdata_cache_metadata.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/scoped_temp_dir.h" 8 #include "base/scoped_temp_dir.h"
9 #include "chrome/browser/chromeos/gdata/gdata.pb.h" 9 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
10 #include "chrome/browser/chromeos/gdata/gdata_test_util.h" 10 #include "chrome/browser/chromeos/gdata/gdata_test_util.h"
(...skipping 17 matching lines...) Expand all
28 pinned_directory_ = cache_paths_[GDataCache::CACHE_TYPE_PINNED]; 28 pinned_directory_ = cache_paths_[GDataCache::CACHE_TYPE_PINNED];
29 outgoing_directory_ = cache_paths_[GDataCache::CACHE_TYPE_OUTGOING]; 29 outgoing_directory_ = cache_paths_[GDataCache::CACHE_TYPE_OUTGOING];
30 } 30 }
31 31
32 virtual void TearDown() OVERRIDE { 32 virtual void TearDown() OVERRIDE {
33 metadata_.reset(); 33 metadata_.reset();
34 } 34 }
35 35
36 // Sets up the GDataCacheMetadata object. 36 // Sets up the GDataCacheMetadata object.
37 void SetUpCacheMetadata() { 37 void SetUpCacheMetadata() {
38 metadata_ = GDataCacheMetadata::CreateGDataCacheMetadata(NULL).Pass(); 38 metadata_ =
39 GDataCacheMetadata::CreateGDataCacheMetadata(NULL, false).Pass();
39 metadata_->Initialize(cache_paths_); 40 metadata_->Initialize(cache_paths_);
40 } 41 }
41 42
42 // Sets up the cache directories with various files, including stale 43 // Sets up the cache directories with various files, including stale
43 // symbolic links etc. Should be called before SetUpCacheMetadata(). 44 // symbolic links etc. Should be called before SetUpCacheMetadata().
44 void SetUpCacheWithVariousFiles() { 45 void SetUpCacheWithVariousFiles() {
45 // Create some files in persistent directory. 46 // Create some files in persistent directory.
46 // 47 //
47 CreateFile(persistent_directory_.AppendASCII("id_foo.md5foo")); 48 CreateFile(persistent_directory_.AppendASCII("id_foo.md5foo"));
48 CreateFile(persistent_directory_.AppendASCII("id_bar.local")); 49 CreateFile(persistent_directory_.AppendASCII("id_bar.local"));
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 metadata_->RemoveTemporaryFiles(); 383 metadata_->RemoveTemporaryFiles();
383 // resource 1 and 4 should be gone, as these are temporary. 384 // resource 1 and 4 should be gone, as these are temporary.
384 GDataCacheEntry cache_entry; 385 GDataCacheEntry cache_entry;
385 EXPECT_FALSE(metadata_->GetCacheEntry("<resource_id_1>", "", &cache_entry)); 386 EXPECT_FALSE(metadata_->GetCacheEntry("<resource_id_1>", "", &cache_entry));
386 EXPECT_TRUE(metadata_->GetCacheEntry("<resource_id_2>", "", &cache_entry)); 387 EXPECT_TRUE(metadata_->GetCacheEntry("<resource_id_2>", "", &cache_entry));
387 EXPECT_TRUE(metadata_->GetCacheEntry("<resource_id_3>", "", &cache_entry)); 388 EXPECT_TRUE(metadata_->GetCacheEntry("<resource_id_3>", "", &cache_entry));
388 EXPECT_FALSE(metadata_->GetCacheEntry("<resource_id_4>", "", &cache_entry)); 389 EXPECT_FALSE(metadata_->GetCacheEntry("<resource_id_4>", "", &cache_entry));
389 } 390 }
390 391
391 } // namespace gdata 392 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698