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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.cc

Issue 1873683002: Convert //chrome/browser/sync_file_system from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sync_file_system/drive_backend/fake_drive_uploader.h" 5 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "google_apis/drive/drive_api_parser.h" 12 #include "google_apis/drive/drive_api_parser.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using drive::FakeDriveService; 15 using drive::FakeDriveService;
16 using drive::UploadCompletionCallback; 16 using drive::UploadCompletionCallback;
17 using google_apis::CancelCallback; 17 using google_apis::CancelCallback;
18 using google_apis::FileResource; 18 using google_apis::FileResource;
19 using google_apis::FileResourceCallback; 19 using google_apis::FileResourceCallback;
20 using google_apis::DriveApiErrorCode; 20 using google_apis::DriveApiErrorCode;
21 using google_apis::ProgressCallback; 21 using google_apis::ProgressCallback;
22 22
23 namespace sync_file_system { 23 namespace sync_file_system {
24 namespace drive_backend { 24 namespace drive_backend {
25 25
26 namespace { 26 namespace {
27 27
28 void DidAddFileOrDirectoryForMakingConflict(DriveApiErrorCode error, 28 void DidAddFileOrDirectoryForMakingConflict(
29 scoped_ptr<FileResource> entry) { 29 DriveApiErrorCode error,
30 std::unique_ptr<FileResource> entry) {
30 ASSERT_EQ(google_apis::HTTP_CREATED, error); 31 ASSERT_EQ(google_apis::HTTP_CREATED, error);
31 ASSERT_TRUE(entry); 32 ASSERT_TRUE(entry);
32 } 33 }
33 34
34 void DidAddFileForUploadNew( 35 void DidAddFileForUploadNew(const UploadCompletionCallback& callback,
35 const UploadCompletionCallback& callback, 36 DriveApiErrorCode error,
36 DriveApiErrorCode error, 37 std::unique_ptr<FileResource> entry) {
37 scoped_ptr<FileResource> entry) {
38 ASSERT_EQ(google_apis::HTTP_CREATED, error); 38 ASSERT_EQ(google_apis::HTTP_CREATED, error);
39 ASSERT_TRUE(entry); 39 ASSERT_TRUE(entry);
40 base::ThreadTaskRunnerHandle::Get()->PostTask( 40 base::ThreadTaskRunnerHandle::Get()->PostTask(
41 FROM_HERE, 41 FROM_HERE,
42 base::Bind(callback, 42 base::Bind(callback,
43 google_apis::HTTP_SUCCESS, 43 google_apis::HTTP_SUCCESS,
44 GURL(), 44 GURL(),
45 base::Passed(&entry))); 45 base::Passed(&entry)));
46 } 46 }
47 47
48 void DidGetFileResourceForUploadExisting( 48 void DidGetFileResourceForUploadExisting(
49 const UploadCompletionCallback& callback, 49 const UploadCompletionCallback& callback,
50 DriveApiErrorCode error, 50 DriveApiErrorCode error,
51 scoped_ptr<FileResource> entry) { 51 std::unique_ptr<FileResource> entry) {
52 base::ThreadTaskRunnerHandle::Get()->PostTask( 52 base::ThreadTaskRunnerHandle::Get()->PostTask(
53 FROM_HERE, 53 FROM_HERE,
54 base::Bind(callback, 54 base::Bind(callback,
55 error, 55 error,
56 GURL(), 56 GURL(),
57 base::Passed(&entry))); 57 base::Passed(&entry)));
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const drive::UploadCompletionCallback& callback, 146 const drive::UploadCompletionCallback& callback,
147 const ProgressCallback& progress_callback) { 147 const ProgressCallback& progress_callback) {
148 // At the moment, sync file system doesn't support resuming of the uploading. 148 // At the moment, sync file system doesn't support resuming of the uploading.
149 // So this method shouldn't be reached. 149 // So this method shouldn't be reached.
150 NOTREACHED(); 150 NOTREACHED();
151 return CancelCallback(); 151 return CancelCallback();
152 } 152 }
153 153
154 } // namespace drive_backend 154 } // namespace drive_backend
155 } // namespace sync_file_system 155 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698