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: content/browser/fileapi/sandbox_file_system_backend_unittest.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 5 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const char* origin_url; 62 const char* origin_url;
63 const char* expected_path; 63 const char* expected_path;
64 const char* virtual_path; 64 const char* virtual_path;
65 } kRootPathFileURITestCases[] = { 65 } kRootPathFileURITestCases[] = {
66 { fileapi::kFileSystemTypeTemporary, "file:///", 66 { fileapi::kFileSystemTypeTemporary, "file:///",
67 "000" PS "t", NULL }, 67 "000" PS "t", NULL },
68 { fileapi::kFileSystemTypePersistent, "file:///", 68 { fileapi::kFileSystemTypePersistent, "file:///",
69 "000" PS "p", NULL }, 69 "000" PS "p", NULL },
70 }; 70 };
71 71
72 void DidOpenFileSystem(base::PlatformFileError* error_out, 72 void DidOpenFileSystem(base::File::Error* error_out,
73 const GURL& origin_url, 73 const GURL& origin_url,
74 const std::string& name, 74 const std::string& name,
75 base::PlatformFileError error) { 75 base::File::Error error) {
76 *error_out = error; 76 *error_out = error;
77 } 77 }
78 78
79 } // namespace 79 } // namespace
80 80
81 class SandboxFileSystemBackendTest : public testing::Test { 81 class SandboxFileSystemBackendTest : public testing::Test {
82 protected: 82 protected:
83 virtual void SetUp() { 83 virtual void SetUp() {
84 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 84 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
85 SetUpNewDelegate(CreateAllowFileAccessOptions()); 85 SetUpNewDelegate(CreateAllowFileAccessOptions());
(...skipping 23 matching lines...) Expand all
109 base::FilePath target = delegate_-> 109 base::FilePath target = delegate_->
110 GetBaseDirectoryForOriginAndType(origin, type, true); 110 GetBaseDirectoryForOriginAndType(origin, type, true);
111 ASSERT_TRUE(!target.empty()); 111 ASSERT_TRUE(!target.empty());
112 ASSERT_TRUE(base::DirectoryExists(target)); 112 ASSERT_TRUE(base::DirectoryExists(target));
113 } 113 }
114 114
115 bool GetRootPath(const GURL& origin_url, 115 bool GetRootPath(const GURL& origin_url,
116 fileapi::FileSystemType type, 116 fileapi::FileSystemType type,
117 fileapi::OpenFileSystemMode mode, 117 fileapi::OpenFileSystemMode mode,
118 base::FilePath* root_path) { 118 base::FilePath* root_path) {
119 base::PlatformFileError error = base::PLATFORM_FILE_OK; 119 base::File::Error error = base::File::FILE_OK;
120 backend_->OpenFileSystem( 120 backend_->OpenFileSystem(
121 origin_url, type, mode, 121 origin_url, type, mode,
122 base::Bind(&DidOpenFileSystem, &error)); 122 base::Bind(&DidOpenFileSystem, &error));
123 base::RunLoop().RunUntilIdle(); 123 base::RunLoop().RunUntilIdle();
124 if (error != base::PLATFORM_FILE_OK) 124 if (error != base::File::FILE_OK)
125 return false; 125 return false;
126 base::FilePath returned_root_path = 126 base::FilePath returned_root_path =
127 delegate_->GetBaseDirectoryForOriginAndType( 127 delegate_->GetBaseDirectoryForOriginAndType(
128 origin_url, type, false /* create */); 128 origin_url, type, false /* create */);
129 if (root_path) 129 if (root_path)
130 *root_path = returned_root_path; 130 *root_path = returned_root_path;
131 return !returned_root_path.empty(); 131 return !returned_root_path.empty();
132 } 132 }
133 133
134 base::FilePath file_system_path() const { 134 base::FilePath file_system_path() const {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, 313 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
314 &root_path)); 314 &root_path));
315 base::FilePath expected = file_system_path().AppendASCII( 315 base::FilePath expected = file_system_path().AppendASCII(
316 kRootPathFileURITestCases[i].expected_path); 316 kRootPathFileURITestCases[i].expected_path);
317 EXPECT_EQ(expected.value(), root_path.value()); 317 EXPECT_EQ(expected.value(), root_path.value());
318 EXPECT_TRUE(base::DirectoryExists(root_path)); 318 EXPECT_TRUE(base::DirectoryExists(root_path));
319 } 319 }
320 } 320 }
321 321
322 } // namespace content 322 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698