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/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 in_memory_env_.get(), | 56 in_memory_env_.get(), |
57 base::ThreadTaskRunnerHandle::Get().get(), | 57 base::ThreadTaskRunnerHandle::Get().get(), |
58 base::ThreadTaskRunnerHandle::Get().get()), | 58 base::ThreadTaskRunnerHandle::Get().get()), |
59 callback_count_(0), | 59 callback_count_(0), |
60 write_status_(File::FILE_ERROR_FAILED), | 60 write_status_(File::FILE_ERROR_FAILED), |
61 write_bytes_(0), | 61 write_bytes_(0), |
62 write_complete_(false), | 62 write_complete_(false), |
63 url_request_context_(file_system_.file_system_context()), | 63 url_request_context_(file_system_.file_system_context()), |
64 weak_factory_(this) {} | 64 weak_factory_(this) {} |
65 | 65 |
66 virtual void SetUp() OVERRIDE { | 66 virtual void SetUp() override { |
67 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 67 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
68 | 68 |
69 file_system_.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); | 69 file_system_.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); |
70 sync_context_ = new LocalFileSyncContext( | 70 sync_context_ = new LocalFileSyncContext( |
71 dir_.path(), | 71 dir_.path(), |
72 in_memory_env_.get(), | 72 in_memory_env_.get(), |
73 base::ThreadTaskRunnerHandle::Get().get(), | 73 base::ThreadTaskRunnerHandle::Get().get(), |
74 base::ThreadTaskRunnerHandle::Get().get()); | 74 base::ThreadTaskRunnerHandle::Get().get()); |
75 ASSERT_EQ( | 75 ASSERT_EQ( |
76 SYNC_STATUS_OK, | 76 SYNC_STATUS_OK, |
77 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); | 77 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); |
78 | 78 |
79 ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem()); | 79 ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem()); |
80 ASSERT_EQ(File::FILE_OK, | 80 ASSERT_EQ(File::FILE_OK, |
81 file_system_.CreateDirectory(URL(kParent))); | 81 file_system_.CreateDirectory(URL(kParent))); |
82 } | 82 } |
83 | 83 |
84 virtual void TearDown() OVERRIDE { | 84 virtual void TearDown() override { |
85 if (sync_context_.get()) | 85 if (sync_context_.get()) |
86 sync_context_->ShutdownOnUIThread(); | 86 sync_context_->ShutdownOnUIThread(); |
87 sync_context_ = nullptr; | 87 sync_context_ = nullptr; |
88 | 88 |
89 file_system_.TearDown(); | 89 file_system_.TearDown(); |
90 RevokeSyncableFileSystem(); | 90 RevokeSyncableFileSystem(); |
91 } | 91 } |
92 | 92 |
93 FileSystemURL URL(const std::string& path) { | 93 FileSystemURL URL(const std::string& path) { |
94 return file_system_.URL(path); | 94 return file_system_.URL(path); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 storage::FileSystemOperationRunner::OperationID id = | 402 storage::FileSystemOperationRunner::OperationID id = |
403 file_system_.operation_runner()->Truncate( | 403 file_system_.operation_runner()->Truncate( |
404 URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK)); | 404 URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK)); |
405 file_system_.operation_runner()->Cancel( | 405 file_system_.operation_runner()->Cancel( |
406 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); | 406 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); |
407 base::MessageLoop::current()->RunUntilIdle(); | 407 base::MessageLoop::current()->RunUntilIdle(); |
408 EXPECT_EQ(2, callback_count_); | 408 EXPECT_EQ(2, callback_count_); |
409 } | 409 } |
410 | 410 |
411 } // namespace sync_file_system | 411 } // namespace sync_file_system |
OLD | NEW |