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

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

Issue 17249004: drive: Use ResourceMetadataStorage from FileCache (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More precise old DB handling Created 7 years, 6 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
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/drive/file_system.h" 5 #include "chrome/browser/chromeos/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"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 scheduler_.reset(new JobScheduler(profile_.get(), 77 scheduler_.reset(new JobScheduler(profile_.get(),
78 fake_drive_service_.get())); 78 fake_drive_service_.get()));
79 79
80 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath( 80 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath(
81 profile_.get()).Append(util::kMetadataDirectory))); 81 profile_.get()).Append(util::kMetadataDirectory)));
82 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath( 82 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath(
83 profile_.get()).Append(util::kCacheFileDirectory))); 83 profile_.get()).Append(util::kCacheFileDirectory)));
84 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath( 84 ASSERT_TRUE(file_util::CreateDirectory(util::GetCacheRootPath(
85 profile_.get()).Append(util::kTemporaryFileDirectory))); 85 profile_.get()).Append(util::kTemporaryFileDirectory)));
86 86
87 cache_.reset(new internal::FileCache(
88 util::GetCacheRootPath(profile_.get()).Append(util::kMetadataDirectory),
89 util::GetCacheRootPath(profile_.get()).Append(
90 util::kCacheFileDirectory),
91 base::MessageLoopProxy::current(),
92 fake_free_disk_space_getter_.get()));
93
94 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); 87 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>);
95 88
96 ASSERT_TRUE(cache_->Initialize());
97
98 SetUpResourceMetadataAndFileSystem(); 89 SetUpResourceMetadataAndFileSystem();
99 } 90 }
100 91
101 void SetUpResourceMetadataAndFileSystem() { 92 void SetUpResourceMetadataAndFileSystem() {
102 metadata_storage_.reset(new internal::ResourceMetadataStorage( 93 metadata_storage_.reset(new internal::ResourceMetadataStorage(
103 util::GetCacheRootPath(profile_.get()).Append(util::kMetadataDirectory), 94 util::GetCacheRootPath(profile_.get()).Append(util::kMetadataDirectory),
104 base::MessageLoopProxy::current())); 95 base::MessageLoopProxy::current()));
105 ASSERT_TRUE(metadata_storage_->Initialize()); 96 ASSERT_TRUE(metadata_storage_->Initialize());
106 97
98 cache_.reset(new internal::FileCache(
99 metadata_storage_.get(),
100 util::GetCacheRootPath(profile_.get()).Append(
101 util::kCacheFileDirectory),
102 base::MessageLoopProxy::current(),
103 fake_free_disk_space_getter_.get()));
104 ASSERT_TRUE(cache_->Initialize());
105
107 resource_metadata_.reset(new internal::ResourceMetadata( 106 resource_metadata_.reset(new internal::ResourceMetadata(
108 metadata_storage_.get(), base::MessageLoopProxy::current())); 107 metadata_storage_.get(), base::MessageLoopProxy::current()));
109 108
110 file_system_.reset(new FileSystem( 109 file_system_.reset(new FileSystem(
111 profile_.get(), 110 profile_.get(),
112 cache_.get(), 111 cache_.get(),
113 fake_drive_service_.get(), 112 fake_drive_service_.get(),
114 scheduler_.get(), 113 scheduler_.get(),
115 resource_metadata_.get(), 114 resource_metadata_.get(),
116 base::MessageLoopProxy::current(), 115 base::MessageLoopProxy::current(),
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 file_path, 836 file_path,
838 google_apis::test_util::CreateCopyResultCallback(&error)); 837 google_apis::test_util::CreateCopyResultCallback(&error));
839 google_apis::test_util::RunBlockingPoolTask(); 838 google_apis::test_util::RunBlockingPoolTask();
840 EXPECT_EQ(FILE_ERROR_OK, error); 839 EXPECT_EQ(FILE_ERROR_OK, error);
841 840
842 // Now able to remove the cache entry. 841 // Now able to remove the cache entry.
843 EXPECT_EQ(FILE_ERROR_OK, cache_->Remove(entry->resource_id())); 842 EXPECT_EQ(FILE_ERROR_OK, cache_->Remove(entry->resource_id()));
844 } 843 }
845 844
846 } // namespace drive 845 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698