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/gdata/gdata_mock.cc

Issue 9662041: Implement copy and move operations within the same remote file system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: rebase to HEAD Created 8 years, 9 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/gdata/gdata_mock.h" 5 #include "chrome/browser/chromeos/gdata/gdata_mock.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 MockDocumentsService::MockDocumentsService() { 44 MockDocumentsService::MockDocumentsService() {
45 ON_CALL(*this, Authenticate(_)) 45 ON_CALL(*this, Authenticate(_))
46 .WillByDefault(Invoke(this, &MockDocumentsService::AuthenticateStub)); 46 .WillByDefault(Invoke(this, &MockDocumentsService::AuthenticateStub));
47 ON_CALL(*this, GetDocuments(_, _)) 47 ON_CALL(*this, GetDocuments(_, _))
48 .WillByDefault(Invoke(this, &MockDocumentsService::GetDocumentsStub)); 48 .WillByDefault(Invoke(this, &MockDocumentsService::GetDocumentsStub));
49 ON_CALL(*this, DeleteDocument(_, _)) 49 ON_CALL(*this, DeleteDocument(_, _))
50 .WillByDefault(Invoke(this, &MockDocumentsService::DeleteDocumentStub)); 50 .WillByDefault(Invoke(this, &MockDocumentsService::DeleteDocumentStub));
51 ON_CALL(*this, DownloadDocument(_, _, _)) 51 ON_CALL(*this, DownloadDocument(_, _, _))
52 .WillByDefault(Invoke(this, &MockDocumentsService::DownloadDocumentStub)); 52 .WillByDefault(Invoke(this, &MockDocumentsService::DownloadDocumentStub));
53 ON_CALL(*this, CopyDocument(_, _, _))
54 .WillByDefault(Invoke(this, &MockDocumentsService::CopyDocumentStub));
55 ON_CALL(*this, RenameResource(_, _, _))
56 .WillByDefault(Invoke(this, &MockDocumentsService::RenameResourceStub));
57 ON_CALL(*this, AddResourceToDirectory(_, _, _))
58 .WillByDefault(
59 Invoke(this, &MockDocumentsService::AddResourceToDirectoryStub));
60 ON_CALL(*this, RemoveResourceFromDirectory(_, _, _, _))
61 .WillByDefault(
62 Invoke(this, &MockDocumentsService::RemoveResourceFromDirectoryStub));
53 ON_CALL(*this, CreateDirectory(_, _, _)) 63 ON_CALL(*this, CreateDirectory(_, _, _))
54 .WillByDefault(Invoke(this, &MockDocumentsService::CreateDirectoryStub)); 64 .WillByDefault(Invoke(this, &MockDocumentsService::CreateDirectoryStub));
55 ON_CALL(*this, DownloadFile(_, _)) 65 ON_CALL(*this, DownloadFile(_, _))
56 .WillByDefault(Invoke(this, &MockDocumentsService::DownloadFileStub)); 66 .WillByDefault(Invoke(this, &MockDocumentsService::DownloadFileStub));
57 67
58 // Fill in the default values for mock feeds. 68 // Fill in the default values for mock feeds.
59 feed_data_.reset(LoadJSONFile("basic_feed.json")); 69 feed_data_.reset(LoadJSONFile("basic_feed.json"));
60 directory_data_.reset(LoadJSONFile("subdir_feed.json")); 70 directory_data_.reset(LoadJSONFile("subdir_feed.json"));
61 } 71 }
62 72
(...skipping 25 matching lines...) Expand all
88 void MockDocumentsService::DownloadDocumentStub( 98 void MockDocumentsService::DownloadDocumentStub(
89 const GURL& content_url, 99 const GURL& content_url,
90 DocumentExportFormat format, 100 DocumentExportFormat format,
91 const DownloadActionCallback& callback) { 101 const DownloadActionCallback& callback) {
92 base::MessageLoopProxy::current()->PostTask( 102 base::MessageLoopProxy::current()->PostTask(
93 FROM_HERE, 103 FROM_HERE,
94 base::Bind(callback, HTTP_SUCCESS, content_url, 104 base::Bind(callback, HTTP_SUCCESS, content_url,
95 FilePath(content_url.host() + content_url.path()))); 105 FilePath(content_url.host() + content_url.path())));
96 } 106 }
97 107
108 void MockDocumentsService::CopyDocumentStub(
109 const GURL& document_url,
110 const FilePath::StringType& new_name,
111 const GetDataCallback& callback) {
112 base::MessageLoopProxy::current()->PostTask(
113 FROM_HERE,
114 base::Bind(callback, HTTP_SUCCESS, base::Passed(&document_data_)));
115 }
116
117 void MockDocumentsService::RenameResourceStub(
118 const GURL& resource_url,
119 const FilePath::StringType& new_name,
120 const EntryActionCallback& callback) {
121 base::MessageLoopProxy::current()->PostTask(
122 FROM_HERE,
123 base::Bind(callback, HTTP_SUCCESS, resource_url));
124 }
125
126 void MockDocumentsService::AddResourceToDirectoryStub(
127 const GURL& parent_content_url,
128 const GURL& resource_url,
129 const EntryActionCallback& callback) {
130 base::MessageLoopProxy::current()->PostTask(
131 FROM_HERE,
132 base::Bind(callback, HTTP_SUCCESS, resource_url));
133 }
134
135 void MockDocumentsService::RemoveResourceFromDirectoryStub(
136 const GURL& parent_content_url,
137 const GURL& resource_url,
138 const std::string& resource_id,
139 const EntryActionCallback& callback) {
140 base::MessageLoopProxy::current()->PostTask(
141 FROM_HERE,
142 base::Bind(callback, HTTP_SUCCESS, resource_url));
143 }
144
98 void MockDocumentsService::CreateDirectoryStub( 145 void MockDocumentsService::CreateDirectoryStub(
99 const GURL& parent_content_url, 146 const GURL& parent_content_url,
100 const FilePath::StringType& directory_name, 147 const FilePath::StringType& directory_name,
101 const GetDataCallback& callback) { 148 const GetDataCallback& callback) {
102 base::MessageLoopProxy::current()->PostTask( 149 base::MessageLoopProxy::current()->PostTask(
103 FROM_HERE, 150 FROM_HERE,
104 base::Bind(callback, HTTP_SUCCESS, base::Passed(&directory_data_))); 151 base::Bind(callback, HTTP_SUCCESS, base::Passed(&directory_data_)));
105 } 152 }
106 153
107 void MockDocumentsService::DownloadFileStub( 154 void MockDocumentsService::DownloadFileStub(
108 const GURL& content_url, 155 const GURL& content_url,
109 const DownloadActionCallback& callback) { 156 const DownloadActionCallback& callback) {
110 base::MessageLoopProxy::current()->PostTask( 157 base::MessageLoopProxy::current()->PostTask(
111 FROM_HERE, 158 FROM_HERE,
112 base::Bind(callback, HTTP_SUCCESS, content_url, FilePath( 159 base::Bind(callback, HTTP_SUCCESS, content_url, FilePath(
113 content_url.host() + content_url.path()))); 160 content_url.host() + content_url.path())));
114 } 161 }
115 162
116 } // namespace gdata 163 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_mock.h ('k') | webkit/chromeos/fileapi/remote_file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698