| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 base::ThreadTaskRunnerHandle::Get()->PostTask( | 124 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 125 FROM_HERE, base::Bind(arg0)); | 125 FROM_HERE, base::Bind(arg0)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 class SyncFileSystemServiceTest : public testing::Test { | 128 class SyncFileSystemServiceTest : public testing::Test { |
| 129 protected: | 129 protected: |
| 130 SyncFileSystemServiceTest() | 130 SyncFileSystemServiceTest() |
| 131 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD | | 131 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD | |
| 132 content::TestBrowserThreadBundle::REAL_IO_THREAD) {} | 132 content::TestBrowserThreadBundle::REAL_IO_THREAD) {} |
| 133 | 133 |
| 134 virtual void SetUp() OVERRIDE { | 134 virtual void SetUp() override { |
| 135 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); | 135 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); |
| 136 file_system_.reset(new CannedSyncableFileSystem( | 136 file_system_.reset(new CannedSyncableFileSystem( |
| 137 GURL(kOrigin), | 137 GURL(kOrigin), |
| 138 in_memory_env_.get(), | 138 in_memory_env_.get(), |
| 139 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 139 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 140 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | 140 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); |
| 141 | 141 |
| 142 scoped_ptr<LocalFileSyncService> local_service = | 142 scoped_ptr<LocalFileSyncService> local_service = |
| 143 LocalFileSyncService::CreateForTesting(&profile_, in_memory_env_.get()); | 143 LocalFileSyncService::CreateForTesting(&profile_, in_memory_env_.get()); |
| 144 remote_service_ = new StrictMock<MockRemoteFileSyncService>; | 144 remote_service_ = new StrictMock<MockRemoteFileSyncService>; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 158 local_service.Pass(), | 158 local_service.Pass(), |
| 159 scoped_ptr<RemoteFileSyncService>(remote_service_)); | 159 scoped_ptr<RemoteFileSyncService>(remote_service_)); |
| 160 | 160 |
| 161 // Disable auto sync by default. | 161 // Disable auto sync by default. |
| 162 EXPECT_CALL(*mock_remote_service(), SetSyncEnabled(false)).Times(1); | 162 EXPECT_CALL(*mock_remote_service(), SetSyncEnabled(false)).Times(1); |
| 163 sync_service_->SetSyncEnabledForTesting(false); | 163 sync_service_->SetSyncEnabledForTesting(false); |
| 164 | 164 |
| 165 file_system_->SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); | 165 file_system_->SetUp(CannedSyncableFileSystem::QUOTA_ENABLED); |
| 166 } | 166 } |
| 167 | 167 |
| 168 virtual void TearDown() OVERRIDE { | 168 virtual void TearDown() override { |
| 169 sync_service_->Shutdown(); | 169 sync_service_->Shutdown(); |
| 170 file_system_->TearDown(); | 170 file_system_->TearDown(); |
| 171 RevokeSyncableFileSystem(); | 171 RevokeSyncableFileSystem(); |
| 172 content::RunAllPendingInMessageLoop(BrowserThread::FILE); | 172 content::RunAllPendingInMessageLoop(BrowserThread::FILE); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void InitializeApp() { | 175 void InitializeApp() { |
| 176 base::RunLoop run_loop; | 176 base::RunLoop run_loop; |
| 177 SyncStatusCode status = SYNC_STATUS_UNKNOWN; | 177 SyncStatusCode status = SYNC_STATUS_UNKNOWN; |
| 178 | 178 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 base::Bind(&AssignValueAndQuit<SyncFileStatus>, | 481 base::Bind(&AssignValueAndQuit<SyncFileStatus>, |
| 482 &run_loop, &status, &sync_file_status)); | 482 &run_loop, &status, &sync_file_status)); |
| 483 run_loop.Run(); | 483 run_loop.Run(); |
| 484 | 484 |
| 485 EXPECT_EQ(SYNC_STATUS_OK, status); | 485 EXPECT_EQ(SYNC_STATUS_OK, status); |
| 486 EXPECT_EQ(SYNC_FILE_STATUS_HAS_PENDING_CHANGES, sync_file_status); | 486 EXPECT_EQ(SYNC_FILE_STATUS_HAS_PENDING_CHANGES, sync_file_status); |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace sync_file_system | 490 } // namespace sync_file_system |
| OLD | NEW |