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/tools/test_shell/simple_file_system.h" | 5 #include "webkit/tools/test_shell/simple_file_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "net/base/mime_util.h" | 14 #include "net/base/mime_util.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFileInfo.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" |
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemEntry.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemEntry.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
23 #include "webkit/base/file_path_string_conversions.h" | 23 #include "webkit/base/file_path_string_conversions.h" |
24 #include "webkit/blob/blob_storage_controller.h" | 24 #include "webkit/blob/blob_storage_controller.h" |
25 #include "webkit/fileapi/external_mount_points.h" | |
26 #include "webkit/fileapi/file_permission_policy.h" | 25 #include "webkit/fileapi/file_permission_policy.h" |
27 #include "webkit/fileapi/file_system_mount_point_provider.h" | 26 #include "webkit/fileapi/file_system_mount_point_provider.h" |
28 #include "webkit/fileapi/file_system_task_runners.h" | |
29 #include "webkit/fileapi/file_system_url.h" | 27 #include "webkit/fileapi/file_system_url.h" |
30 #include "webkit/fileapi/file_system_util.h" | 28 #include "webkit/fileapi/file_system_util.h" |
31 #include "webkit/fileapi/mock_file_system_options.h" | 29 #include "webkit/fileapi/mock_file_system_context.h" |
32 #include "webkit/tools/test_shell/simple_file_writer.h" | 30 #include "webkit/tools/test_shell/simple_file_writer.h" |
33 | 31 |
34 using base::WeakPtr; | 32 using base::WeakPtr; |
35 | 33 |
36 using WebKit::WebFileInfo; | 34 using WebKit::WebFileInfo; |
37 using WebKit::WebFileSystem; | 35 using WebKit::WebFileSystem; |
38 using WebKit::WebFileSystemCallbacks; | 36 using WebKit::WebFileSystemCallbacks; |
39 using WebKit::WebFileSystemEntry; | 37 using WebKit::WebFileSystemEntry; |
40 using WebKit::WebFileWriter; | 38 using WebKit::WebFileWriter; |
41 using WebKit::WebFileWriterClient; | 39 using WebKit::WebFileWriterClient; |
(...skipping 29 matching lines...) Expand all Loading... |
71 item.SetToFilePathRange(file_path, 0, -1, base::Time()); | 69 item.SetToFilePathRange(file_path, 0, -1, base::Time()); |
72 g_blob_storage_controller->StartBuildingBlob(blob_url); | 70 g_blob_storage_controller->StartBuildingBlob(blob_url); |
73 g_blob_storage_controller->AppendBlobDataItem(blob_url, item); | 71 g_blob_storage_controller->AppendBlobDataItem(blob_url, item); |
74 g_blob_storage_controller->FinishBuildingBlob(blob_url, mime_type); | 72 g_blob_storage_controller->FinishBuildingBlob(blob_url, mime_type); |
75 } | 73 } |
76 | 74 |
77 } // namespace | 75 } // namespace |
78 | 76 |
79 SimpleFileSystem::SimpleFileSystem() { | 77 SimpleFileSystem::SimpleFileSystem() { |
80 if (file_system_dir_.CreateUniqueTempDir()) { | 78 if (file_system_dir_.CreateUniqueTempDir()) { |
81 file_system_context_ = new FileSystemContext( | 79 file_system_context_ = fileapi::CreateFileSystemContextForTesting( |
82 FileSystemTaskRunners::CreateMockTaskRunners(), | |
83 fileapi::ExternalMountPoints::CreateRefCounted().get(), | |
84 NULL /* special storage policy */, | |
85 NULL /* quota manager */, | 80 NULL /* quota manager */, |
86 file_system_dir_.path(), | 81 file_system_dir_.path()); |
87 fileapi::CreateAllowFileAccessOptions()); | |
88 } else { | 82 } else { |
89 LOG(WARNING) << "Failed to create a temp dir for the filesystem." | 83 LOG(WARNING) << "Failed to create a temp dir for the filesystem." |
90 "FileSystem feature will be disabled."; | 84 "FileSystem feature will be disabled."; |
91 } | 85 } |
92 } | 86 } |
93 | 87 |
94 SimpleFileSystem::~SimpleFileSystem() { | 88 SimpleFileSystem::~SimpleFileSystem() { |
95 } | 89 } |
96 | 90 |
97 void SimpleFileSystem::OpenFileSystem( | 91 void SimpleFileSystem::OpenFileSystem( |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 const base::FilePath& platform_path, | 436 const base::FilePath& platform_path, |
443 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 437 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
444 DCHECK(g_io_thread); | 438 DCHECK(g_io_thread); |
445 if (result == base::PLATFORM_FILE_OK) { | 439 if (result == base::PLATFORM_FILE_OK) { |
446 g_io_thread->PostTask( | 440 g_io_thread->PostTask( |
447 FROM_HERE, | 441 FROM_HERE, |
448 base::Bind(&RegisterBlob, blob_url, platform_path)); | 442 base::Bind(&RegisterBlob, blob_url, platform_path)); |
449 } | 443 } |
450 DidGetMetadata(callbacks, result, info, platform_path); | 444 DidGetMetadata(callbacks, result, info, platform_path); |
451 } | 445 } |
OLD | NEW |