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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 } | 1200 } |
1201 | 1201 |
1202 if (content_length != end_position) { | 1202 if (content_length != end_position) { |
1203 session->uploaded_size = end_position; | 1203 session->uploaded_size = end_position; |
1204 completion_callback.Run(HTTP_RESUME_INCOMPLETE, | 1204 completion_callback.Run(HTTP_RESUME_INCOMPLETE, |
1205 scoped_ptr<ResourceEntry>()); | 1205 scoped_ptr<ResourceEntry>()); |
1206 return CancelCallback(); | 1206 return CancelCallback(); |
1207 } | 1207 } |
1208 | 1208 |
1209 std::string content_data; | 1209 std::string content_data; |
1210 if (!file_util::ReadFileToString(local_file_path, &content_data)) { | 1210 if (!base::ReadFileToString(local_file_path, &content_data)) { |
1211 session->uploaded_size = end_position; | 1211 session->uploaded_size = end_position; |
1212 completion_callback.Run(GDATA_FILE_ERROR, scoped_ptr<ResourceEntry>()); | 1212 completion_callback.Run(GDATA_FILE_ERROR, scoped_ptr<ResourceEntry>()); |
1213 return CancelCallback(); | 1213 return CancelCallback(); |
1214 } | 1214 } |
1215 session->uploaded_size = end_position; | 1215 session->uploaded_size = end_position; |
1216 | 1216 |
1217 // |resource_id| is empty if the upload is for new file. | 1217 // |resource_id| is empty if the upload is for new file. |
1218 if (session->resource_id.empty()) { | 1218 if (session->resource_id.empty()) { |
1219 DCHECK(!session->parent_resource_id.empty()); | 1219 DCHECK(!session->parent_resource_id.empty()); |
1220 DCHECK(!session->title.empty()); | 1220 DCHECK(!session->title.empty()); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 FROM_HERE, | 1640 FROM_HERE, |
1641 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); | 1641 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); |
1642 } | 1642 } |
1643 | 1643 |
1644 GURL FakeDriveService::GetNewUploadSessionUrl() { | 1644 GURL FakeDriveService::GetNewUploadSessionUrl() { |
1645 return GURL("https://upload_session_url/" + | 1645 return GURL("https://upload_session_url/" + |
1646 base::Int64ToString(next_upload_sequence_number_++)); | 1646 base::Int64ToString(next_upload_sequence_number_++)); |
1647 } | 1647 } |
1648 | 1648 |
1649 } // namespace drive | 1649 } // namespace drive |
OLD | NEW |