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/fileapi/file_system_dir_url_request_job.h" | 5 #include "webkit/fileapi/file_system_dir_url_request_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
14 #include "base/scoped_temp_dir.h" | 14 #include "base/scoped_temp_dir.h" |
15 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
19 #include "net/http/http_request_headers.h" | 19 #include "net/http/http_request_headers.h" |
20 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 21 #include "net/url_request/url_request_context.h" |
21 #include "net/url_request/url_request_test_util.h" | 22 #include "net/url_request/url_request_test_util.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "unicode/regex.h" | 24 #include "unicode/regex.h" |
24 #include "webkit/fileapi/file_system_context.h" | 25 #include "webkit/fileapi/file_system_context.h" |
25 #include "webkit/fileapi/file_system_file_util.h" | 26 #include "webkit/fileapi/file_system_file_util.h" |
26 #include "webkit/fileapi/file_system_operation_context.h" | 27 #include "webkit/fileapi/file_system_operation_context.h" |
27 #include "webkit/fileapi/file_system_task_runners.h" | 28 #include "webkit/fileapi/file_system_task_runners.h" |
28 #include "webkit/fileapi/file_system_url.h" | 29 #include "webkit/fileapi/file_system_url.h" |
29 #include "webkit/fileapi/mock_file_system_options.h" | 30 #include "webkit/fileapi/mock_file_system_options.h" |
30 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 31 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void OnValidateFileSystem(base::PlatformFileError result) { | 80 void OnValidateFileSystem(base::PlatformFileError result) { |
80 ASSERT_EQ(base::PLATFORM_FILE_OK, result); | 81 ASSERT_EQ(base::PLATFORM_FILE_OK, result); |
81 } | 82 } |
82 | 83 |
83 void TestRequestHelper(const GURL& url, bool run_to_completion) { | 84 void TestRequestHelper(const GURL& url, bool run_to_completion) { |
84 delegate_.reset(new TestDelegate()); | 85 delegate_.reset(new TestDelegate()); |
85 delegate_->set_quit_on_redirect(true); | 86 delegate_->set_quit_on_redirect(true); |
86 request_.reset(new net::URLRequest(url, | 87 request_.reset(new net::URLRequest(url, |
87 delegate_.get(), | 88 delegate_.get(), |
88 &empty_context_)); | 89 &empty_context_)); |
89 job_ = new FileSystemDirURLRequestJob(request_.get(), | 90 job_ = new FileSystemDirURLRequestJob( |
90 file_system_context_.get()); | 91 request_.get(), |
| 92 request_->context()->network_delegate(), |
| 93 file_system_context_.get()); |
91 | 94 |
92 request_->Start(); | 95 request_->Start(); |
93 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async | 96 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async |
94 if (run_to_completion) | 97 if (run_to_completion) |
95 MessageLoop::current()->Run(); | 98 MessageLoop::current()->Run(); |
96 } | 99 } |
97 | 100 |
98 void TestRequest(const GURL& url) { | 101 void TestRequest(const GURL& url) { |
99 TestRequestHelper(url, true); | 102 TestRequestHelper(url, true); |
100 } | 103 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 CreateDirectory("foo"); | 287 CreateDirectory("foo"); |
285 TestRequestNoRun(CreateFileSystemURL("foo/")); | 288 TestRequestNoRun(CreateFileSystemURL("foo/")); |
286 // Run StartAsync() and only StartAsync(). | 289 // Run StartAsync() and only StartAsync(). |
287 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 290 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); |
288 MessageLoop::current()->RunAllPending(); | 291 MessageLoop::current()->RunAllPending(); |
289 // If we get here, success! we didn't crash! | 292 // If we get here, success! we didn't crash! |
290 } | 293 } |
291 | 294 |
292 } // namespace (anonymous) | 295 } // namespace (anonymous) |
293 } // namespace fileapi | 296 } // namespace fileapi |
OLD | NEW |