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/google_apis/mock_drive_service.h" | 5 #include "chrome/browser/google_apis/mock_drive_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/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 test_util::LoadJSONFile("gdata/new_folder_entry.json"); | 55 test_util::LoadJSONFile("gdata/new_folder_entry.json"); |
56 } | 56 } |
57 | 57 |
58 MockDriveService::~MockDriveService() {} | 58 MockDriveService::~MockDriveService() {} |
59 | 59 |
60 void MockDriveService::set_search_result( | 60 void MockDriveService::set_search_result( |
61 const std::string& search_result_feed) { | 61 const std::string& search_result_feed) { |
62 search_result_ = test_util::LoadJSONFile(search_result_feed); | 62 search_result_ = test_util::LoadJSONFile(search_result_feed); |
63 } | 63 } |
64 | 64 |
65 void MockDriveService::AuthenticateStub( | |
66 const AuthStatusCallback& callback) { | |
67 base::MessageLoopProxy::current()->PostTask( | |
68 FROM_HERE, | |
69 base::Bind(callback, HTTP_SUCCESS, "my_auth_token")); | |
70 } | |
71 | |
72 void MockDriveService::GetDocumentsStub( | 65 void MockDriveService::GetDocumentsStub( |
73 const GURL& feed_url, | 66 const GURL& feed_url, |
74 int64 start_changestamp, | 67 int64 start_changestamp, |
75 const std::string& search_string, | 68 const std::string& search_string, |
76 bool shared_with_me, | 69 bool shared_with_me, |
77 const std::string& directory_resource_id, | 70 const std::string& directory_resource_id, |
78 const GetDataCallback& callback) { | 71 const GetDataCallback& callback) { |
79 if (search_string.empty()) { | 72 if (search_string.empty()) { |
80 base::MessageLoopProxy::current()->PostTask( | 73 base::MessageLoopProxy::current()->PostTask( |
81 FROM_HERE, | 74 FROM_HERE, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 ASSERT_EQ(file_data_size, | 169 ASSERT_EQ(file_data_size, |
177 file_util::WriteFile(local_tmp_path, file_data_->data(), | 170 file_util::WriteFile(local_tmp_path, file_data_->data(), |
178 file_data_size)); | 171 file_data_size)); |
179 } | 172 } |
180 base::MessageLoopProxy::current()->PostTask( | 173 base::MessageLoopProxy::current()->PostTask( |
181 FROM_HERE, | 174 FROM_HERE, |
182 base::Bind(download_action_callback, error, local_tmp_path)); | 175 base::Bind(download_action_callback, error, local_tmp_path)); |
183 } | 176 } |
184 | 177 |
185 } // namespace google_apis | 178 } // namespace google_apis |
OLD | NEW |