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

Side by Side Diff: chrome/browser/chromeos/gdata/mock_gdata_documents_service.cc

Issue 10383248: gdata: Add ability to fetch documents in a particular directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the build Created 8 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
« no previous file with comments | « chrome/browser/chromeos/gdata/mock_gdata_documents_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mock_gdata_documents_service.h" 5 #include "chrome/browser/chromeos/gdata/mock_gdata_documents_service.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 26 matching lines...) Expand all
37 EXPECT_TRUE(value) << 37 EXPECT_TRUE(value) <<
38 "Parse error " << path.value() << ": " << error; 38 "Parse error " << path.value() << ": " << error;
39 return value; 39 return value;
40 } 40 }
41 41
42 } // namespace 42 } // namespace
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, GetAccountMetadata(_)) 49 ON_CALL(*this, GetAccountMetadata(_))
50 .WillByDefault(Invoke(this, 50 .WillByDefault(Invoke(this,
51 &MockDocumentsService::GetAccountMetadataStub)); 51 &MockDocumentsService::GetAccountMetadataStub));
52 ON_CALL(*this, DeleteDocument(_, _)) 52 ON_CALL(*this, DeleteDocument(_, _))
53 .WillByDefault(Invoke(this, &MockDocumentsService::DeleteDocumentStub)); 53 .WillByDefault(Invoke(this, &MockDocumentsService::DeleteDocumentStub));
54 ON_CALL(*this, DownloadDocument(_, _, _, _, _)) 54 ON_CALL(*this, DownloadDocument(_, _, _, _, _))
55 .WillByDefault(Invoke(this, &MockDocumentsService::DownloadDocumentStub)); 55 .WillByDefault(Invoke(this, &MockDocumentsService::DownloadDocumentStub));
56 ON_CALL(*this, CopyDocument(_, _, _)) 56 ON_CALL(*this, CopyDocument(_, _, _))
57 .WillByDefault(Invoke(this, &MockDocumentsService::CopyDocumentStub)); 57 .WillByDefault(Invoke(this, &MockDocumentsService::CopyDocumentStub));
(...skipping 23 matching lines...) Expand all
81 const AuthStatusCallback& callback) { 81 const AuthStatusCallback& callback) {
82 base::MessageLoopProxy::current()->PostTask( 82 base::MessageLoopProxy::current()->PostTask(
83 FROM_HERE, 83 FROM_HERE,
84 base::Bind(callback, HTTP_SUCCESS, "my_auth_token")); 84 base::Bind(callback, HTTP_SUCCESS, "my_auth_token"));
85 } 85 }
86 86
87 void MockDocumentsService::GetDocumentsStub( 87 void MockDocumentsService::GetDocumentsStub(
88 const GURL& feed_url, 88 const GURL& feed_url,
89 int start_changestamp, 89 int start_changestamp,
90 const std::string& search_string, 90 const std::string& search_string,
91 const std::string& directory_resource_id,
91 const GetDataCallback& callback) { 92 const GetDataCallback& callback) {
92 if (search_string.empty()) { 93 if (search_string.empty()) {
93 base::MessageLoopProxy::current()->PostTask( 94 base::MessageLoopProxy::current()->PostTask(
94 FROM_HERE, 95 FROM_HERE,
95 base::Bind(callback, HTTP_SUCCESS, base::Passed(&feed_data_))); 96 base::Bind(callback, HTTP_SUCCESS, base::Passed(&feed_data_)));
96 } else { 97 } else {
97 base::MessageLoopProxy::current()->PostTask( 98 base::MessageLoopProxy::current()->PostTask(
98 FROM_HERE, 99 FROM_HERE,
99 base::Bind(callback, HTTP_SUCCESS, base::Passed(&search_result_))); 100 base::Bind(callback, HTTP_SUCCESS, base::Passed(&search_result_)));
100 } 101 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 ASSERT_EQ(file_data_size, 185 ASSERT_EQ(file_data_size,
185 file_util::WriteFile(local_tmp_path, file_data_->data(), 186 file_util::WriteFile(local_tmp_path, file_data_->data(),
186 file_data_size)); 187 file_data_size));
187 } 188 }
188 base::MessageLoopProxy::current()->PostTask( 189 base::MessageLoopProxy::current()->PostTask(
189 FROM_HERE, 190 FROM_HERE,
190 base::Bind(download_action_callback, error, content_url, local_tmp_path)); 191 base::Bind(download_action_callback, error, content_url, local_tmp_path));
191 } 192 }
192 193
193 } // namespace gdata 194 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/mock_gdata_documents_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698