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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_manager_browsertest.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 // Browser test for basic Chrome OS file manager functionality: 5 // Browser test for basic Chrome OS file manager functionality:
6 // - The file list is updated when a file is added externally to the Downloads 6 // - The file list is updated when a file is added externally to the Downloads
7 // folder. 7 // folder.
8 // - Selecting a file and copy-pasting it with the keyboard copies the file. 8 // - Selecting a file and copy-pasting it with the keyboard copies the file.
9 // - Selecting a file and pressing delete deletes it. 9 // - Selecting a file and pressing delete deletes it.
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (!tmp_dir_.CreateUniqueTempDir()) 198 if (!tmp_dir_.CreateUniqueTempDir())
199 return false; 199 return false;
200 local_path_ = tmp_dir_.path().Append(kDownloads); 200 local_path_ = tmp_dir_.path().Append(kDownloads);
201 } 201 }
202 fileapi::ExternalMountPoints* const mount_points = 202 fileapi::ExternalMountPoints* const mount_points =
203 content::BrowserContext::GetMountPoints(profile); 203 content::BrowserContext::GetMountPoints(profile);
204 mount_points->RevokeFileSystem(kDownloads); 204 mount_points->RevokeFileSystem(kDownloads);
205 205
206 return mount_points->RegisterFileSystem( 206 return mount_points->RegisterFileSystem(
207 kDownloads, fileapi::kFileSystemTypeNativeLocal, local_path_) && 207 kDownloads, fileapi::kFileSystemTypeNativeLocal, local_path_) &&
208 file_util::CreateDirectory(local_path_); 208 base::CreateDirectory(local_path_);
209 } 209 }
210 210
211 void CreateEntry(const TestEntryInfo& entry) { 211 void CreateEntry(const TestEntryInfo& entry) {
212 const base::FilePath target_path = 212 const base::FilePath target_path =
213 local_path_.AppendASCII(entry.target_path); 213 local_path_.AppendASCII(entry.target_path);
214 214
215 entries_.insert(std::make_pair(target_path, entry)); 215 entries_.insert(std::make_pair(target_path, entry));
216 switch (entry.type) { 216 switch (entry.type) {
217 case FILE: { 217 case FILE: {
218 const base::FilePath source_path = 218 const base::FilePath source_path =
219 google_apis::test_util::GetTestFilePath("chromeos/file_manager"). 219 google_apis::test_util::GetTestFilePath("chromeos/file_manager").
220 AppendASCII(entry.source_file_name); 220 AppendASCII(entry.source_file_name);
221 ASSERT_TRUE(base::CopyFile(source_path, target_path)) 221 ASSERT_TRUE(base::CopyFile(source_path, target_path))
222 << "Copy from " << source_path.value() 222 << "Copy from " << source_path.value()
223 << " to " << target_path.value() << " failed."; 223 << " to " << target_path.value() << " failed.";
224 break; 224 break;
225 } 225 }
226 case DIRECTORY: 226 case DIRECTORY:
227 ASSERT_TRUE(file_util::CreateDirectory(target_path)) << 227 ASSERT_TRUE(base::CreateDirectory(target_path)) <<
228 "Failed to create a directory: " << target_path.value(); 228 "Failed to create a directory: " << target_path.value();
229 break; 229 break;
230 } 230 }
231 ASSERT_TRUE(UpdateModifiedTime(entry)); 231 ASSERT_TRUE(UpdateModifiedTime(entry));
232 } 232 }
233 233
234 private: 234 private:
235 // Updates ModifiedTime of the entry and its parents by referring 235 // Updates ModifiedTime of the entry and its parents by referring
236 // TestEntryInfo. Returns true on success. 236 // TestEntryInfo. Returns true on success.
237 bool UpdateModifiedTime(const TestEntryInfo& entry) { 237 bool UpdateModifiedTime(const TestEntryInfo& entry) {
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "searchBoxFocus"))); 732 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "searchBoxFocus")));
733 733
734 INSTANTIATE_TEST_CASE_P( 734 INSTANTIATE_TEST_CASE_P(
735 Thumbnails, 735 Thumbnails,
736 FileManagerBrowserTest, 736 FileManagerBrowserTest,
737 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "thumbnailsDownloads"), 737 ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "thumbnailsDownloads"),
738 TestParameter(IN_GUEST_MODE, "thumbnailsDownloads"))); 738 TestParameter(IN_GUEST_MODE, "thumbnailsDownloads")));
739 739
740 } // namespace 740 } // namespace
741 } // namespace file_manager 741 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698