| 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 "google_apis/drive/test_util.h" | 5 #include "google_apis/drive/test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 int64* end_position, | 126 int64* end_position, |
| 127 int64* length) { | 127 int64* length) { |
| 128 DCHECK(start_position); | 128 DCHECK(start_position); |
| 129 DCHECK(end_position); | 129 DCHECK(end_position); |
| 130 DCHECK(length); | 130 DCHECK(length); |
| 131 | 131 |
| 132 std::string remaining; | 132 std::string remaining; |
| 133 if (!RemovePrefix(value, "bytes ", &remaining)) | 133 if (!RemovePrefix(value, "bytes ", &remaining)) |
| 134 return false; | 134 return false; |
| 135 | 135 |
| 136 std::vector<base::StringPiece> parts = base::SplitStringPiece( | 136 std::vector<std::string> parts; |
| 137 remaining, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 137 base::SplitString(remaining, '/', &parts); |
| 138 if (parts.size() != 2U) | 138 if (parts.size() != 2U) |
| 139 return false; | 139 return false; |
| 140 | 140 |
| 141 const std::string range = parts[0]; |
| 141 if (!base::StringToInt64(parts[1], length)) | 142 if (!base::StringToInt64(parts[1], length)) |
| 142 return false; | 143 return false; |
| 143 | 144 |
| 144 parts = base::SplitStringPiece(parts[0], "-", base::TRIM_WHITESPACE, | 145 parts.clear(); |
| 145 base::SPLIT_WANT_ALL); | 146 base::SplitString(range, '-', &parts); |
| 146 if (parts.size() != 2U) | 147 if (parts.size() != 2U) |
| 147 return false; | 148 return false; |
| 148 | 149 |
| 149 return (base::StringToInt64(parts[0], start_position) && | 150 return (base::StringToInt64(parts[0], start_position) && |
| 150 base::StringToInt64(parts[1], end_position)); | 151 base::StringToInt64(parts[1], end_position)); |
| 151 } | 152 } |
| 152 | 153 |
| 153 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, | 154 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, |
| 154 int64 progress, | 155 int64 progress, |
| 155 int64 total) { | 156 int64 total) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 172 return result; | 173 return result; |
| 173 } | 174 } |
| 174 | 175 |
| 175 void TestGetContentCallback::OnGetContent(google_apis::DriveApiErrorCode error, | 176 void TestGetContentCallback::OnGetContent(google_apis::DriveApiErrorCode error, |
| 176 scoped_ptr<std::string> data) { | 177 scoped_ptr<std::string> data) { |
| 177 data_.push_back(data.release()); | 178 data_.push_back(data.release()); |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace test_util | 181 } // namespace test_util |
| 181 } // namespace google_apis | 182 } // namespace google_apis |
| OLD | NEW |