| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const std::string kOther = "bar"; | 37 const std::string kOther = "bar"; |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 class SyncableFileOperationRunnerTest : public testing::Test { | 40 class SyncableFileOperationRunnerTest : public testing::Test { |
| 41 protected: | 41 protected: |
| 42 typedef FileSystemOperation::StatusCallback StatusCallback; | 42 typedef FileSystemOperation::StatusCallback StatusCallback; |
| 43 | 43 |
| 44 // Use the current thread as IO thread so that we can directly call | 44 // Use the current thread as IO thread so that we can directly call |
| 45 // operations in the tests. | 45 // operations in the tests. |
| 46 SyncableFileOperationRunnerTest() | 46 SyncableFileOperationRunnerTest() |
| 47 : message_loop_(base::MessageLoop::TYPE_IO), | 47 : message_loop_(base::MessageLoop::TYPE_IO), |
| 48 file_system_(GURL("http://example.com"), | 48 file_system_(GURL("http://example.com"), |
| 49 base::MessageLoopProxy::current(), | 49 base::MessageLoopProxy::current().get(), |
| 50 base::MessageLoopProxy::current()), | 50 base::MessageLoopProxy::current().get()), |
| 51 callback_count_(0), | 51 callback_count_(0), |
| 52 write_status_(base::PLATFORM_FILE_ERROR_FAILED), | 52 write_status_(base::PLATFORM_FILE_ERROR_FAILED), |
| 53 write_bytes_(0), | 53 write_bytes_(0), |
| 54 write_complete_(false), | 54 write_complete_(false), |
| 55 url_request_context_(file_system_.file_system_context()), | 55 url_request_context_(file_system_.file_system_context()), |
| 56 weak_factory_(this) {} | 56 weak_factory_(this) {} |
| 57 | 57 |
| 58 virtual void SetUp() OVERRIDE { | 58 virtual void SetUp() OVERRIDE { |
| 59 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 59 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
| 60 file_system_.SetUp(); | 60 file_system_.SetUp(); |
| 61 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), | 61 sync_context_ = |
| 62 base::MessageLoopProxy::current()); | 62 new LocalFileSyncContext(base::MessageLoopProxy::current().get(), |
| 63 base::MessageLoopProxy::current().get()); |
| 63 ASSERT_EQ( | 64 ASSERT_EQ( |
| 64 SYNC_STATUS_OK, | 65 SYNC_STATUS_OK, |
| 65 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); | 66 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); |
| 66 | 67 |
| 67 ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); | 68 ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); |
| 68 ASSERT_EQ(base::PLATFORM_FILE_OK, | 69 ASSERT_EQ(base::PLATFORM_FILE_OK, |
| 69 file_system_.CreateDirectory(URL(kParent))); | 70 file_system_.CreateDirectory(URL(kParent))); |
| 70 } | 71 } |
| 71 | 72 |
| 72 virtual void TearDown() OVERRIDE { | 73 virtual void TearDown() OVERRIDE { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 file_system_.operation_runner()->Truncate( | 384 file_system_.operation_runner()->Truncate( |
| 384 URL(kFile), 10, | 385 URL(kFile), 10, |
| 385 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_ABORT)); | 386 ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_ABORT)); |
| 386 file_system_.operation_runner()->Cancel( | 387 file_system_.operation_runner()->Cancel( |
| 387 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); | 388 id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK)); |
| 388 base::MessageLoop::current()->RunUntilIdle(); | 389 base::MessageLoop::current()->RunUntilIdle(); |
| 389 EXPECT_EQ(2, callback_count_); | 390 EXPECT_EQ(2, callback_count_); |
| 390 } | 391 } |
| 391 | 392 |
| 392 } // namespace sync_file_system | 393 } // namespace sync_file_system |
| OLD | NEW |