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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 status_(base::PLATFORM_FILE_OK), | 56 status_(base::PLATFORM_FILE_OK), |
57 cancel_status_(base::PLATFORM_FILE_ERROR_FAILED), | 57 cancel_status_(base::PLATFORM_FILE_ERROR_FAILED), |
58 bytes_written_(0), | 58 bytes_written_(0), |
59 complete_(false) { | 59 complete_(false) { |
60 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); | 60 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); |
61 } | 61 } |
62 | 62 |
63 virtual void SetUp() { | 63 virtual void SetUp() { |
64 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 64 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
65 | 65 |
66 quota_manager_ = new quota::MockQuotaManager( | 66 quota_manager_ = |
67 false /* is_incognito */, dir_.path(), | 67 new quota::MockQuotaManager(false /* is_incognito */, |
68 base::MessageLoopProxy::current(), | 68 dir_.path(), |
69 base::MessageLoopProxy::current(), | 69 base::MessageLoopProxy::current().get(), |
70 NULL /* special storage policy */); | 70 base::MessageLoopProxy::current().get(), |
| 71 NULL /* special storage policy */); |
71 virtual_path_ = base::FilePath(FILE_PATH_LITERAL("temporary file")); | 72 virtual_path_ = base::FilePath(FILE_PATH_LITERAL("temporary file")); |
72 | 73 |
73 file_system_context_ = CreateFileSystemContextForTesting( | 74 file_system_context_ = CreateFileSystemContextForTesting( |
74 quota_manager_->proxy(), dir_.path()); | 75 quota_manager_->proxy(), dir_.path()); |
75 url_request_context_.reset( | 76 url_request_context_.reset( |
76 new MockBlobURLRequestContext(file_system_context_.get())); | 77 new MockBlobURLRequestContext(file_system_context_.get())); |
77 | 78 |
78 file_system_context_->operation_runner()->CreateFile( | 79 file_system_context_->operation_runner()->CreateFile( |
79 URLForPath(virtual_path_), true /* exclusive */, | 80 URLForPath(virtual_path_), true /* exclusive */, |
80 base::Bind(&AssertStatusEq, base::PLATFORM_FILE_OK)); | 81 base::Bind(&AssertStatusEq, base::PLATFORM_FILE_OK)); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status()); | 330 EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status()); |
330 EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status()); | 331 EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status()); |
331 EXPECT_TRUE(complete()); | 332 EXPECT_TRUE(complete()); |
332 | 333 |
333 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); | 334 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); |
334 } | 335 } |
335 | 336 |
336 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. | 337 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. |
337 | 338 |
338 } // namespace fileapi | 339 } // namespace fileapi |
OLD | NEW |