OLD | NEW |
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 "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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 GetBaseDirectoryForOriginAndType(origin, type, true); | 106 GetBaseDirectoryForOriginAndType(origin, type, true); |
107 ASSERT_TRUE(!target.empty()); | 107 ASSERT_TRUE(!target.empty()); |
108 ASSERT_TRUE(base::DirectoryExists(target)); | 108 ASSERT_TRUE(base::DirectoryExists(target)); |
109 } | 109 } |
110 | 110 |
111 bool GetRootPath(const GURL& origin_url, | 111 bool GetRootPath(const GURL& origin_url, |
112 fileapi::FileSystemType type, | 112 fileapi::FileSystemType type, |
113 OpenFileSystemMode mode, | 113 OpenFileSystemMode mode, |
114 base::FilePath* root_path) { | 114 base::FilePath* root_path) { |
115 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 115 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
116 backend_->InitializeFileSystem( | 116 backend_->OpenFileSystem( |
117 origin_url, type, mode, NULL /* context */, | 117 origin_url, type, mode, |
118 base::Bind(&DidOpenFileSystem, &error)); | 118 base::Bind(&DidOpenFileSystem, &error)); |
119 base::MessageLoop::current()->RunUntilIdle(); | 119 base::MessageLoop::current()->RunUntilIdle(); |
120 if (error != base::PLATFORM_FILE_OK) | 120 if (error != base::PLATFORM_FILE_OK) |
121 return false; | 121 return false; |
122 base::FilePath returned_root_path = | 122 base::FilePath returned_root_path = |
123 backend_->GetBaseDirectoryForOriginAndType( | 123 backend_->GetBaseDirectoryForOriginAndType( |
124 origin_url, type, false /* create */); | 124 origin_url, type, false /* create */); |
125 if (root_path) | 125 if (root_path) |
126 *root_path = returned_root_path; | 126 *root_path = returned_root_path; |
127 return !returned_root_path.empty(); | 127 return !returned_root_path.empty(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 351 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
352 &root_path)); | 352 &root_path)); |
353 base::FilePath expected = file_system_path().AppendASCII( | 353 base::FilePath expected = file_system_path().AppendASCII( |
354 kRootPathFileURITestCases[i].expected_path); | 354 kRootPathFileURITestCases[i].expected_path); |
355 EXPECT_EQ(expected.value(), root_path.value()); | 355 EXPECT_EQ(expected.value(), root_path.value()); |
356 EXPECT_TRUE(base::DirectoryExists(root_path)); | 356 EXPECT_TRUE(base::DirectoryExists(root_path)); |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 } // namespace fileapi | 360 } // namespace fileapi |
OLD | NEW |