| 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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.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" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 class LocalFileSystemOperationWriteTest | 73 class LocalFileSystemOperationWriteTest |
| 74 : public testing::Test, | 74 : public testing::Test, |
| 75 public base::SupportsWeakPtr<LocalFileSystemOperationWriteTest> { | 75 public base::SupportsWeakPtr<LocalFileSystemOperationWriteTest> { |
| 76 public: | 76 public: |
| 77 LocalFileSystemOperationWriteTest() | 77 LocalFileSystemOperationWriteTest() |
| 78 : test_helper_(GURL("http://example.com"), kFileSystemTypeTest), | 78 : test_helper_(GURL("http://example.com"), kFileSystemTypeTest), |
| 79 loop_(MessageLoop::TYPE_IO), | 79 loop_(MessageLoop::TYPE_IO), |
| 80 status_(base::PLATFORM_FILE_OK), | 80 status_(base::PLATFORM_FILE_OK), |
| 81 cancel_status_(base::PLATFORM_FILE_ERROR_FAILED), | 81 cancel_status_(base::PLATFORM_FILE_ERROR_FAILED), |
| 82 bytes_written_(0), | 82 bytes_written_(0), |
| 83 complete_(false) { | 83 complete_(false), |
| 84 url_request_context_(test_helper_.file_system_context()) { |
| 84 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); | 85 change_observers_ = MockFileChangeObserver::CreateList(&change_observer_); |
| 85 } | 86 } |
| 86 | 87 |
| 87 LocalFileSystemOperation* operation(); | 88 LocalFileSystemOperation* operation(); |
| 88 | 89 |
| 89 base::PlatformFileError status() const { return status_; } | 90 base::PlatformFileError status() const { return status_; } |
| 90 base::PlatformFileError cancel_status() const { return cancel_status_; } | 91 base::PlatformFileError cancel_status() const { return cancel_status_; } |
| 91 void add_bytes_written(int64 bytes, bool complete) { | 92 void add_bytes_written(int64 bytes, bool complete) { |
| 92 bytes_written_ += bytes; | 93 bytes_written_ += bytes; |
| 93 EXPECT_FALSE(complete_); | 94 EXPECT_FALSE(complete_); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status()); | 345 EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status()); |
| 345 EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status()); | 346 EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status()); |
| 346 EXPECT_TRUE(complete()); | 347 EXPECT_TRUE(complete()); |
| 347 | 348 |
| 348 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); | 349 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); |
| 349 } | 350 } |
| 350 | 351 |
| 351 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. | 352 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. |
| 352 | 353 |
| 353 } // namespace fileapi | 354 } // namespace fileapi |
| OLD | NEW |