Chromium Code Reviews| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 io_thread_.StartIOThread(); | 189 io_thread_.StartIOThread(); |
| 190 | 190 |
| 191 profile_.reset(new TestingProfile); | 191 profile_.reset(new TestingProfile); |
| 192 | 192 |
| 193 callback_helper_ = new CallbackHelper; | 193 callback_helper_ = new CallbackHelper; |
| 194 | 194 |
| 195 // Allocate and keep a pointer to the mock, and inject it into the | 195 // Allocate and keep a pointer to the mock, and inject it into the |
| 196 // GDataFileSystem object, which will own the mock object. | 196 // GDataFileSystem object, which will own the mock object. |
| 197 mock_doc_service_ = new MockDocumentsService; | 197 mock_doc_service_ = new MockDocumentsService; |
| 198 | 198 |
| 199 EXPECT_CALL(*mock_doc_service_, Initialize(profile_.get())).Times(1); | 199 EXPECT_CALL(*mock_doc_service_, Initialize(profile_.get(), false)).Times(1); |
| 200 | 200 |
| 201 // Likewise, this will be owned by GDataFileSystem. | 201 // Likewise, this will be owned by GDataFileSystem. |
| 202 mock_free_disk_space_checker_ = new MockFreeDiskSpaceGetter; | 202 mock_free_disk_space_checker_ = new MockFreeDiskSpaceGetter; |
| 203 SetFreeDiskSpaceGetterForTesting(mock_free_disk_space_checker_); | 203 SetFreeDiskSpaceGetterForTesting(mock_free_disk_space_checker_); |
| 204 | 204 |
| 205 cache_ = GDataCache::CreateGDataCacheOnUIThread( | 205 cache_ = GDataCache::CreateGDataCacheOnUIThread( |
| 206 GDataCache::GetCacheRootPath(profile_.get()), | 206 GDataCache::GetCacheRootPath(profile_.get()), |
| 207 content::BrowserThread::GetBlockingPool(), | 207 content::BrowserThread::GetBlockingPool(), |
| 208 sequence_token_); | 208 sequence_token_); |
| 209 | 209 |
| 210 mock_uploader_.reset(new StrictMock<MockGDataUploader>); | 210 mock_uploader_.reset(new StrictMock<MockGDataUploader>); |
| 211 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>); | 211 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>); |
| 212 | 212 |
| 213 ASSERT_FALSE(file_system_); | 213 ASSERT_FALSE(file_system_); |
| 214 file_system_ = new GDataFileSystem(profile_.get(), | 214 file_system_ = new GDataFileSystem(profile_.get(), |
| 215 cache_, | 215 cache_, |
| 216 mock_doc_service_, | 216 mock_doc_service_, |
| 217 mock_uploader_.get(), | 217 mock_uploader_.get(), |
| 218 mock_webapps_registry_.get(), | 218 mock_webapps_registry_.get(), |
| 219 sequence_token_); | 219 sequence_token_); |
| 220 | 220 |
| 221 mock_sync_client_.reset(new StrictMock<MockGDataSyncClient>); | 221 mock_sync_client_.reset(new StrictMock<MockGDataSyncClient>); |
| 222 cache_->AddObserver(mock_sync_client_.get()); | 222 cache_->AddObserver(mock_sync_client_.get()); |
| 223 | 223 |
| 224 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); | 224 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); |
| 225 file_system_->AddObserver(mock_directory_observer_.get()); | 225 file_system_->AddObserver(mock_directory_observer_.get()); |
| 226 | 226 |
| 227 file_system_->Initialize(); | 227 file_system_->Initialize(false); |
|
satorux1
2012/07/09 15:58:11
boolean function parameter like this is hard to re
| |
| 228 cache_->RequestInitializeOnUIThread(); | 228 cache_->RequestInitializeOnUIThread(); |
| 229 test_util::RunBlockingPoolTask(); | 229 test_util::RunBlockingPoolTask(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 virtual void TearDown() OVERRIDE { | 232 virtual void TearDown() OVERRIDE { |
| 233 ASSERT_TRUE(file_system_); | 233 ASSERT_TRUE(file_system_); |
| 234 EXPECT_CALL(*mock_doc_service_, CancelAll()).Times(1); | 234 EXPECT_CALL(*mock_doc_service_, CancelAll()).Times(1); |
| 235 delete file_system_; | 235 delete file_system_; |
| 236 file_system_ = NULL; | 236 file_system_ = NULL; |
| 237 delete mock_doc_service_; | 237 delete mock_doc_service_; |
| (...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2621 | 2621 |
| 2622 // Try to close the same file twice. | 2622 // Try to close the same file twice. |
| 2623 file_system_->CloseFile(kFileInRoot, close_file_callback); | 2623 file_system_->CloseFile(kFileInRoot, close_file_callback); |
| 2624 message_loop_.Run(); | 2624 message_loop_.Run(); |
| 2625 | 2625 |
| 2626 // It must fail. | 2626 // It must fail. |
| 2627 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); | 2627 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); |
| 2628 } | 2628 } |
| 2629 | 2629 |
| 2630 } // namespace gdata | 2630 } // namespace gdata |
| OLD | NEW |