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

Side by Side Diff: chrome/browser/chromeos/drive/sync_client_unittest.cc

Issue 14884015: drive: Remove DriveFileType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 "chrome/browser/chromeos/drive/sync_client.h" 5 #include "chrome/browser/chromeos/drive/sync_client.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 13 matching lines...) Expand all
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 using ::testing::StrictMock; 26 using ::testing::StrictMock;
27 using ::testing::_; 27 using ::testing::_;
28 28
29 namespace drive { 29 namespace drive {
30 30
31 namespace { 31 namespace {
32 32
33 // Action used to set mock expectations for GetFileByResourceId(). 33 // Action used to set mock expectations for GetFileByResourceId().
34 ACTION_P4(MockGetFileByResourceId, error, local_path, mime_type, file_type) { 34 ACTION_P2(MockGetFileByResourceId, error, local_path) {
35 arg2.Run(error, local_path, mime_type, file_type); 35 arg2.Run(error, local_path, scoped_ptr<ResourceEntry>(new ResourceEntry));
36 } 36 }
37 37
38 // Action used to set mock expectations for UpdateFileByResourceId(). 38 // Action used to set mock expectations for UpdateFileByResourceId().
39 ACTION_P(MockUpdateFileByResourceId, error) { 39 ACTION_P(MockUpdateFileByResourceId, error) {
40 arg2.Run(error); 40 arg2.Run(error);
41 } 41 }
42 42
43 // Action used to set mock expectations for GetFileInfoByResourceId(). 43 // Action used to set mock expectations for GetFileInfoByResourceId().
44 ACTION_P2(MockUpdateFileByResourceId, error, md5) { 44 ACTION_P2(MockUpdateFileByResourceId, error, md5) {
45 scoped_ptr<ResourceEntry> entry(new ResourceEntry); 45 scoped_ptr<ResourceEntry> entry(new ResourceEntry);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 // Sets the expectation for MockFileSystem::GetFileByResourceId(), 153 // Sets the expectation for MockFileSystem::GetFileByResourceId(),
154 // that simulates successful retrieval of a file for the given resource ID. 154 // that simulates successful retrieval of a file for the given resource ID.
155 void SetExpectationForGetFileByResourceId(const std::string& resource_id) { 155 void SetExpectationForGetFileByResourceId(const std::string& resource_id) {
156 EXPECT_CALL(*mock_file_system_, 156 EXPECT_CALL(*mock_file_system_,
157 GetFileByResourceId(resource_id, _, _, _)) 157 GetFileByResourceId(resource_id, _, _, _))
158 .WillOnce( 158 .WillOnce(
159 MockGetFileByResourceId( 159 MockGetFileByResourceId(
160 FILE_ERROR_OK, 160 FILE_ERROR_OK,
161 base::FilePath::FromUTF8Unsafe("local_path_does_not_matter"), 161 base::FilePath::FromUTF8Unsafe("local_path_does_not_matter")));
162 std::string("mime_type_does_not_matter"),
163 REGULAR_FILE));
164 } 162 }
165 163
166 // Sets the expectation for MockFileSystem::UpdateFileByResourceId(), 164 // Sets the expectation for MockFileSystem::UpdateFileByResourceId(),
167 // that simulates successful uploading of a file for the given resource ID. 165 // that simulates successful uploading of a file for the given resource ID.
168 void SetExpectationForUpdateFileByResourceId( 166 void SetExpectationForUpdateFileByResourceId(
169 const std::string& resource_id) { 167 const std::string& resource_id) {
170 EXPECT_CALL(*mock_file_system_, 168 EXPECT_CALL(*mock_file_system_,
171 UpdateFileByResourceId(resource_id, _, _)) 169 UpdateFileByResourceId(resource_id, _, _))
172 .WillOnce(MockUpdateFileByResourceId(FILE_ERROR_OK)); 170 .WillOnce(MockUpdateFileByResourceId(FILE_ERROR_OK));
173 } 171 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Start checking the existing pinned files. This will collect the resource 285 // Start checking the existing pinned files. This will collect the resource
288 // IDs of pinned files, with stale local cache files. 286 // IDs of pinned files, with stale local cache files.
289 sync_client_->StartCheckingExistingPinnedFiles(); 287 sync_client_->StartCheckingExistingPinnedFiles();
290 288
291 SetExpectationForGetFileByResourceId("resource_id_fetched"); 289 SetExpectationForGetFileByResourceId("resource_id_fetched");
292 290
293 google_apis::test_util::RunBlockingPoolTask(); 291 google_apis::test_util::RunBlockingPoolTask();
294 } 292 }
295 293
296 } // namespace drive 294 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698