| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/location.h" | 6 #include "base/location.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "webkit/blob/mock_blob_url_request_context.h" | 10 #include "webkit/blob/mock_blob_url_request_context.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Use the current thread as IO thread so that we can directly call | 39 // Use the current thread as IO thread so that we can directly call |
| 40 // operations in the tests. | 40 // operations in the tests. |
| 41 SyncableFileOperationRunnerTest() | 41 SyncableFileOperationRunnerTest() |
| 42 : message_loop_(MessageLoop::TYPE_IO), | 42 : message_loop_(MessageLoop::TYPE_IO), |
| 43 file_system_(GURL("http://example.com"), kServiceName, | 43 file_system_(GURL("http://example.com"), kServiceName, |
| 44 base::MessageLoopProxy::current()), | 44 base::MessageLoopProxy::current()), |
| 45 callback_count_(0), | 45 callback_count_(0), |
| 46 write_status_(base::PLATFORM_FILE_ERROR_FAILED), | 46 write_status_(base::PLATFORM_FILE_ERROR_FAILED), |
| 47 write_bytes_(0), | 47 write_bytes_(0), |
| 48 write_complete_(false), | 48 write_complete_(false), |
| 49 url_request_context_(file_system_.file_system_context()), |
| 49 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} | 50 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} |
| 50 | 51 |
| 51 virtual void SetUp() OVERRIDE { | 52 virtual void SetUp() OVERRIDE { |
| 52 file_system_.SetUp(); | 53 file_system_.SetUp(); |
| 53 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), | 54 sync_context_ = new LocalFileSyncContext(base::MessageLoopProxy::current(), |
| 54 base::MessageLoopProxy::current()); | 55 base::MessageLoopProxy::current()); |
| 55 ASSERT_EQ(SYNC_STATUS_OK, | 56 ASSERT_EQ(SYNC_STATUS_OK, |
| 56 file_system_.MaybeInitializeFileSystemContext(sync_context_)); | 57 file_system_.MaybeInitializeFileSystemContext(sync_context_)); |
| 57 | 58 |
| 58 ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); | 59 ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 ResetCallbackStatus(); | 326 ResetCallbackStatus(); |
| 326 | 327 |
| 327 // This shouldn't crash nor leak memory. | 328 // This shouldn't crash nor leak memory. |
| 328 sync_context_->ShutdownOnUIThread(); | 329 sync_context_->ShutdownOnUIThread(); |
| 329 sync_context_ = NULL; | 330 sync_context_ = NULL; |
| 330 MessageLoop::current()->RunAllPending(); | 331 MessageLoop::current()->RunAllPending(); |
| 331 EXPECT_EQ(2, callback_count_); | 332 EXPECT_EQ(2, callback_count_); |
| 332 } | 333 } |
| 333 | 334 |
| 334 } // namespace fileapi | 335 } // namespace fileapi |
| OLD | NEW |