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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/operation_test_base.cc

Issue 68543002: drive: Support offline delete (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Stop modifying local state after server side update Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/file_system/operation_test_base.h" 5 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
6 6
7 #include "base/prefs/testing_pref_service.h" 7 #include "base/prefs/testing_pref_service.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "chrome/browser/chromeos/drive/change_list_processor.h" 9 #include "chrome/browser/chromeos/drive/change_list_processor.h"
10 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" 10 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
(...skipping 18 matching lines...) Expand all
29 void OperationTestBase::LoggingObserver::OnDirectoryChangedByOperation( 29 void OperationTestBase::LoggingObserver::OnDirectoryChangedByOperation(
30 const base::FilePath& path) { 30 const base::FilePath& path) {
31 changed_paths_.insert(path); 31 changed_paths_.insert(path);
32 } 32 }
33 33
34 void OperationTestBase::LoggingObserver::OnCacheFileUploadNeededByOperation( 34 void OperationTestBase::LoggingObserver::OnCacheFileUploadNeededByOperation(
35 const std::string& local_id) { 35 const std::string& local_id) {
36 upload_needed_local_ids_.insert(local_id); 36 upload_needed_local_ids_.insert(local_id);
37 } 37 }
38 38
39 void OperationTestBase::LoggingObserver::OnEntryRemovedByOperation(
40 const std::string& local_id) {
41 removed_local_ids_.insert(local_id);
42 }
43
39 OperationTestBase::OperationTestBase() { 44 OperationTestBase::OperationTestBase() {
40 } 45 }
41 46
42 OperationTestBase::OperationTestBase(int test_thread_bundle_options) 47 OperationTestBase::OperationTestBase(int test_thread_bundle_options)
43 : thread_bundle_(test_thread_bundle_options) { 48 : thread_bundle_(test_thread_bundle_options) {
44 } 49 }
45 50
46 OperationTestBase::~OperationTestBase() { 51 OperationTestBase::~OperationTestBase() {
47 } 52 }
48 53
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 base::PostTaskAndReplyWithResult( 132 base::PostTaskAndReplyWithResult(
128 blocking_task_runner(), 133 blocking_task_runner(),
129 FROM_HERE, 134 FROM_HERE,
130 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, 135 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath,
131 base::Unretained(metadata()), path, entry), 136 base::Unretained(metadata()), path, entry),
132 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error))); 137 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error)));
133 test_util::RunBlockingPoolTask(); 138 test_util::RunBlockingPoolTask();
134 return error; 139 return error;
135 } 140 }
136 141
142 FileError OperationTestBase::GetLocalResourceEntryById(
143 const std::string& local_id,
144 ResourceEntry* entry) {
145 FileError error = FILE_ERROR_FAILED;
146 base::PostTaskAndReplyWithResult(
147 blocking_task_runner(),
148 FROM_HERE,
149 base::Bind(&internal::ResourceMetadata::GetResourceEntryById,
150 base::Unretained(metadata()), local_id, entry),
151 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error)));
152 test_util::RunBlockingPoolTask();
153 return error;
154 }
155
137 std::string OperationTestBase::GetLocalId(const base::FilePath& path) { 156 std::string OperationTestBase::GetLocalId(const base::FilePath& path) {
138 std::string local_id; 157 std::string local_id;
139 FileError error = FILE_ERROR_FAILED; 158 FileError error = FILE_ERROR_FAILED;
140 base::PostTaskAndReplyWithResult( 159 base::PostTaskAndReplyWithResult(
141 blocking_task_runner(), 160 blocking_task_runner(),
142 FROM_HERE, 161 FROM_HERE,
143 base::Bind(&internal::ResourceMetadata::GetIdByPath, 162 base::Bind(&internal::ResourceMetadata::GetIdByPath,
144 base::Unretained(metadata()), path, &local_id), 163 base::Unretained(metadata()), path, &local_id),
145 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error))); 164 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error)));
146 test_util::RunBlockingPoolTask(); 165 test_util::RunBlockingPoolTask();
147 EXPECT_EQ(FILE_ERROR_OK, error) << path.value(); 166 EXPECT_EQ(FILE_ERROR_OK, error) << path.value();
148 return local_id; 167 return local_id;
149 } 168 }
150 169
151 FileError OperationTestBase::CheckForUpdates() { 170 FileError OperationTestBase::CheckForUpdates() {
152 FileError error = FILE_ERROR_FAILED; 171 FileError error = FILE_ERROR_FAILED;
153 change_list_loader_->CheckForUpdates( 172 change_list_loader_->CheckForUpdates(
154 google_apis::test_util::CreateCopyResultCallback(&error)); 173 google_apis::test_util::CreateCopyResultCallback(&error));
155 test_util::RunBlockingPoolTask(); 174 test_util::RunBlockingPoolTask();
156 return error; 175 return error;
157 } 176 }
158 177
159 } // namespace file_system 178 } // namespace file_system
160 } // namespace drive 179 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698