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 "chrome/browser/drive/fake_drive_service.h" | 5 #include "chrome/browser/drive/fake_drive_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 : largest_changestamp_(0), | 169 : largest_changestamp_(0), |
170 published_date_seq_(0), | 170 published_date_seq_(0), |
171 next_upload_sequence_number_(0), | 171 next_upload_sequence_number_(0), |
172 default_max_results_(0), | 172 default_max_results_(0), |
173 resource_id_count_(0), | 173 resource_id_count_(0), |
174 resource_list_load_count_(0), | 174 resource_list_load_count_(0), |
175 change_list_load_count_(0), | 175 change_list_load_count_(0), |
176 directory_load_count_(0), | 176 directory_load_count_(0), |
177 about_resource_load_count_(0), | 177 about_resource_load_count_(0), |
178 app_list_load_count_(0), | 178 app_list_load_count_(0), |
179 offline_(false) { | 179 blocked_resource_list_load_count_(0), |
| 180 offline_(false), |
| 181 never_return_all_resource_list_(false) { |
180 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 182 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
181 } | 183 } |
182 | 184 |
183 FakeDriveService::~FakeDriveService() { | 185 FakeDriveService::~FakeDriveService() { |
184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
185 } | 187 } |
186 | 188 |
187 bool FakeDriveService::LoadResourceListForWapi( | 189 bool FakeDriveService::LoadResourceListForWapi( |
188 const std::string& relative_path) { | 190 const std::string& relative_path) { |
189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 323 |
322 std::string FakeDriveService::GetRootResourceId() const { | 324 std::string FakeDriveService::GetRootResourceId() const { |
323 return "fake_root"; | 325 return "fake_root"; |
324 } | 326 } |
325 | 327 |
326 CancelCallback FakeDriveService::GetAllResourceList( | 328 CancelCallback FakeDriveService::GetAllResourceList( |
327 const GetResourceListCallback& callback) { | 329 const GetResourceListCallback& callback) { |
328 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
329 DCHECK(!callback.is_null()); | 331 DCHECK(!callback.is_null()); |
330 | 332 |
| 333 if (never_return_all_resource_list_) { |
| 334 ++blocked_resource_list_load_count_; |
| 335 return CancelCallback(); |
| 336 } |
| 337 |
331 GetResourceListInternal(0, // start changestamp | 338 GetResourceListInternal(0, // start changestamp |
332 std::string(), // empty search query | 339 std::string(), // empty search query |
333 std::string(), // no directory resource id, | 340 std::string(), // no directory resource id, |
334 0, // start offset | 341 0, // start offset |
335 default_max_results_, | 342 default_max_results_, |
336 &resource_list_load_count_, | 343 &resource_list_load_count_, |
337 callback); | 344 callback); |
338 return CancelCallback(); | 345 return CancelCallback(); |
339 } | 346 } |
340 | 347 |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 FROM_HERE, | 1657 FROM_HERE, |
1651 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); | 1658 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); |
1652 } | 1659 } |
1653 | 1660 |
1654 GURL FakeDriveService::GetNewUploadSessionUrl() { | 1661 GURL FakeDriveService::GetNewUploadSessionUrl() { |
1655 return GURL("https://upload_session_url/" + | 1662 return GURL("https://upload_session_url/" + |
1656 base::Int64ToString(next_upload_sequence_number_++)); | 1663 base::Int64ToString(next_upload_sequence_number_++)); |
1657 } | 1664 } |
1658 | 1665 |
1659 } // namespace drive | 1666 } // namespace drive |
OLD | NEW |