Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc

Issue 10800092: Database support for GDataDirectoryService. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 content::BrowserThread::GetBlockingPool(); 262 content::BrowserThread::GetBlockingPool();
263 blocking_task_runner_ = 263 blocking_task_runner_ =
264 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); 264 pool->GetSequencedTaskRunner(pool->GetSequenceToken());
265 265
266 cache_ = GDataCache::CreateGDataCacheOnUIThread( 266 cache_ = GDataCache::CreateGDataCacheOnUIThread(
267 GDataCache::GetCacheRootPath(profile_.get()), blocking_task_runner_); 267 GDataCache::GetCacheRootPath(profile_.get()), blocking_task_runner_);
268 268
269 mock_uploader_.reset(new StrictMock<MockGDataUploader>); 269 mock_uploader_.reset(new StrictMock<MockGDataUploader>);
270 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>); 270 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>);
271 271
272 directory_service_.reset(new GDataDirectoryService);
272 ASSERT_FALSE(file_system_); 273 ASSERT_FALSE(file_system_);
273 file_system_ = new GDataFileSystem(profile_.get(), 274 file_system_ = new GDataFileSystem(profile_.get(),
274 cache_, 275 cache_,
276 directory_service_.get(),
275 mock_doc_service_, 277 mock_doc_service_,
276 mock_uploader_.get(), 278 mock_uploader_.get(),
277 mock_webapps_registry_.get(), 279 mock_webapps_registry_.get(),
278 blocking_task_runner_); 280 blocking_task_runner_);
279 281
280 mock_sync_client_.reset(new StrictMock<MockGDataSyncClient>); 282 mock_sync_client_.reset(new StrictMock<MockGDataSyncClient>);
281 cache_->AddObserver(mock_sync_client_.get()); 283 cache_->AddObserver(mock_sync_client_.get());
282 284
283 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); 285 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>);
284 file_system_->AddObserver(mock_directory_observer_.get()); 286 file_system_->AddObserver(mock_directory_observer_.get());
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 MessageLoopForUI message_loop_; 856 MessageLoopForUI message_loop_;
855 // The order of the test threads is important, do not change the order. 857 // The order of the test threads is important, do not change the order.
856 // See also content/browser/browser_thread_imple.cc. 858 // See also content/browser/browser_thread_imple.cc.
857 content::TestBrowserThread ui_thread_; 859 content::TestBrowserThread ui_thread_;
858 content::TestBrowserThread io_thread_; 860 content::TestBrowserThread io_thread_;
859 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 861 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
860 scoped_ptr<TestingProfile> profile_; 862 scoped_ptr<TestingProfile> profile_;
861 scoped_refptr<CallbackHelper> callback_helper_; 863 scoped_refptr<CallbackHelper> callback_helper_;
862 GDataCache* cache_; 864 GDataCache* cache_;
863 scoped_ptr<StrictMock<MockGDataUploader> > mock_uploader_; 865 scoped_ptr<StrictMock<MockGDataUploader> > mock_uploader_;
866 scoped_ptr<GDataDirectoryService> directory_service_;
864 GDataFileSystem* file_system_; 867 GDataFileSystem* file_system_;
865 StrictMock<MockDocumentsService>* mock_doc_service_; 868 StrictMock<MockDocumentsService>* mock_doc_service_;
866 scoped_ptr<StrictMock<MockDriveWebAppsRegistry> > mock_webapps_registry_; 869 scoped_ptr<StrictMock<MockDriveWebAppsRegistry> > mock_webapps_registry_;
867 StrictMock<MockFreeDiskSpaceGetter>* mock_free_disk_space_checker_; 870 StrictMock<MockFreeDiskSpaceGetter>* mock_free_disk_space_checker_;
868 scoped_ptr<StrictMock<MockGDataSyncClient> > mock_sync_client_; 871 scoped_ptr<StrictMock<MockGDataSyncClient> > mock_sync_client_;
869 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; 872 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_;
870 873
871 int num_callback_invocations_; 874 int num_callback_invocations_;
872 GDataFileError expected_error_; 875 GDataFileError expected_error_;
873 int expected_cache_state_; 876 int expected_cache_state_;
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 2580
2578 // Try to close the same file twice. 2581 // Try to close the same file twice.
2579 file_system_->CloseFile(kFileInRoot, close_file_callback); 2582 file_system_->CloseFile(kFileInRoot, close_file_callback);
2580 message_loop_.Run(); 2583 message_loop_.Run();
2581 2584
2582 // It must fail. 2585 // It must fail.
2583 EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); 2586 EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_);
2584 } 2587 }
2585 2588
2586 } // namespace gdata 2589 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698