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 "base/stl_util.h" | 5 #include "base/stl_util.h" |
| 6 #include "base/thread_task_runner_handle.h" |
6 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 7 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
7 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 9 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
10 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
11 #include "content/public/test/async_file_test_helper.h" | 12 #include "content/public/test/async_file_test_helper.h" |
12 #include "content/public/test/sandbox_file_system_test_helper.h" | 13 #include "content/public/test/sandbox_file_system_test_helper.h" |
13 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 16 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
(...skipping 14 matching lines...) Expand all Loading... |
30 using quota::QuotaStatusCode; | 31 using quota::QuotaStatusCode; |
31 | 32 |
32 namespace sync_file_system { | 33 namespace sync_file_system { |
33 | 34 |
34 class SyncableFileSystemTest : public testing::Test { | 35 class SyncableFileSystemTest : public testing::Test { |
35 public: | 36 public: |
36 SyncableFileSystemTest() | 37 SyncableFileSystemTest() |
37 : in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())), | 38 : in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())), |
38 file_system_(GURL("http://example.com/"), | 39 file_system_(GURL("http://example.com/"), |
39 in_memory_env_.get(), | 40 in_memory_env_.get(), |
40 base::MessageLoopProxy::current().get(), | 41 base::ThreadTaskRunnerHandle::Get().get(), |
41 base::MessageLoopProxy::current().get()), | 42 base::ThreadTaskRunnerHandle::Get().get()), |
42 weak_factory_(this) {} | 43 weak_factory_(this) {} |
43 | 44 |
44 virtual void SetUp() { | 45 virtual void SetUp() { |
45 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 46 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
46 file_system_.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); | 47 file_system_.SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); |
47 | 48 |
48 sync_context_ = | 49 sync_context_ = |
49 new LocalFileSyncContext(data_dir_.path(), | 50 new LocalFileSyncContext(data_dir_.path(), |
50 in_memory_env_.get(), | 51 in_memory_env_.get(), |
51 base::MessageLoopProxy::current().get(), | 52 base::ThreadTaskRunnerHandle::Get().get(), |
52 base::MessageLoopProxy::current().get()); | 53 base::ThreadTaskRunnerHandle::Get().get()); |
53 ASSERT_EQ( | 54 ASSERT_EQ( |
54 sync_file_system::SYNC_STATUS_OK, | 55 sync_file_system::SYNC_STATUS_OK, |
55 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); | 56 file_system_.MaybeInitializeFileSystemContext(sync_context_.get())); |
56 } | 57 } |
57 | 58 |
58 virtual void TearDown() { | 59 virtual void TearDown() { |
59 if (sync_context_.get()) | 60 if (sync_context_.get()) |
60 sync_context_->ShutdownOnUIThread(); | 61 sync_context_->ShutdownOnUIThread(); |
61 sync_context_ = NULL; | 62 sync_context_ = NULL; |
62 | 63 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 277 |
277 // Now try copying the directory into the syncable file system, which should | 278 // Now try copying the directory into the syncable file system, which should |
278 // fail if directory operation is disabled. (http://crbug.com/161442) | 279 // fail if directory operation is disabled. (http://crbug.com/161442) |
279 EXPECT_NE(base::File::FILE_OK, | 280 EXPECT_NE(base::File::FILE_OK, |
280 file_system_.Copy(kSrcDir, URL("dest"))); | 281 file_system_.Copy(kSrcDir, URL("dest"))); |
281 | 282 |
282 other_file_system_.TearDown(); | 283 other_file_system_.TearDown(); |
283 } | 284 } |
284 | 285 |
285 } // namespace sync_file_system | 286 } // namespace sync_file_system |
OLD | NEW |