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/file_system_dir_url_request_job.h" | 5 #include "webkit/browser/fileapi/file_system_dir_url_request_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 FileSystemURL CreateURL(const base::FilePath& file_path) { | 101 FileSystemURL CreateURL(const base::FilePath& file_path) { |
102 return file_system_context_->CreateCrackedFileSystemURL( | 102 return file_system_context_->CreateCrackedFileSystemURL( |
103 GURL("http://remote"), | 103 GURL("http://remote"), |
104 fileapi::kFileSystemTypeTemporary, | 104 fileapi::kFileSystemTypeTemporary, |
105 file_path); | 105 file_path); |
106 } | 106 } |
107 | 107 |
108 FileSystemOperationContext* NewOperationContext() { | 108 FileSystemOperationContext* NewOperationContext() { |
109 FileSystemOperationContext* context(new FileSystemOperationContext( | 109 FileSystemOperationContext* context( |
110 file_system_context_)); | 110 new FileSystemOperationContext(file_system_context_.get())); |
111 context->set_allowed_bytes_growth(1024); | 111 context->set_allowed_bytes_growth(1024); |
112 return context; | 112 return context; |
113 } | 113 } |
114 | 114 |
115 void CreateDirectory(const base::StringPiece& dir_name) { | 115 void CreateDirectory(const base::StringPiece& dir_name) { |
116 base::FilePath path = base::FilePath().AppendASCII(dir_name); | 116 base::FilePath path = base::FilePath().AppendASCII(dir_name); |
117 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); | 117 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); |
118 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->CreateDirectory( | 118 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->CreateDirectory( |
119 context.get(), | 119 context.get(), |
120 CreateURL(path), | 120 CreateURL(path), |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 CreateDirectory("foo"); | 281 CreateDirectory("foo"); |
282 TestRequestNoRun(CreateFileSystemURL("foo/")); | 282 TestRequestNoRun(CreateFileSystemURL("foo/")); |
283 // Run StartAsync() and only StartAsync(). | 283 // Run StartAsync() and only StartAsync(). |
284 base::MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 284 base::MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); |
285 base::MessageLoop::current()->RunUntilIdle(); | 285 base::MessageLoop::current()->RunUntilIdle(); |
286 // If we get here, success! we didn't crash! | 286 // If we get here, success! we didn't crash! |
287 } | 287 } |
288 | 288 |
289 } // namespace (anonymous) | 289 } // namespace (anonymous) |
290 } // namespace fileapi | 290 } // namespace fileapi |
OLD | NEW |