| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <stack> | 6 #include <stack> |
| 7 | 7 |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 class DriveBackendSyncTest : public testing::Test, | 70 class DriveBackendSyncTest : public testing::Test, |
| 71 public LocalFileSyncService::Observer, | 71 public LocalFileSyncService::Observer, |
| 72 public RemoteFileSyncService::Observer { | 72 public RemoteFileSyncService::Observer { |
| 73 public: | 73 public: |
| 74 DriveBackendSyncTest() | 74 DriveBackendSyncTest() |
| 75 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 75 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 76 pending_remote_changes_(0), | 76 pending_remote_changes_(0), |
| 77 pending_local_changes_(0) {} | 77 pending_local_changes_(0) {} |
| 78 virtual ~DriveBackendSyncTest() {} | 78 virtual ~DriveBackendSyncTest() {} |
| 79 | 79 |
| 80 virtual void SetUp() OVERRIDE { | 80 virtual void SetUp() override { |
| 81 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); | 81 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); |
| 82 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); | 82 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); |
| 83 | 83 |
| 84 io_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( | 84 io_task_runner_ = content::BrowserThread::GetMessageLoopProxyForThread( |
| 85 content::BrowserThread::IO); | 85 content::BrowserThread::IO); |
| 86 scoped_refptr<base::SequencedWorkerPool> worker_pool( | 86 scoped_refptr<base::SequencedWorkerPool> worker_pool( |
| 87 content::BrowserThread::GetBlockingPool()); | 87 content::BrowserThread::GetBlockingPool()); |
| 88 worker_task_runner_ = | 88 worker_task_runner_ = |
| 89 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 89 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 90 worker_pool->GetSequenceToken(), | 90 worker_pool->GetSequenceToken(), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 remote_sync_service_->AddServiceObserver(this); | 130 remote_sync_service_->AddServiceObserver(this); |
| 131 remote_sync_service_->InitializeForTesting( | 131 remote_sync_service_->InitializeForTesting( |
| 132 drive_service.PassAs<drive::DriveServiceInterface>(), | 132 drive_service.PassAs<drive::DriveServiceInterface>(), |
| 133 uploader.Pass(), nullptr /* sync_worker */); | 133 uploader.Pass(), nullptr /* sync_worker */); |
| 134 remote_sync_service_->SetSyncEnabled(true); | 134 remote_sync_service_->SetSyncEnabled(true); |
| 135 | 135 |
| 136 local_sync_service_->SetLocalChangeProcessor(remote_sync_service_.get()); | 136 local_sync_service_->SetLocalChangeProcessor(remote_sync_service_.get()); |
| 137 remote_sync_service_->SetRemoteChangeProcessor(local_sync_service_.get()); | 137 remote_sync_service_->SetRemoteChangeProcessor(local_sync_service_.get()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 virtual void TearDown() OVERRIDE { | 140 virtual void TearDown() override { |
| 141 typedef std::map<std::string, CannedSyncableFileSystem*>::iterator iterator; | 141 typedef std::map<std::string, CannedSyncableFileSystem*>::iterator iterator; |
| 142 for (iterator itr = file_systems_.begin(); | 142 for (iterator itr = file_systems_.begin(); |
| 143 itr != file_systems_.end(); ++itr) { | 143 itr != file_systems_.end(); ++itr) { |
| 144 itr->second->TearDown(); | 144 itr->second->TearDown(); |
| 145 delete itr->second; | 145 delete itr->second; |
| 146 } | 146 } |
| 147 file_systems_.clear(); | 147 file_systems_.clear(); |
| 148 | 148 |
| 149 local_sync_service_->Shutdown(); | 149 local_sync_service_->Shutdown(); |
| 150 | 150 |
| 151 fake_drive_service_helper_.reset(); | 151 fake_drive_service_helper_.reset(); |
| 152 local_sync_service_.reset(); | 152 local_sync_service_.reset(); |
| 153 remote_sync_service_.reset(); | 153 remote_sync_service_.reset(); |
| 154 | 154 |
| 155 content::RunAllBlockingPoolTasksUntilIdle(); | 155 content::RunAllBlockingPoolTasksUntilIdle(); |
| 156 RevokeSyncableFileSystem(); | 156 RevokeSyncableFileSystem(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 virtual void OnRemoteChangeQueueUpdated(int64 pending_changes_hint) OVERRIDE { | 159 virtual void OnRemoteChangeQueueUpdated(int64 pending_changes_hint) override { |
| 160 pending_remote_changes_ = pending_changes_hint; | 160 pending_remote_changes_ = pending_changes_hint; |
| 161 } | 161 } |
| 162 | 162 |
| 163 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) OVERRIDE { | 163 virtual void OnLocalChangeAvailable(int64 pending_changes_hint) override { |
| 164 pending_local_changes_ = pending_changes_hint; | 164 pending_local_changes_ = pending_changes_hint; |
| 165 } | 165 } |
| 166 | 166 |
| 167 protected: | 167 protected: |
| 168 storage::FileSystemURL CreateURL(const std::string& app_id, | 168 storage::FileSystemURL CreateURL(const std::string& app_id, |
| 169 const base::FilePath::StringType& path) { | 169 const base::FilePath::StringType& path) { |
| 170 return CreateURL(app_id, base::FilePath(path)); | 170 return CreateURL(app_id, base::FilePath(path)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 storage::FileSystemURL CreateURL(const std::string& app_id, | 173 storage::FileSystemURL CreateURL(const std::string& app_id, |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 | 1721 |
| 1722 EXPECT_EQ(1u, CountApp()); | 1722 EXPECT_EQ(1u, CountApp()); |
| 1723 EXPECT_EQ(1u, CountLocalFile(app_id)); | 1723 EXPECT_EQ(1u, CountLocalFile(app_id)); |
| 1724 | 1724 |
| 1725 EXPECT_EQ(2u, CountMetadata()); | 1725 EXPECT_EQ(2u, CountMetadata()); |
| 1726 EXPECT_EQ(2u, CountTracker()); | 1726 EXPECT_EQ(2u, CountTracker()); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 } // namespace drive_backend | 1729 } // namespace drive_backend |
| 1730 } // namespace sync_file_system | 1730 } // namespace sync_file_system |
| OLD | NEW |