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

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

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 fake_drive_service_.get(), 93 fake_drive_service_.get(),
94 base::MessageLoopProxy::current().get())); 94 base::MessageLoopProxy::current().get()));
95 95
96 mock_directory_observer_.reset(new MockDirectoryChangeObserver); 96 mock_directory_observer_.reset(new MockDirectoryChangeObserver);
97 97
98 SetUpResourceMetadataAndFileSystem(); 98 SetUpResourceMetadataAndFileSystem();
99 } 99 }
100 100
101 void SetUpResourceMetadataAndFileSystem() { 101 void SetUpResourceMetadataAndFileSystem() {
102 const base::FilePath metadata_dir = temp_dir_.path().AppendASCII("meta"); 102 const base::FilePath metadata_dir = temp_dir_.path().AppendASCII("meta");
103 ASSERT_TRUE(file_util::CreateDirectory(metadata_dir)); 103 ASSERT_TRUE(base::CreateDirectory(metadata_dir));
104 metadata_storage_.reset(new internal::ResourceMetadataStorage( 104 metadata_storage_.reset(new internal::ResourceMetadataStorage(
105 metadata_dir, base::MessageLoopProxy::current().get())); 105 metadata_dir, base::MessageLoopProxy::current().get()));
106 ASSERT_TRUE(metadata_storage_->Initialize()); 106 ASSERT_TRUE(metadata_storage_->Initialize());
107 107
108 const base::FilePath cache_dir = temp_dir_.path().AppendASCII("files"); 108 const base::FilePath cache_dir = temp_dir_.path().AppendASCII("files");
109 ASSERT_TRUE(file_util::CreateDirectory(cache_dir)); 109 ASSERT_TRUE(base::CreateDirectory(cache_dir));
110 cache_.reset(new internal::FileCache( 110 cache_.reset(new internal::FileCache(
111 metadata_storage_.get(), 111 metadata_storage_.get(),
112 cache_dir, 112 cache_dir,
113 base::MessageLoopProxy::current().get(), 113 base::MessageLoopProxy::current().get(),
114 fake_free_disk_space_getter_.get())); 114 fake_free_disk_space_getter_.get()));
115 ASSERT_TRUE(cache_->Initialize()); 115 ASSERT_TRUE(cache_->Initialize());
116 116
117 resource_metadata_.reset(new internal::ResourceMetadata( 117 resource_metadata_.reset(new internal::ResourceMetadata(
118 metadata_storage_.get(), base::MessageLoopProxy::current())); 118 metadata_storage_.get(), base::MessageLoopProxy::current()));
119 ASSERT_EQ(FILE_ERROR_OK, resource_metadata_->Initialize()); 119 ASSERT_EQ(FILE_ERROR_OK, resource_metadata_->Initialize());
120 120
121 const base::FilePath temp_file_dir = temp_dir_.path().AppendASCII("tmp"); 121 const base::FilePath temp_file_dir = temp_dir_.path().AppendASCII("tmp");
122 ASSERT_TRUE(file_util::CreateDirectory(temp_file_dir)); 122 ASSERT_TRUE(base::CreateDirectory(temp_file_dir));
123 file_system_.reset(new FileSystem( 123 file_system_.reset(new FileSystem(
124 pref_service_.get(), 124 pref_service_.get(),
125 cache_.get(), 125 cache_.get(),
126 fake_drive_service_.get(), 126 fake_drive_service_.get(),
127 scheduler_.get(), 127 scheduler_.get(),
128 resource_metadata_.get(), 128 resource_metadata_.get(),
129 base::MessageLoopProxy::current().get(), 129 base::MessageLoopProxy::current().get(),
130 temp_file_dir)); 130 temp_file_dir));
131 file_system_->AddObserver(mock_directory_observer_.get()); 131 file_system_->AddObserver(mock_directory_observer_.get());
132 132
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Sets up a filesystem with directories: drive/root, drive/root/Dir1, 185 // Sets up a filesystem with directories: drive/root, drive/root/Dir1,
186 // drive/root/Dir1/SubDir2 and files drive/root/File1, drive/root/Dir1/File2, 186 // drive/root/Dir1/SubDir2 and files drive/root/File1, drive/root/Dir1/File2,
187 // drive/root/Dir1/SubDir2/File3. If |use_up_to_date_timestamp| is true, sets 187 // drive/root/Dir1/SubDir2/File3. If |use_up_to_date_timestamp| is true, sets
188 // the changestamp to 654321, equal to that of "account_metadata.json" test 188 // the changestamp to 654321, equal to that of "account_metadata.json" test
189 // data, indicating the cache is holding the latest file system info. 189 // data, indicating the cache is holding the latest file system info.
190 void SetUpTestFileSystem(SetUpTestFileSystemParam param) { 190 void SetUpTestFileSystem(SetUpTestFileSystemParam param) {
191 // Destroy the existing resource metadata to close DB. 191 // Destroy the existing resource metadata to close DB.
192 resource_metadata_.reset(); 192 resource_metadata_.reset();
193 193
194 const base::FilePath metadata_dir = temp_dir_.path().AppendASCII("meta"); 194 const base::FilePath metadata_dir = temp_dir_.path().AppendASCII("meta");
195 ASSERT_TRUE(file_util::CreateDirectory(metadata_dir)); 195 ASSERT_TRUE(base::CreateDirectory(metadata_dir));
196 scoped_ptr<internal::ResourceMetadataStorage, 196 scoped_ptr<internal::ResourceMetadataStorage,
197 test_util::DestroyHelperForTests> metadata_storage( 197 test_util::DestroyHelperForTests> metadata_storage(
198 new internal::ResourceMetadataStorage( 198 new internal::ResourceMetadataStorage(
199 metadata_dir, base::MessageLoopProxy::current().get())); 199 metadata_dir, base::MessageLoopProxy::current().get()));
200 200
201 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> 201 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests>
202 resource_metadata(new internal::ResourceMetadata( 202 resource_metadata(new internal::ResourceMetadata(
203 metadata_storage_.get(), base::MessageLoopProxy::current())); 203 metadata_storage_.get(), base::MessageLoopProxy::current()));
204 204
205 ASSERT_EQ(FILE_ERROR_OK, resource_metadata->Initialize()); 205 ASSERT_EQ(FILE_ERROR_OK, resource_metadata->Initialize());
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 kEmbedOrigin, 734 kEmbedOrigin,
735 google_apis::test_util::CreateCopyResultCallback(&error, &share_url)); 735 google_apis::test_util::CreateCopyResultCallback(&error, &share_url));
736 test_util::RunBlockingPoolTask(); 736 test_util::RunBlockingPoolTask();
737 737
738 // Verify the error and the share url, which should be empty. 738 // Verify the error and the share url, which should be empty.
739 EXPECT_EQ(FILE_ERROR_FAILED, error); 739 EXPECT_EQ(FILE_ERROR_FAILED, error);
740 EXPECT_TRUE(share_url.is_empty()); 740 EXPECT_TRUE(share_url.is_empty());
741 } 741 }
742 742
743 } // namespace drive 743 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698