OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) | 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) |
6 // rather than as part of test_shell_tests because they rely on being able | 6 // rather than as part of test_shell_tests because they rely on being able |
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses | 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses |
8 // TYPE_UI, which URLRequest doesn't allow. | 8 // TYPE_UI, which URLRequest doesn't allow. |
9 // | 9 // |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/message_loop_proxy.h" | 16 #include "base/message_loop_proxy.h" |
17 #include "base/scoped_temp_dir.h" | 17 #include "base/scoped_temp_dir.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
20 #include "net/url_request/url_request_context.h" | 20 #include "net/url_request/url_request_context.h" |
21 #include "net/url_request/url_request_job.h" | 21 #include "net/url_request/url_request_job.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "webkit/blob/blob_data.h" | 23 #include "webkit/blob/blob_data.h" |
24 #include "webkit/blob/blob_storage_controller.h" | 24 #include "webkit/blob/blob_storage_controller.h" |
25 #include "webkit/blob/blob_url_request_job.h" | 25 #include "webkit/blob/blob_url_request_job.h" |
26 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 26 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
27 #include "webkit/fileapi/file_system_context.h" | 27 #include "webkit/fileapi/file_system_context.h" |
28 #include "webkit/fileapi/file_system_file_util.h" | 28 #include "webkit/fileapi/file_system_file_util.h" |
29 #include "webkit/fileapi/file_system_operation.h" | 29 #include "webkit/fileapi/file_system_operation.h" |
30 #include "webkit/fileapi/file_system_path_manager.h" | |
31 #include "webkit/fileapi/file_system_test_helper.h" | 30 #include "webkit/fileapi/file_system_test_helper.h" |
32 #include "webkit/fileapi/file_system_util.h" | 31 #include "webkit/fileapi/file_system_util.h" |
33 #include "webkit/fileapi/local_file_util.h" | 32 #include "webkit/fileapi/local_file_util.h" |
34 #include "webkit/fileapi/quota_file_util.h" | 33 #include "webkit/fileapi/quota_file_util.h" |
35 #include "webkit/quota/quota_manager.h" | 34 #include "webkit/quota/quota_manager.h" |
36 | 35 |
37 using quota::QuotaManager; | 36 using quota::QuotaManager; |
38 | 37 |
39 namespace fileapi { | 38 namespace fileapi { |
40 | 39 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 }; | 187 }; |
189 | 188 |
190 } // namespace (anonymous) | 189 } // namespace (anonymous) |
191 | 190 |
192 void FileSystemOperationWriteTest::SetUp() { | 191 void FileSystemOperationWriteTest::SetUp() { |
193 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 192 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
194 FilePath base_dir = dir_.path().AppendASCII("filesystem"); | 193 FilePath base_dir = dir_.path().AppendASCII("filesystem"); |
195 | 194 |
196 quota_manager_ = new MockQuotaManager(base_dir, 1024); | 195 quota_manager_ = new MockQuotaManager(base_dir, 1024); |
197 test_helper_.SetUp(base_dir, | 196 test_helper_.SetUp(base_dir, |
198 false /* incognito */, | |
199 false /* unlimited quota */, | 197 false /* unlimited quota */, |
200 quota_manager_->proxy(), | 198 quota_manager_->proxy(), |
201 local_file_util_.get()); | 199 local_file_util_.get()); |
202 filesystem_dir_ = test_helper_.GetOriginRootPath(); | 200 filesystem_dir_ = test_helper_.GetOriginRootPath(); |
203 | 201 |
204 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(filesystem_dir_, &file_)); | 202 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(filesystem_dir_, &file_)); |
205 virtual_path_ = file_.BaseName(); | 203 virtual_path_ = file_.BaseName(); |
206 | 204 |
207 net::URLRequest::Deprecated::RegisterProtocolFactory( | 205 net::URLRequest::Deprecated::RegisterProtocolFactory( |
208 "blob", &BlobURLRequestJobFactory); | 206 "blob", &BlobURLRequestJobFactory); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 url_request_context->blob_storage_controller()->RemoveBlob(blob_url); | 338 url_request_context->blob_storage_controller()->RemoveBlob(blob_url); |
341 | 339 |
342 EXPECT_EQ(10, bytes_written()); | 340 EXPECT_EQ(10, bytes_written()); |
343 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); | 341 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); |
344 EXPECT_TRUE(complete()); | 342 EXPECT_TRUE(complete()); |
345 } | 343 } |
346 | 344 |
347 // TODO(ericu,dmikurube): Add tests for Cancel. | 345 // TODO(ericu,dmikurube): Add tests for Cancel. |
348 | 346 |
349 } // namespace fileapi | 347 } // namespace fileapi |
OLD | NEW |