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

Side by Side Diff: google_apis/drive/test_util.cc

Issue 1272823003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | google_apis/gaia/fake_gaia.cc » ('j') | 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 "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
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<std::string> parts; 136 std::vector<base::StringPiece> parts = base::SplitStringPiece(
137 base::SplitString(remaining, '/', &parts); 137 remaining, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
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];
142 if (!base::StringToInt64(parts[1], length)) 141 if (!base::StringToInt64(parts[1], length))
143 return false; 142 return false;
144 143
145 parts.clear(); 144 parts = base::SplitStringPiece(parts[0], "-", base::TRIM_WHITESPACE,
146 base::SplitString(range, '-', &parts); 145 base::SPLIT_WANT_ALL);
147 if (parts.size() != 2U) 146 if (parts.size() != 2U)
148 return false; 147 return false;
149 148
150 return (base::StringToInt64(parts[0], start_position) && 149 return (base::StringToInt64(parts[0], start_position) &&
151 base::StringToInt64(parts[1], end_position)); 150 base::StringToInt64(parts[1], end_position));
152 } 151 }
153 152
154 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values, 153 void AppendProgressCallbackResult(std::vector<ProgressInfo>* progress_values,
155 int64 progress, 154 int64 progress,
156 int64 total) { 155 int64 total) {
(...skipping 16 matching lines...) Expand all
173 return result; 172 return result;
174 } 173 }
175 174
176 void TestGetContentCallback::OnGetContent(google_apis::DriveApiErrorCode error, 175 void TestGetContentCallback::OnGetContent(google_apis::DriveApiErrorCode error,
177 scoped_ptr<std::string> data) { 176 scoped_ptr<std::string> data) {
178 data_.push_back(data.release()); 177 data_.push_back(data.release());
179 } 178 }
180 179
181 } // namespace test_util 180 } // namespace test_util
182 } // namespace google_apis 181 } // namespace google_apis
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.cc ('k') | google_apis/gaia/fake_gaia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698