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

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

Issue 10693109: Use Drive v2 API: enable behind --enable-drive-api flag (Closed) Base URL: svn://svn.chromium.org/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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/json/json_file_value_serializer.h" 6 #include "base/json/json_file_value_serializer.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 virtual void SetUp() OVERRIDE { 151 virtual void SetUp() OVERRIDE {
152 chromeos::CrosLibrary::Initialize(true /* use_stub */); 152 chromeos::CrosLibrary::Initialize(true /* use_stub */);
153 io_thread_.StartIOThread(); 153 io_thread_.StartIOThread();
154 154
155 profile_.reset(new TestingProfile); 155 profile_.reset(new TestingProfile);
156 156
157 // Allocate and keep a pointer to the mock, and inject it into the 157 // Allocate and keep a pointer to the mock, and inject it into the
158 // GDataFileSystem object, which will own the mock object. 158 // GDataFileSystem object, which will own the mock object.
159 mock_doc_service_ = new MockDocumentsService; 159 mock_doc_service_ = new MockDocumentsService;
160 160
161 EXPECT_CALL(*mock_doc_service_, Initialize(profile_.get())).Times(1); 161 EXPECT_CALL(*mock_doc_service_, Initialize(profile_.get(), false)).Times(1);
162 162
163 // Likewise, this will be owned by GDataFileSystem. 163 // Likewise, this will be owned by GDataFileSystem.
164 mock_free_disk_space_checker_ = new MockFreeDiskSpaceGetter; 164 mock_free_disk_space_checker_ = new MockFreeDiskSpaceGetter;
165 SetFreeDiskSpaceGetterForTesting(mock_free_disk_space_checker_); 165 SetFreeDiskSpaceGetterForTesting(mock_free_disk_space_checker_);
166 166
167 cache_ = GDataCache::CreateGDataCacheOnUIThread( 167 cache_ = GDataCache::CreateGDataCacheOnUIThread(
168 GDataCache::GetCacheRootPath(profile_.get()), 168 GDataCache::GetCacheRootPath(profile_.get()),
169 content::BrowserThread::GetBlockingPool(), 169 content::BrowserThread::GetBlockingPool(),
170 sequence_token_); 170 sequence_token_);
171 171
172 mock_uploader_.reset(new StrictMock<MockGDataUploader>); 172 mock_uploader_.reset(new StrictMock<MockGDataUploader>);
173 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>); 173 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>);
174 174
175 ASSERT_FALSE(file_system_); 175 ASSERT_FALSE(file_system_);
176 file_system_ = new GDataFileSystem(profile_.get(), 176 file_system_ = new GDataFileSystem(profile_.get(),
177 cache_, 177 cache_,
178 mock_doc_service_, 178 mock_doc_service_,
179 mock_uploader_.get(), 179 mock_uploader_.get(),
180 mock_webapps_registry_.get(), 180 mock_webapps_registry_.get(),
181 sequence_token_); 181 sequence_token_);
182 182
183 mock_sync_client_.reset(new StrictMock<MockGDataSyncClient>); 183 mock_sync_client_.reset(new StrictMock<MockGDataSyncClient>);
184 cache_->AddObserver(mock_sync_client_.get()); 184 cache_->AddObserver(mock_sync_client_.get());
185 185
186 file_system_->Initialize(); 186 file_system_->Initialize(false);
187 cache_->RequestInitializeOnUIThread(); 187 cache_->RequestInitializeOnUIThread();
188 test_util::RunBlockingPoolTask(); 188 test_util::RunBlockingPoolTask();
189 } 189 }
190 190
191 virtual void TearDown() OVERRIDE { 191 virtual void TearDown() OVERRIDE {
192 ASSERT_TRUE(file_system_); 192 ASSERT_TRUE(file_system_);
193 EXPECT_CALL(*mock_doc_service_, CancelAll()).Times(1); 193 EXPECT_CALL(*mock_doc_service_, CancelAll()).Times(1);
194 delete file_system_; 194 delete file_system_;
195 file_system_ = NULL; 195 file_system_ = NULL;
196 delete mock_doc_service_; 196 delete mock_doc_service_;
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 EXPECT_EQ(1, num_callback_invocations_); 1602 EXPECT_EQ(1, num_callback_invocations_);
1603 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); 1603 EXPECT_TRUE(CacheEntryExists(resource_id, md5));
1604 1604
1605 // Try to remove the file. 1605 // Try to remove the file.
1606 num_callback_invocations_ = 0; 1606 num_callback_invocations_ = 0;
1607 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); 1607 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK);
1608 EXPECT_EQ(1, num_callback_invocations_); 1608 EXPECT_EQ(1, num_callback_invocations_);
1609 } 1609 }
1610 1610
1611 } // namespace gdata 1611 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698