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

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

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/drive_api_requests.h" 5 #include "google_apis/drive/drive_api_requests.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 "\"selfLink\": \"self_link\",\n" 51 "\"selfLink\": \"self_link\",\n"
52 "}\n"; 52 "}\n";
53 53
54 const char kTestUploadExistingFilePath[] = "/upload/existingfile/path"; 54 const char kTestUploadExistingFilePath[] = "/upload/existingfile/path";
55 const char kTestUploadNewFilePath[] = "/upload/newfile/path"; 55 const char kTestUploadNewFilePath[] = "/upload/newfile/path";
56 const char kTestDownloadPathPrefix[] = "/host/"; 56 const char kTestDownloadPathPrefix[] = "/host/";
57 57
58 // Used as a GetContentCallback. 58 // Used as a GetContentCallback.
59 void AppendContent(std::string* out, 59 void AppendContent(std::string* out,
60 DriveApiErrorCode error, 60 DriveApiErrorCode error,
61 scoped_ptr<std::string> content) { 61 std::unique_ptr<std::string> content) {
62 EXPECT_EQ(HTTP_SUCCESS, error); 62 EXPECT_EQ(HTTP_SUCCESS, error);
63 out->append(*content); 63 out->append(*content);
64 } 64 }
65 65
66 class TestBatchableDelegate : public BatchableDelegate { 66 class TestBatchableDelegate : public BatchableDelegate {
67 public: 67 public:
68 TestBatchableDelegate(const GURL url, 68 TestBatchableDelegate(const GURL url,
69 const std::string& content_type, 69 const std::string& content_type,
70 const std::string& content_data, 70 const std::string& content_data,
71 const base::Closure& callback) 71 const base::Closure& callback)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 public_property.set_key("key2"); 184 public_property.set_key("key2");
185 public_property.set_value("value2"); 185 public_property.set_value("value2");
186 186
187 testing_properties_.clear(); 187 testing_properties_.clear();
188 testing_properties_.push_back(private_property); 188 testing_properties_.push_back(private_property);
189 testing_properties_.push_back(public_property); 189 testing_properties_.push_back(public_property);
190 } 190 }
191 191
192 base::MessageLoopForIO message_loop_; // Test server needs IO thread. 192 base::MessageLoopForIO message_loop_; // Test server needs IO thread.
193 net::EmbeddedTestServer test_server_; 193 net::EmbeddedTestServer test_server_;
194 scoped_ptr<RequestSender> request_sender_; 194 std::unique_ptr<RequestSender> request_sender_;
195 scoped_ptr<DriveApiUrlGenerator> url_generator_; 195 std::unique_ptr<DriveApiUrlGenerator> url_generator_;
196 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; 196 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_;
197 base::ScopedTempDir temp_dir_; 197 base::ScopedTempDir temp_dir_;
198 198
199 // This is a path to the file which contains expected response from 199 // This is a path to the file which contains expected response from
200 // the server. See also HandleDataFileRequest below. 200 // the server. See also HandleDataFileRequest below.
201 base::FilePath expected_data_file_path_; 201 base::FilePath expected_data_file_path_;
202 202
203 // This is a path string in the expected response header from the server 203 // This is a path string in the expected response header from the server
204 // for initiating file uploading. 204 // for initiating file uploading.
205 std::string expected_upload_path_; 205 std::string expected_upload_path_;
(...skipping 18 matching lines...) Expand all
224 private: 224 private:
225 void ResetExpectedResponse() { 225 void ResetExpectedResponse() {
226 expected_data_file_path_.clear(); 226 expected_data_file_path_.clear();
227 expected_upload_path_.clear(); 227 expected_upload_path_.clear();
228 expected_content_type_.clear(); 228 expected_content_type_.clear();
229 expected_content_.clear(); 229 expected_content_.clear();
230 } 230 }
231 231
232 // For "Children: delete" request, the server will return "204 No Content" 232 // For "Children: delete" request, the server will return "204 No Content"
233 // response meaning "success". 233 // response meaning "success".
234 scoped_ptr<net::test_server::HttpResponse> HandleChildrenDeleteRequest( 234 std::unique_ptr<net::test_server::HttpResponse> HandleChildrenDeleteRequest(
235 const net::test_server::HttpRequest& request) { 235 const net::test_server::HttpRequest& request) {
236 if (request.method != net::test_server::METHOD_DELETE || 236 if (request.method != net::test_server::METHOD_DELETE ||
237 request.relative_url.find("/children/") == std::string::npos) { 237 request.relative_url.find("/children/") == std::string::npos) {
238 // The request is not the "Children: delete" request. Delegate the 238 // The request is not the "Children: delete" request. Delegate the
239 // processing to the next handler. 239 // processing to the next handler.
240 return scoped_ptr<net::test_server::HttpResponse>(); 240 return std::unique_ptr<net::test_server::HttpResponse>();
241 } 241 }
242 242
243 http_request_ = request; 243 http_request_ = request;
244 244
245 // Return the response with just "204 No Content" status code. 245 // Return the response with just "204 No Content" status code.
246 scoped_ptr<net::test_server::BasicHttpResponse> http_response( 246 std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
247 new net::test_server::BasicHttpResponse); 247 new net::test_server::BasicHttpResponse);
248 http_response->set_code(net::HTTP_NO_CONTENT); 248 http_response->set_code(net::HTTP_NO_CONTENT);
249 return std::move(http_response); 249 return std::move(http_response);
250 } 250 }
251 251
252 // Reads the data file of |expected_data_file_path_| and returns its content 252 // Reads the data file of |expected_data_file_path_| and returns its content
253 // for the request. 253 // for the request.
254 // To use this method, it is necessary to set |expected_data_file_path_| 254 // To use this method, it is necessary to set |expected_data_file_path_|
255 // to the appropriate file path before sending the request to the server. 255 // to the appropriate file path before sending the request to the server.
256 scoped_ptr<net::test_server::HttpResponse> HandleDataFileRequest( 256 std::unique_ptr<net::test_server::HttpResponse> HandleDataFileRequest(
257 const net::test_server::HttpRequest& request) { 257 const net::test_server::HttpRequest& request) {
258 if (expected_data_file_path_.empty()) { 258 if (expected_data_file_path_.empty()) {
259 // The file is not specified. Delegate the processing to the next 259 // The file is not specified. Delegate the processing to the next
260 // handler. 260 // handler.
261 return scoped_ptr<net::test_server::HttpResponse>(); 261 return std::unique_ptr<net::test_server::HttpResponse>();
262 } 262 }
263 263
264 http_request_ = request; 264 http_request_ = request;
265 265
266 // Return the response from the data file. 266 // Return the response from the data file.
267 return test_util::CreateHttpResponseFromFile(expected_data_file_path_); 267 return test_util::CreateHttpResponseFromFile(expected_data_file_path_);
268 } 268 }
269 269
270 // Deletes the resource and returns no content with HTTP_NO_CONTENT status 270 // Deletes the resource and returns no content with HTTP_NO_CONTENT status
271 // code. 271 // code.
272 scoped_ptr<net::test_server::HttpResponse> HandleDeleteRequest( 272 std::unique_ptr<net::test_server::HttpResponse> HandleDeleteRequest(
273 const net::test_server::HttpRequest& request) { 273 const net::test_server::HttpRequest& request) {
274 if (request.method != net::test_server::METHOD_DELETE || 274 if (request.method != net::test_server::METHOD_DELETE ||
275 request.relative_url.find("/files/") == std::string::npos) { 275 request.relative_url.find("/files/") == std::string::npos) {
276 // The file is not file deletion request. Delegate the processing to the 276 // The file is not file deletion request. Delegate the processing to the
277 // next handler. 277 // next handler.
278 return scoped_ptr<net::test_server::HttpResponse>(); 278 return std::unique_ptr<net::test_server::HttpResponse>();
279 } 279 }
280 280
281 http_request_ = request; 281 http_request_ = request;
282 282
283 scoped_ptr<net::test_server::BasicHttpResponse> response( 283 std::unique_ptr<net::test_server::BasicHttpResponse> response(
284 new net::test_server::BasicHttpResponse); 284 new net::test_server::BasicHttpResponse);
285 response->set_code(net::HTTP_NO_CONTENT); 285 response->set_code(net::HTTP_NO_CONTENT);
286 286
287 return std::move(response); 287 return std::move(response);
288 } 288 }
289 289
290 // Returns PRECONDITION_FAILED response for ETag mismatching with error JSON 290 // Returns PRECONDITION_FAILED response for ETag mismatching with error JSON
291 // content specified by |expected_precondition_failed_file_path_|. 291 // content specified by |expected_precondition_failed_file_path_|.
292 // To use this method, it is necessary to set the variable to the appropriate 292 // To use this method, it is necessary to set the variable to the appropriate
293 // file path before sending the request to the server. 293 // file path before sending the request to the server.
294 scoped_ptr<net::test_server::HttpResponse> HandlePreconditionFailedRequest( 294 std::unique_ptr<net::test_server::HttpResponse>
295 HandlePreconditionFailedRequest(
295 const net::test_server::HttpRequest& request) { 296 const net::test_server::HttpRequest& request) {
296 if (expected_precondition_failed_file_path_.empty()) { 297 if (expected_precondition_failed_file_path_.empty()) {
297 // The file is not specified. Delegate the process to the next handler. 298 // The file is not specified. Delegate the process to the next handler.
298 return scoped_ptr<net::test_server::HttpResponse>(); 299 return std::unique_ptr<net::test_server::HttpResponse>();
299 } 300 }
300 301
301 http_request_ = request; 302 http_request_ = request;
302 303
303 scoped_ptr<net::test_server::BasicHttpResponse> response( 304 std::unique_ptr<net::test_server::BasicHttpResponse> response(
304 new net::test_server::BasicHttpResponse); 305 new net::test_server::BasicHttpResponse);
305 response->set_code(net::HTTP_PRECONDITION_FAILED); 306 response->set_code(net::HTTP_PRECONDITION_FAILED);
306 307
307 std::string content; 308 std::string content;
308 if (base::ReadFileToString(expected_precondition_failed_file_path_, 309 if (base::ReadFileToString(expected_precondition_failed_file_path_,
309 &content)) { 310 &content)) {
310 response->set_content(content); 311 response->set_content(content);
311 response->set_content_type("application/json"); 312 response->set_content_type("application/json");
312 } 313 }
313 314
314 return std::move(response); 315 return std::move(response);
315 } 316 }
316 317
317 // Returns the response based on set expected upload url. 318 // Returns the response based on set expected upload url.
318 // The response contains the url in its "Location: " header. Also, it doesn't 319 // The response contains the url in its "Location: " header. Also, it doesn't
319 // have any content. 320 // have any content.
320 // To use this method, it is necessary to set |expected_upload_path_| 321 // To use this method, it is necessary to set |expected_upload_path_|
321 // to the string representation of the url to be returned. 322 // to the string representation of the url to be returned.
322 scoped_ptr<net::test_server::HttpResponse> HandleInitiateUploadRequest( 323 std::unique_ptr<net::test_server::HttpResponse> HandleInitiateUploadRequest(
323 const net::test_server::HttpRequest& request) { 324 const net::test_server::HttpRequest& request) {
324 if (request.relative_url == expected_upload_path_ || 325 if (request.relative_url == expected_upload_path_ ||
325 expected_upload_path_.empty()) { 326 expected_upload_path_.empty()) {
326 // The request is for resume uploading or the expected upload url is not 327 // The request is for resume uploading or the expected upload url is not
327 // set. Delegate the processing to the next handler. 328 // set. Delegate the processing to the next handler.
328 return scoped_ptr<net::test_server::HttpResponse>(); 329 return std::unique_ptr<net::test_server::HttpResponse>();
329 } 330 }
330 331
331 http_request_ = request; 332 http_request_ = request;
332 333
333 scoped_ptr<net::test_server::BasicHttpResponse> response( 334 std::unique_ptr<net::test_server::BasicHttpResponse> response(
334 new net::test_server::BasicHttpResponse); 335 new net::test_server::BasicHttpResponse);
335 336
336 // Check if the X-Upload-Content-Length is present. If yes, store the 337 // Check if the X-Upload-Content-Length is present. If yes, store the
337 // length of the file. 338 // length of the file.
338 auto found = request.headers.find("X-Upload-Content-Length"); 339 auto found = request.headers.find("X-Upload-Content-Length");
339 if (found == request.headers.end() || 340 if (found == request.headers.end() ||
340 !base::StringToInt64(found->second, &content_length_)) { 341 !base::StringToInt64(found->second, &content_length_)) {
341 return scoped_ptr<net::test_server::HttpResponse>(); 342 return std::unique_ptr<net::test_server::HttpResponse>();
342 } 343 }
343 received_bytes_ = 0; 344 received_bytes_ = 0;
344 345
345 response->set_code(net::HTTP_OK); 346 response->set_code(net::HTTP_OK);
346 response->AddCustomHeader( 347 response->AddCustomHeader(
347 "Location", 348 "Location",
348 test_server_.base_url().Resolve(expected_upload_path_).spec()); 349 test_server_.base_url().Resolve(expected_upload_path_).spec());
349 return std::move(response); 350 return std::move(response);
350 } 351 }
351 352
352 scoped_ptr<net::test_server::HttpResponse> HandleResumeUploadRequest( 353 std::unique_ptr<net::test_server::HttpResponse> HandleResumeUploadRequest(
353 const net::test_server::HttpRequest& request) { 354 const net::test_server::HttpRequest& request) {
354 if (request.relative_url != expected_upload_path_) { 355 if (request.relative_url != expected_upload_path_) {
355 // The request path is different from the expected path for uploading. 356 // The request path is different from the expected path for uploading.
356 // Delegate the processing to the next handler. 357 // Delegate the processing to the next handler.
357 return scoped_ptr<net::test_server::HttpResponse>(); 358 return std::unique_ptr<net::test_server::HttpResponse>();
358 } 359 }
359 360
360 http_request_ = request; 361 http_request_ = request;
361 362
362 if (!request.content.empty()) { 363 if (!request.content.empty()) {
363 auto iter = request.headers.find("Content-Range"); 364 auto iter = request.headers.find("Content-Range");
364 if (iter == request.headers.end()) { 365 if (iter == request.headers.end()) {
365 // The range must be set. 366 // The range must be set.
366 return scoped_ptr<net::test_server::HttpResponse>(); 367 return std::unique_ptr<net::test_server::HttpResponse>();
367 } 368 }
368 369
369 int64_t length = 0; 370 int64_t length = 0;
370 int64_t start_position = 0; 371 int64_t start_position = 0;
371 int64_t end_position = 0; 372 int64_t end_position = 0;
372 if (!test_util::ParseContentRangeHeader( 373 if (!test_util::ParseContentRangeHeader(
373 iter->second, &start_position, &end_position, &length)) { 374 iter->second, &start_position, &end_position, &length)) {
374 // Invalid "Content-Range" value. 375 // Invalid "Content-Range" value.
375 return scoped_ptr<net::test_server::HttpResponse>(); 376 return std::unique_ptr<net::test_server::HttpResponse>();
376 } 377 }
377 378
378 EXPECT_EQ(start_position, received_bytes_); 379 EXPECT_EQ(start_position, received_bytes_);
379 EXPECT_EQ(length, content_length_); 380 EXPECT_EQ(length, content_length_);
380 381
381 // end_position is inclusive, but so +1 to change the range to byte size. 382 // end_position is inclusive, but so +1 to change the range to byte size.
382 received_bytes_ = end_position + 1; 383 received_bytes_ = end_position + 1;
383 } 384 }
384 385
385 if (received_bytes_ < content_length_) { 386 if (received_bytes_ < content_length_) {
386 scoped_ptr<net::test_server::BasicHttpResponse> response( 387 std::unique_ptr<net::test_server::BasicHttpResponse> response(
387 new net::test_server::BasicHttpResponse); 388 new net::test_server::BasicHttpResponse);
388 // Set RESUME INCOMPLETE (308) status code. 389 // Set RESUME INCOMPLETE (308) status code.
389 response->set_code(static_cast<net::HttpStatusCode>(308)); 390 response->set_code(static_cast<net::HttpStatusCode>(308));
390 391
391 // Add Range header to the response, based on the values of 392 // Add Range header to the response, based on the values of
392 // Content-Range header in the request. 393 // Content-Range header in the request.
393 // The header is annotated only when at least one byte is received. 394 // The header is annotated only when at least one byte is received.
394 if (received_bytes_ > 0) { 395 if (received_bytes_ > 0) {
395 response->AddCustomHeader( 396 response->AddCustomHeader(
396 "Range", "bytes=0-" + base::Int64ToString(received_bytes_ - 1)); 397 "Range", "bytes=0-" + base::Int64ToString(received_bytes_ - 1));
397 } 398 }
398 399
399 return std::move(response); 400 return std::move(response);
400 } 401 }
401 402
402 // All bytes are received. Return the "success" response with the file's 403 // All bytes are received. Return the "success" response with the file's
403 // (dummy) metadata. 404 // (dummy) metadata.
404 scoped_ptr<net::test_server::BasicHttpResponse> response = 405 std::unique_ptr<net::test_server::BasicHttpResponse> response =
405 test_util::CreateHttpResponseFromFile( 406 test_util::CreateHttpResponseFromFile(
406 test_util::GetTestFilePath("drive/file_entry.json")); 407 test_util::GetTestFilePath("drive/file_entry.json"));
407 408
408 // The response code is CREATED if it is new file uploading. 409 // The response code is CREATED if it is new file uploading.
409 if (http_request_.relative_url == kTestUploadNewFilePath) { 410 if (http_request_.relative_url == kTestUploadNewFilePath) {
410 response->set_code(net::HTTP_CREATED); 411 response->set_code(net::HTTP_CREATED);
411 } 412 }
412 413
413 return std::move(response); 414 return std::move(response);
414 } 415 }
415 416
416 // Returns the response based on set expected content and its type. 417 // Returns the response based on set expected content and its type.
417 // To use this method, both |expected_content_type_| and |expected_content_| 418 // To use this method, both |expected_content_type_| and |expected_content_|
418 // must be set in advance. 419 // must be set in advance.
419 scoped_ptr<net::test_server::HttpResponse> HandleContentResponse( 420 std::unique_ptr<net::test_server::HttpResponse> HandleContentResponse(
420 const net::test_server::HttpRequest& request) { 421 const net::test_server::HttpRequest& request) {
421 if (expected_content_type_.empty() || expected_content_.empty()) { 422 if (expected_content_type_.empty() || expected_content_.empty()) {
422 // Expected content is not set. Delegate the processing to the next 423 // Expected content is not set. Delegate the processing to the next
423 // handler. 424 // handler.
424 return scoped_ptr<net::test_server::HttpResponse>(); 425 return std::unique_ptr<net::test_server::HttpResponse>();
425 } 426 }
426 427
427 http_request_ = request; 428 http_request_ = request;
428 429
429 scoped_ptr<net::test_server::BasicHttpResponse> response( 430 std::unique_ptr<net::test_server::BasicHttpResponse> response(
430 new net::test_server::BasicHttpResponse); 431 new net::test_server::BasicHttpResponse);
431 response->set_code(net::HTTP_OK); 432 response->set_code(net::HTTP_OK);
432 response->set_content_type(expected_content_type_); 433 response->set_content_type(expected_content_type_);
433 response->set_content(expected_content_); 434 response->set_content(expected_content_);
434 return std::move(response); 435 return std::move(response);
435 } 436 }
436 437
437 // Handles a request for downloading a file. 438 // Handles a request for downloading a file.
438 scoped_ptr<net::test_server::HttpResponse> HandleDownloadRequest( 439 std::unique_ptr<net::test_server::HttpResponse> HandleDownloadRequest(
439 const net::test_server::HttpRequest& request) { 440 const net::test_server::HttpRequest& request) {
440 http_request_ = request; 441 http_request_ = request;
441 442
442 const GURL absolute_url = test_server_.GetURL(request.relative_url); 443 const GURL absolute_url = test_server_.GetURL(request.relative_url);
443 std::string id; 444 std::string id;
444 if (!test_util::RemovePrefix(absolute_url.path(), 445 if (!test_util::RemovePrefix(absolute_url.path(),
445 kTestDownloadPathPrefix, 446 kTestDownloadPathPrefix,
446 &id)) { 447 &id)) {
447 return scoped_ptr<net::test_server::HttpResponse>(); 448 return std::unique_ptr<net::test_server::HttpResponse>();
448 } 449 }
449 450
450 // For testing, returns a text with |id| repeated 3 times. 451 // For testing, returns a text with |id| repeated 3 times.
451 scoped_ptr<net::test_server::BasicHttpResponse> response( 452 std::unique_ptr<net::test_server::BasicHttpResponse> response(
452 new net::test_server::BasicHttpResponse); 453 new net::test_server::BasicHttpResponse);
453 response->set_code(net::HTTP_OK); 454 response->set_code(net::HTTP_OK);
454 response->set_content(id + id + id); 455 response->set_content(id + id + id);
455 response->set_content_type("text/plain"); 456 response->set_content_type("text/plain");
456 return std::move(response); 457 return std::move(response);
457 } 458 }
458 459
459 scoped_ptr<net::test_server::HttpResponse> HandleBatchUploadRequest( 460 std::unique_ptr<net::test_server::HttpResponse> HandleBatchUploadRequest(
460 const net::test_server::HttpRequest& request) { 461 const net::test_server::HttpRequest& request) {
461 http_request_ = request; 462 http_request_ = request;
462 463
463 const GURL absolute_url = test_server_.GetURL(request.relative_url); 464 const GURL absolute_url = test_server_.GetURL(request.relative_url);
464 std::string id; 465 std::string id;
465 if (absolute_url.path() != "/upload/drive") 466 if (absolute_url.path() != "/upload/drive")
466 return scoped_ptr<net::test_server::HttpResponse>(); 467 return std::unique_ptr<net::test_server::HttpResponse>();
467 468
468 scoped_ptr<net::test_server::BasicHttpResponse> response( 469 std::unique_ptr<net::test_server::BasicHttpResponse> response(
469 new net::test_server::BasicHttpResponse); 470 new net::test_server::BasicHttpResponse);
470 response->set_code(net::HTTP_OK); 471 response->set_code(net::HTTP_OK);
471 response->set_content_type("multipart/mixed; boundary=BOUNDARY"); 472 response->set_content_type("multipart/mixed; boundary=BOUNDARY");
472 response->set_content( 473 response->set_content(
473 "--BOUNDARY\r\n" 474 "--BOUNDARY\r\n"
474 "Content-Type: application/http\r\n" 475 "Content-Type: application/http\r\n"
475 "\r\n" 476 "\r\n"
476 "HTTP/1.1 200 OK\r\n" 477 "HTTP/1.1 200 OK\r\n"
477 "Content-Type: application/json; charset=UTF-8\r\n" 478 "Content-Type: application/json; charset=UTF-8\r\n"
478 "\r\n" 479 "\r\n"
(...skipping 22 matching lines...) Expand all
501 502
502 TEST_F(DriveApiRequestsTest, DriveApiDataRequest_Fields) { 503 TEST_F(DriveApiRequestsTest, DriveApiDataRequest_Fields) {
503 // Make sure that "fields" query param is supported by using its subclass, 504 // Make sure that "fields" query param is supported by using its subclass,
504 // AboutGetRequest. 505 // AboutGetRequest.
505 506
506 // Set an expected data file containing valid result. 507 // Set an expected data file containing valid result.
507 expected_data_file_path_ = test_util::GetTestFilePath( 508 expected_data_file_path_ = test_util::GetTestFilePath(
508 "drive/about.json"); 509 "drive/about.json");
509 510
510 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 511 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
511 scoped_ptr<AboutResource> about_resource; 512 std::unique_ptr<AboutResource> about_resource;
512 513
513 { 514 {
514 base::RunLoop run_loop; 515 base::RunLoop run_loop;
515 drive::AboutGetRequest* request = new drive::AboutGetRequest( 516 drive::AboutGetRequest* request = new drive::AboutGetRequest(
516 request_sender_.get(), 517 request_sender_.get(),
517 *url_generator_, 518 *url_generator_,
518 test_util::CreateQuitCallback( 519 test_util::CreateQuitCallback(
519 &run_loop, 520 &run_loop,
520 test_util::CreateCopyResultCallback(&error, &about_resource))); 521 test_util::CreateCopyResultCallback(&error, &about_resource)));
521 request->set_fields("kind,quotaBytesTotal,quotaBytesUsedAggregate," 522 request->set_fields("kind,quotaBytesTotal,quotaBytesUsedAggregate,"
522 "largestChangeId,rootFolderId"); 523 "largestChangeId,rootFolderId");
523 request_sender_->StartRequestWithAuthRetry(request); 524 request_sender_->StartRequestWithAuthRetry(request);
524 run_loop.Run(); 525 run_loop.Run();
525 } 526 }
526 527
527 EXPECT_EQ(HTTP_SUCCESS, error); 528 EXPECT_EQ(HTTP_SUCCESS, error);
528 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 529 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
529 EXPECT_EQ("/drive/v2/about?" 530 EXPECT_EQ("/drive/v2/about?"
530 "fields=kind%2CquotaBytesTotal%2CquotaBytesUsedAggregate%2C" 531 "fields=kind%2CquotaBytesTotal%2CquotaBytesUsedAggregate%2C"
531 "largestChangeId%2CrootFolderId", 532 "largestChangeId%2CrootFolderId",
532 http_request_.relative_url); 533 http_request_.relative_url);
533 534
534 scoped_ptr<AboutResource> expected( 535 std::unique_ptr<AboutResource> expected(
535 AboutResource::CreateFrom( 536 AboutResource::CreateFrom(*test_util::LoadJSONFile("drive/about.json")));
536 *test_util::LoadJSONFile("drive/about.json")));
537 ASSERT_TRUE(about_resource.get()); 537 ASSERT_TRUE(about_resource.get());
538 EXPECT_EQ(expected->largest_change_id(), about_resource->largest_change_id()); 538 EXPECT_EQ(expected->largest_change_id(), about_resource->largest_change_id());
539 EXPECT_EQ(expected->quota_bytes_total(), about_resource->quota_bytes_total()); 539 EXPECT_EQ(expected->quota_bytes_total(), about_resource->quota_bytes_total());
540 EXPECT_EQ(expected->quota_bytes_used_aggregate(), 540 EXPECT_EQ(expected->quota_bytes_used_aggregate(),
541 about_resource->quota_bytes_used_aggregate()); 541 about_resource->quota_bytes_used_aggregate());
542 EXPECT_EQ(expected->root_folder_id(), about_resource->root_folder_id()); 542 EXPECT_EQ(expected->root_folder_id(), about_resource->root_folder_id());
543 } 543 }
544 544
545 TEST_F(DriveApiRequestsTest, FilesInsertRequest) { 545 TEST_F(DriveApiRequestsTest, FilesInsertRequest) {
546 const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123}; 546 const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123};
547 const base::Time::Exploded kLastViewedByMeDate = 547 const base::Time::Exploded kLastViewedByMeDate =
548 {2013, 7, 0, 19, 15, 59, 13, 123}; 548 {2013, 7, 0, 19, 15, 59, 13, 123};
549 549
550 // Set an expected data file containing the directory's entry data. 550 // Set an expected data file containing the directory's entry data.
551 expected_data_file_path_ = 551 expected_data_file_path_ =
552 test_util::GetTestFilePath("drive/directory_entry.json"); 552 test_util::GetTestFilePath("drive/directory_entry.json");
553 553
554 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 554 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
555 scoped_ptr<FileResource> file_resource; 555 std::unique_ptr<FileResource> file_resource;
556 556
557 // Create "new directory" in the root directory. 557 // Create "new directory" in the root directory.
558 { 558 {
559 base::RunLoop run_loop; 559 base::RunLoop run_loop;
560 drive::FilesInsertRequest* request = new drive::FilesInsertRequest( 560 drive::FilesInsertRequest* request = new drive::FilesInsertRequest(
561 request_sender_.get(), 561 request_sender_.get(),
562 *url_generator_, 562 *url_generator_,
563 test_util::CreateQuitCallback( 563 test_util::CreateQuitCallback(
564 &run_loop, 564 &run_loop,
565 test_util::CreateCopyResultCallback(&error, &file_resource))); 565 test_util::CreateCopyResultCallback(&error, &file_resource)));
(...skipping 19 matching lines...) Expand all
585 "{\"lastViewedByMeDate\":\"2013-07-19T15:59:13.123Z\"," 585 "{\"lastViewedByMeDate\":\"2013-07-19T15:59:13.123Z\","
586 "\"mimeType\":\"application/vnd.google-apps.folder\"," 586 "\"mimeType\":\"application/vnd.google-apps.folder\","
587 "\"modifiedDate\":\"2012-07-19T15:59:13.123Z\"," 587 "\"modifiedDate\":\"2012-07-19T15:59:13.123Z\","
588 "\"parents\":[{\"id\":\"root\"}]," 588 "\"parents\":[{\"id\":\"root\"}],"
589 "\"properties\":[" 589 "\"properties\":["
590 "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"}," 590 "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"},"
591 "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}]," 591 "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}],"
592 "\"title\":\"new directory\"}", 592 "\"title\":\"new directory\"}",
593 http_request_.content); 593 http_request_.content);
594 594
595 scoped_ptr<FileResource> expected( 595 std::unique_ptr<FileResource> expected(FileResource::CreateFrom(
596 FileResource::CreateFrom( 596 *test_util::LoadJSONFile("drive/directory_entry.json")));
597 *test_util::LoadJSONFile("drive/directory_entry.json")));
598 597
599 // Sanity check. 598 // Sanity check.
600 ASSERT_TRUE(file_resource.get()); 599 ASSERT_TRUE(file_resource.get());
601 600
602 EXPECT_EQ(expected->file_id(), file_resource->file_id()); 601 EXPECT_EQ(expected->file_id(), file_resource->file_id());
603 EXPECT_EQ(expected->title(), file_resource->title()); 602 EXPECT_EQ(expected->title(), file_resource->title());
604 EXPECT_EQ(expected->mime_type(), file_resource->mime_type()); 603 EXPECT_EQ(expected->mime_type(), file_resource->mime_type());
605 EXPECT_EQ(expected->parents().size(), file_resource->parents().size()); 604 EXPECT_EQ(expected->parents().size(), file_resource->parents().size());
606 } 605 }
607 606
608 TEST_F(DriveApiRequestsTest, FilesPatchRequest) { 607 TEST_F(DriveApiRequestsTest, FilesPatchRequest) {
609 const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123}; 608 const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123};
610 const base::Time::Exploded kLastViewedByMeDate = 609 const base::Time::Exploded kLastViewedByMeDate =
611 {2013, 7, 0, 19, 15, 59, 13, 123}; 610 {2013, 7, 0, 19, 15, 59, 13, 123};
612 611
613 // Set an expected data file containing valid result. 612 // Set an expected data file containing valid result.
614 expected_data_file_path_ = 613 expected_data_file_path_ =
615 test_util::GetTestFilePath("drive/file_entry.json"); 614 test_util::GetTestFilePath("drive/file_entry.json");
616 615
617 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 616 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
618 scoped_ptr<FileResource> file_resource; 617 std::unique_ptr<FileResource> file_resource;
619 618
620 { 619 {
621 base::RunLoop run_loop; 620 base::RunLoop run_loop;
622 drive::FilesPatchRequest* request = new drive::FilesPatchRequest( 621 drive::FilesPatchRequest* request = new drive::FilesPatchRequest(
623 request_sender_.get(), 622 request_sender_.get(),
624 *url_generator_, 623 *url_generator_,
625 test_util::CreateQuitCallback( 624 test_util::CreateQuitCallback(
626 &run_loop, 625 &run_loop,
627 test_util::CreateCopyResultCallback(&error, &file_resource))); 626 test_util::CreateCopyResultCallback(&error, &file_resource)));
628 request->set_file_id("resource_id"); 627 request->set_file_id("resource_id");
(...skipping 30 matching lines...) Expand all
659 http_request_.content); 658 http_request_.content);
660 EXPECT_TRUE(file_resource); 659 EXPECT_TRUE(file_resource);
661 } 660 }
662 661
663 TEST_F(DriveApiRequestsTest, AboutGetRequest_ValidJson) { 662 TEST_F(DriveApiRequestsTest, AboutGetRequest_ValidJson) {
664 // Set an expected data file containing valid result. 663 // Set an expected data file containing valid result.
665 expected_data_file_path_ = test_util::GetTestFilePath( 664 expected_data_file_path_ = test_util::GetTestFilePath(
666 "drive/about.json"); 665 "drive/about.json");
667 666
668 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 667 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
669 scoped_ptr<AboutResource> about_resource; 668 std::unique_ptr<AboutResource> about_resource;
670 669
671 { 670 {
672 base::RunLoop run_loop; 671 base::RunLoop run_loop;
673 drive::AboutGetRequest* request = new drive::AboutGetRequest( 672 drive::AboutGetRequest* request = new drive::AboutGetRequest(
674 request_sender_.get(), 673 request_sender_.get(),
675 *url_generator_, 674 *url_generator_,
676 test_util::CreateQuitCallback( 675 test_util::CreateQuitCallback(
677 &run_loop, 676 &run_loop,
678 test_util::CreateCopyResultCallback(&error, &about_resource))); 677 test_util::CreateCopyResultCallback(&error, &about_resource)));
679 request_sender_->StartRequestWithAuthRetry(request); 678 request_sender_->StartRequestWithAuthRetry(request);
680 run_loop.Run(); 679 run_loop.Run();
681 } 680 }
682 681
683 EXPECT_EQ(HTTP_SUCCESS, error); 682 EXPECT_EQ(HTTP_SUCCESS, error);
684 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 683 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
685 EXPECT_EQ("/drive/v2/about", http_request_.relative_url); 684 EXPECT_EQ("/drive/v2/about", http_request_.relative_url);
686 685
687 scoped_ptr<AboutResource> expected( 686 std::unique_ptr<AboutResource> expected(
688 AboutResource::CreateFrom( 687 AboutResource::CreateFrom(*test_util::LoadJSONFile("drive/about.json")));
689 *test_util::LoadJSONFile("drive/about.json")));
690 ASSERT_TRUE(about_resource.get()); 688 ASSERT_TRUE(about_resource.get());
691 EXPECT_EQ(expected->largest_change_id(), about_resource->largest_change_id()); 689 EXPECT_EQ(expected->largest_change_id(), about_resource->largest_change_id());
692 EXPECT_EQ(expected->quota_bytes_total(), about_resource->quota_bytes_total()); 690 EXPECT_EQ(expected->quota_bytes_total(), about_resource->quota_bytes_total());
693 EXPECT_EQ(expected->quota_bytes_used_aggregate(), 691 EXPECT_EQ(expected->quota_bytes_used_aggregate(),
694 about_resource->quota_bytes_used_aggregate()); 692 about_resource->quota_bytes_used_aggregate());
695 EXPECT_EQ(expected->root_folder_id(), about_resource->root_folder_id()); 693 EXPECT_EQ(expected->root_folder_id(), about_resource->root_folder_id());
696 } 694 }
697 695
698 TEST_F(DriveApiRequestsTest, AboutGetRequest_InvalidJson) { 696 TEST_F(DriveApiRequestsTest, AboutGetRequest_InvalidJson) {
699 // Set an expected data file containing invalid result. 697 // Set an expected data file containing invalid result.
700 expected_data_file_path_ = test_util::GetTestFilePath( 698 expected_data_file_path_ = test_util::GetTestFilePath(
701 "drive/testfile.txt"); 699 "drive/testfile.txt");
702 700
703 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 701 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
704 scoped_ptr<AboutResource> about_resource; 702 std::unique_ptr<AboutResource> about_resource;
705 703
706 { 704 {
707 base::RunLoop run_loop; 705 base::RunLoop run_loop;
708 drive::AboutGetRequest* request = new drive::AboutGetRequest( 706 drive::AboutGetRequest* request = new drive::AboutGetRequest(
709 request_sender_.get(), 707 request_sender_.get(),
710 *url_generator_, 708 *url_generator_,
711 test_util::CreateQuitCallback( 709 test_util::CreateQuitCallback(
712 &run_loop, 710 &run_loop,
713 test_util::CreateCopyResultCallback(&error, &about_resource))); 711 test_util::CreateCopyResultCallback(&error, &about_resource)));
714 request_sender_->StartRequestWithAuthRetry(request); 712 request_sender_->StartRequestWithAuthRetry(request);
715 run_loop.Run(); 713 run_loop.Run();
716 } 714 }
717 715
718 // "parse error" should be returned, and the about resource should be NULL. 716 // "parse error" should be returned, and the about resource should be NULL.
719 EXPECT_EQ(DRIVE_PARSE_ERROR, error); 717 EXPECT_EQ(DRIVE_PARSE_ERROR, error);
720 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 718 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
721 EXPECT_EQ("/drive/v2/about", http_request_.relative_url); 719 EXPECT_EQ("/drive/v2/about", http_request_.relative_url);
722 EXPECT_FALSE(about_resource); 720 EXPECT_FALSE(about_resource);
723 } 721 }
724 722
725 TEST_F(DriveApiRequestsTest, AppsListRequest) { 723 TEST_F(DriveApiRequestsTest, AppsListRequest) {
726 // Set an expected data file containing valid result. 724 // Set an expected data file containing valid result.
727 expected_data_file_path_ = test_util::GetTestFilePath( 725 expected_data_file_path_ = test_util::GetTestFilePath(
728 "drive/applist.json"); 726 "drive/applist.json");
729 727
730 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 728 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
731 scoped_ptr<AppList> app_list; 729 std::unique_ptr<AppList> app_list;
732 730
733 { 731 {
734 base::RunLoop run_loop; 732 base::RunLoop run_loop;
735 drive::AppsListRequest* request = new drive::AppsListRequest( 733 drive::AppsListRequest* request = new drive::AppsListRequest(
736 request_sender_.get(), 734 request_sender_.get(),
737 *url_generator_, 735 *url_generator_,
738 false, // use_internal_endpoint 736 false, // use_internal_endpoint
739 test_util::CreateQuitCallback( 737 test_util::CreateQuitCallback(
740 &run_loop, 738 &run_loop,
741 test_util::CreateCopyResultCallback(&error, &app_list))); 739 test_util::CreateCopyResultCallback(&error, &app_list)));
742 request_sender_->StartRequestWithAuthRetry(request); 740 request_sender_->StartRequestWithAuthRetry(request);
743 run_loop.Run(); 741 run_loop.Run();
744 } 742 }
745 743
746 EXPECT_EQ(HTTP_SUCCESS, error); 744 EXPECT_EQ(HTTP_SUCCESS, error);
747 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 745 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
748 EXPECT_EQ("/drive/v2/apps", http_request_.relative_url); 746 EXPECT_EQ("/drive/v2/apps", http_request_.relative_url);
749 EXPECT_TRUE(app_list); 747 EXPECT_TRUE(app_list);
750 } 748 }
751 749
752 TEST_F(DriveApiRequestsTest, ChangesListRequest) { 750 TEST_F(DriveApiRequestsTest, ChangesListRequest) {
753 // Set an expected data file containing valid result. 751 // Set an expected data file containing valid result.
754 expected_data_file_path_ = test_util::GetTestFilePath( 752 expected_data_file_path_ = test_util::GetTestFilePath(
755 "drive/changelist.json"); 753 "drive/changelist.json");
756 754
757 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 755 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
758 scoped_ptr<ChangeList> result; 756 std::unique_ptr<ChangeList> result;
759 757
760 { 758 {
761 base::RunLoop run_loop; 759 base::RunLoop run_loop;
762 drive::ChangesListRequest* request = new drive::ChangesListRequest( 760 drive::ChangesListRequest* request = new drive::ChangesListRequest(
763 request_sender_.get(), *url_generator_, 761 request_sender_.get(), *url_generator_,
764 test_util::CreateQuitCallback( 762 test_util::CreateQuitCallback(
765 &run_loop, 763 &run_loop,
766 test_util::CreateCopyResultCallback(&error, &result))); 764 test_util::CreateCopyResultCallback(&error, &result)));
767 request->set_include_deleted(true); 765 request->set_include_deleted(true);
768 request->set_start_change_id(100); 766 request->set_start_change_id(100);
769 request->set_max_results(500); 767 request->set_max_results(500);
770 request_sender_->StartRequestWithAuthRetry(request); 768 request_sender_->StartRequestWithAuthRetry(request);
771 run_loop.Run(); 769 run_loop.Run();
772 } 770 }
773 771
774 EXPECT_EQ(HTTP_SUCCESS, error); 772 EXPECT_EQ(HTTP_SUCCESS, error);
775 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 773 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
776 EXPECT_EQ("/drive/v2/changes?maxResults=500&startChangeId=100", 774 EXPECT_EQ("/drive/v2/changes?maxResults=500&startChangeId=100",
777 http_request_.relative_url); 775 http_request_.relative_url);
778 EXPECT_TRUE(result); 776 EXPECT_TRUE(result);
779 } 777 }
780 778
781 TEST_F(DriveApiRequestsTest, ChangesListNextPageRequest) { 779 TEST_F(DriveApiRequestsTest, ChangesListNextPageRequest) {
782 // Set an expected data file containing valid result. 780 // Set an expected data file containing valid result.
783 expected_data_file_path_ = test_util::GetTestFilePath( 781 expected_data_file_path_ = test_util::GetTestFilePath(
784 "drive/changelist.json"); 782 "drive/changelist.json");
785 783
786 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 784 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
787 scoped_ptr<ChangeList> result; 785 std::unique_ptr<ChangeList> result;
788 786
789 { 787 {
790 base::RunLoop run_loop; 788 base::RunLoop run_loop;
791 drive::ChangesListNextPageRequest* request = 789 drive::ChangesListNextPageRequest* request =
792 new drive::ChangesListNextPageRequest( 790 new drive::ChangesListNextPageRequest(
793 request_sender_.get(), 791 request_sender_.get(),
794 test_util::CreateQuitCallback( 792 test_util::CreateQuitCallback(
795 &run_loop, 793 &run_loop,
796 test_util::CreateCopyResultCallback(&error, &result))); 794 test_util::CreateCopyResultCallback(&error, &result)));
797 request->set_next_link(test_server_.GetURL("/continue/get/change/list")); 795 request->set_next_link(test_server_.GetURL("/continue/get/change/list"));
798 request_sender_->StartRequestWithAuthRetry(request); 796 request_sender_->StartRequestWithAuthRetry(request);
799 run_loop.Run(); 797 run_loop.Run();
800 } 798 }
801 799
802 EXPECT_EQ(HTTP_SUCCESS, error); 800 EXPECT_EQ(HTTP_SUCCESS, error);
803 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 801 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
804 EXPECT_EQ("/continue/get/change/list", http_request_.relative_url); 802 EXPECT_EQ("/continue/get/change/list", http_request_.relative_url);
805 EXPECT_TRUE(result); 803 EXPECT_TRUE(result);
806 } 804 }
807 805
808 TEST_F(DriveApiRequestsTest, FilesCopyRequest) { 806 TEST_F(DriveApiRequestsTest, FilesCopyRequest) {
809 const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123}; 807 const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123};
810 808
811 // Set an expected data file containing the dummy file entry data. 809 // Set an expected data file containing the dummy file entry data.
812 // It'd be returned if we copy a file. 810 // It'd be returned if we copy a file.
813 expected_data_file_path_ = 811 expected_data_file_path_ =
814 test_util::GetTestFilePath("drive/file_entry.json"); 812 test_util::GetTestFilePath("drive/file_entry.json");
815 813
816 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 814 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
817 scoped_ptr<FileResource> file_resource; 815 std::unique_ptr<FileResource> file_resource;
818 816
819 // Copy the file to a new file named "new title". 817 // Copy the file to a new file named "new title".
820 { 818 {
821 base::RunLoop run_loop; 819 base::RunLoop run_loop;
822 drive::FilesCopyRequest* request = new drive::FilesCopyRequest( 820 drive::FilesCopyRequest* request = new drive::FilesCopyRequest(
823 request_sender_.get(), 821 request_sender_.get(),
824 *url_generator_, 822 *url_generator_,
825 test_util::CreateQuitCallback( 823 test_util::CreateQuitCallback(
826 &run_loop, 824 &run_loop,
827 test_util::CreateCopyResultCallback(&error, &file_resource))); 825 test_util::CreateCopyResultCallback(&error, &file_resource)));
(...skipping 20 matching lines...) Expand all
848 EXPECT_TRUE(file_resource); 846 EXPECT_TRUE(file_resource);
849 } 847 }
850 848
851 TEST_F(DriveApiRequestsTest, FilesCopyRequest_EmptyParentResourceId) { 849 TEST_F(DriveApiRequestsTest, FilesCopyRequest_EmptyParentResourceId) {
852 // Set an expected data file containing the dummy file entry data. 850 // Set an expected data file containing the dummy file entry data.
853 // It'd be returned if we copy a file. 851 // It'd be returned if we copy a file.
854 expected_data_file_path_ = 852 expected_data_file_path_ =
855 test_util::GetTestFilePath("drive/file_entry.json"); 853 test_util::GetTestFilePath("drive/file_entry.json");
856 854
857 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 855 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
858 scoped_ptr<FileResource> file_resource; 856 std::unique_ptr<FileResource> file_resource;
859 857
860 // Copy the file to a new file named "new title". 858 // Copy the file to a new file named "new title".
861 { 859 {
862 base::RunLoop run_loop; 860 base::RunLoop run_loop;
863 drive::FilesCopyRequest* request = new drive::FilesCopyRequest( 861 drive::FilesCopyRequest* request = new drive::FilesCopyRequest(
864 request_sender_.get(), 862 request_sender_.get(),
865 *url_generator_, 863 *url_generator_,
866 test_util::CreateQuitCallback( 864 test_util::CreateQuitCallback(
867 &run_loop, 865 &run_loop,
868 test_util::CreateCopyResultCallback(&error, &file_resource))); 866 test_util::CreateCopyResultCallback(&error, &file_resource)));
(...skipping 12 matching lines...) Expand all
881 EXPECT_EQ("{\"title\":\"new title\"}", http_request_.content); 879 EXPECT_EQ("{\"title\":\"new title\"}", http_request_.content);
882 EXPECT_TRUE(file_resource); 880 EXPECT_TRUE(file_resource);
883 } 881 }
884 882
885 TEST_F(DriveApiRequestsTest, FilesListRequest) { 883 TEST_F(DriveApiRequestsTest, FilesListRequest) {
886 // Set an expected data file containing valid result. 884 // Set an expected data file containing valid result.
887 expected_data_file_path_ = test_util::GetTestFilePath( 885 expected_data_file_path_ = test_util::GetTestFilePath(
888 "drive/filelist.json"); 886 "drive/filelist.json");
889 887
890 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 888 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
891 scoped_ptr<FileList> result; 889 std::unique_ptr<FileList> result;
892 890
893 { 891 {
894 base::RunLoop run_loop; 892 base::RunLoop run_loop;
895 drive::FilesListRequest* request = new drive::FilesListRequest( 893 drive::FilesListRequest* request = new drive::FilesListRequest(
896 request_sender_.get(), *url_generator_, 894 request_sender_.get(), *url_generator_,
897 test_util::CreateQuitCallback( 895 test_util::CreateQuitCallback(
898 &run_loop, 896 &run_loop,
899 test_util::CreateCopyResultCallback(&error, &result))); 897 test_util::CreateCopyResultCallback(&error, &result)));
900 request->set_max_results(50); 898 request->set_max_results(50);
901 request->set_q("\"abcde\" in parents"); 899 request->set_q("\"abcde\" in parents");
902 request_sender_->StartRequestWithAuthRetry(request); 900 request_sender_->StartRequestWithAuthRetry(request);
903 run_loop.Run(); 901 run_loop.Run();
904 } 902 }
905 903
906 EXPECT_EQ(HTTP_SUCCESS, error); 904 EXPECT_EQ(HTTP_SUCCESS, error);
907 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 905 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
908 EXPECT_EQ("/drive/v2/files?maxResults=50&q=%22abcde%22+in+parents", 906 EXPECT_EQ("/drive/v2/files?maxResults=50&q=%22abcde%22+in+parents",
909 http_request_.relative_url); 907 http_request_.relative_url);
910 EXPECT_TRUE(result); 908 EXPECT_TRUE(result);
911 } 909 }
912 910
913 TEST_F(DriveApiRequestsTest, FilesListNextPageRequest) { 911 TEST_F(DriveApiRequestsTest, FilesListNextPageRequest) {
914 // Set an expected data file containing valid result. 912 // Set an expected data file containing valid result.
915 expected_data_file_path_ = test_util::GetTestFilePath( 913 expected_data_file_path_ = test_util::GetTestFilePath(
916 "drive/filelist.json"); 914 "drive/filelist.json");
917 915
918 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 916 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
919 scoped_ptr<FileList> result; 917 std::unique_ptr<FileList> result;
920 918
921 { 919 {
922 base::RunLoop run_loop; 920 base::RunLoop run_loop;
923 drive::FilesListNextPageRequest* request = 921 drive::FilesListNextPageRequest* request =
924 new drive::FilesListNextPageRequest( 922 new drive::FilesListNextPageRequest(
925 request_sender_.get(), 923 request_sender_.get(),
926 test_util::CreateQuitCallback( 924 test_util::CreateQuitCallback(
927 &run_loop, 925 &run_loop,
928 test_util::CreateCopyResultCallback(&error, &result))); 926 test_util::CreateCopyResultCallback(&error, &result)));
929 request->set_next_link(test_server_.GetURL("/continue/get/file/list")); 927 request->set_next_link(test_server_.GetURL("/continue/get/file/list"));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 EXPECT_FALSE(http_request_.has_content); 959 EXPECT_FALSE(http_request_.has_content);
962 } 960 }
963 961
964 TEST_F(DriveApiRequestsTest, FilesTrashRequest) { 962 TEST_F(DriveApiRequestsTest, FilesTrashRequest) {
965 // Set data for the expected result. Directory entry should be returned 963 // Set data for the expected result. Directory entry should be returned
966 // if the trashing entry is a directory, so using it here should be fine. 964 // if the trashing entry is a directory, so using it here should be fine.
967 expected_data_file_path_ = 965 expected_data_file_path_ =
968 test_util::GetTestFilePath("drive/directory_entry.json"); 966 test_util::GetTestFilePath("drive/directory_entry.json");
969 967
970 DriveApiErrorCode error = DRIVE_OTHER_ERROR; 968 DriveApiErrorCode error = DRIVE_OTHER_ERROR;
971 scoped_ptr<FileResource> file_resource; 969 std::unique_ptr<FileResource> file_resource;
972 970
973 // Trash a resource with the given resource id. 971 // Trash a resource with the given resource id.
974 { 972 {
975 base::RunLoop run_loop; 973 base::RunLoop run_loop;
976 drive::FilesTrashRequest* request = new drive::FilesTrashRequest( 974 drive::FilesTrashRequest* request = new drive::FilesTrashRequest(
977 request_sender_.get(), 975 request_sender_.get(),
978 *url_generator_, 976 *url_generator_,
979 test_util::CreateQuitCallback( 977 test_util::CreateQuitCallback(
980 &run_loop, 978 &run_loop,
981 test_util::CreateCopyResultCallback(&error, &file_resource))); 979 test_util::CreateCopyResultCallback(&error, &file_resource)));
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 "\"kind\":\"drive#fileLink\"" 1098 "\"kind\":\"drive#fileLink\""
1101 "}]," 1099 "}],"
1102 "\"properties\":[" 1100 "\"properties\":["
1103 "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"}," 1101 "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"},"
1104 "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}]," 1102 "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}],"
1105 "\"title\":\"new file title\"}", 1103 "\"title\":\"new file title\"}",
1106 http_request_.content); 1104 http_request_.content);
1107 1105
1108 // Upload the content to the upload URL. 1106 // Upload the content to the upload URL.
1109 UploadRangeResponse response; 1107 UploadRangeResponse response;
1110 scoped_ptr<FileResource> new_entry; 1108 std::unique_ptr<FileResource> new_entry;
1111 1109
1112 { 1110 {
1113 base::RunLoop run_loop; 1111 base::RunLoop run_loop;
1114 drive::ResumeUploadRequest* resume_request = 1112 drive::ResumeUploadRequest* resume_request =
1115 new drive::ResumeUploadRequest( 1113 new drive::ResumeUploadRequest(
1116 request_sender_.get(), 1114 request_sender_.get(),
1117 upload_url, 1115 upload_url,
1118 0, // start_position 1116 0, // start_position
1119 kTestContent.size(), // end_position (exclusive) 1117 kTestContent.size(), // end_position (exclusive)
1120 kTestContent.size(), // content_length, 1118 kTestContent.size(), // content_length,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 EXPECT_TRUE(http_request_.has_content); 1189 EXPECT_TRUE(http_request_.has_content);
1192 EXPECT_EQ("{\"parents\":[{" 1190 EXPECT_EQ("{\"parents\":[{"
1193 "\"id\":\"parent_resource_id\"," 1191 "\"id\":\"parent_resource_id\","
1194 "\"kind\":\"drive#fileLink\"" 1192 "\"kind\":\"drive#fileLink\""
1195 "}]," 1193 "}],"
1196 "\"title\":\"new file title\"}", 1194 "\"title\":\"new file title\"}",
1197 http_request_.content); 1195 http_request_.content);
1198 1196
1199 // Upload the content to the upload URL. 1197 // Upload the content to the upload URL.
1200 UploadRangeResponse response; 1198 UploadRangeResponse response;
1201 scoped_ptr<FileResource> new_entry; 1199 std::unique_ptr<FileResource> new_entry;
1202 1200
1203 { 1201 {
1204 base::RunLoop run_loop; 1202 base::RunLoop run_loop;
1205 drive::ResumeUploadRequest* resume_request = 1203 drive::ResumeUploadRequest* resume_request =
1206 new drive::ResumeUploadRequest( 1204 new drive::ResumeUploadRequest(
1207 request_sender_.get(), 1205 request_sender_.get(),
1208 upload_url, 1206 upload_url,
1209 0, // start_position 1207 0, // start_position
1210 0, // end_position (exclusive) 1208 0, // end_position (exclusive)
1211 0, // content_length, 1209 0, // content_length,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 "\"id\":\"parent_resource_id\"," 1281 "\"id\":\"parent_resource_id\","
1284 "\"kind\":\"drive#fileLink\"" 1282 "\"kind\":\"drive#fileLink\""
1285 "}]," 1283 "}],"
1286 "\"title\":\"new file title\"}", 1284 "\"title\":\"new file title\"}",
1287 http_request_.content); 1285 http_request_.content);
1288 1286
1289 // Before sending any data, check the current status. 1287 // Before sending any data, check the current status.
1290 // This is an edge case test for GetUploadStatusRequest. 1288 // This is an edge case test for GetUploadStatusRequest.
1291 { 1289 {
1292 UploadRangeResponse response; 1290 UploadRangeResponse response;
1293 scoped_ptr<FileResource> new_entry; 1291 std::unique_ptr<FileResource> new_entry;
1294 1292
1295 // Check the response by GetUploadStatusRequest. 1293 // Check the response by GetUploadStatusRequest.
1296 { 1294 {
1297 base::RunLoop run_loop; 1295 base::RunLoop run_loop;
1298 drive::GetUploadStatusRequest* get_upload_status_request = 1296 drive::GetUploadStatusRequest* get_upload_status_request =
1299 new drive::GetUploadStatusRequest( 1297 new drive::GetUploadStatusRequest(
1300 request_sender_.get(), 1298 request_sender_.get(),
1301 upload_url, 1299 upload_url,
1302 kTestContent.size(), 1300 kTestContent.size(),
1303 test_util::CreateQuitCallback( 1301 test_util::CreateQuitCallback(
(...skipping 21 matching lines...) Expand all
1325 1323
1326 // Upload the content to the upload URL. 1324 // Upload the content to the upload URL.
1327 for (size_t start_position = 0; start_position < kTestContent.size(); 1325 for (size_t start_position = 0; start_position < kTestContent.size();
1328 start_position += kNumChunkBytes) { 1326 start_position += kNumChunkBytes) {
1329 const std::string payload = kTestContent.substr( 1327 const std::string payload = kTestContent.substr(
1330 start_position, 1328 start_position,
1331 std::min(kNumChunkBytes, kTestContent.size() - start_position)); 1329 std::min(kNumChunkBytes, kTestContent.size() - start_position));
1332 const size_t end_position = start_position + payload.size(); 1330 const size_t end_position = start_position + payload.size();
1333 1331
1334 UploadRangeResponse response; 1332 UploadRangeResponse response;
1335 scoped_ptr<FileResource> new_entry; 1333 std::unique_ptr<FileResource> new_entry;
1336 1334
1337 { 1335 {
1338 base::RunLoop run_loop; 1336 base::RunLoop run_loop;
1339 drive::ResumeUploadRequest* resume_request = 1337 drive::ResumeUploadRequest* resume_request =
1340 new drive::ResumeUploadRequest( 1338 new drive::ResumeUploadRequest(
1341 request_sender_.get(), 1339 request_sender_.get(),
1342 upload_url, 1340 upload_url,
1343 start_position, 1341 start_position,
1344 end_position, 1342 end_position,
1345 kTestContent.size(), // content_length, 1343 kTestContent.size(), // content_length,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 http_request_.relative_url); 1512 http_request_.relative_url);
1515 EXPECT_TRUE(http_request_.has_content); 1513 EXPECT_TRUE(http_request_.has_content);
1516 EXPECT_EQ( 1514 EXPECT_EQ(
1517 "{\"properties\":[" 1515 "{\"properties\":["
1518 "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"}," 1516 "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"},"
1519 "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}]}", 1517 "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}]}",
1520 http_request_.content); 1518 http_request_.content);
1521 1519
1522 // Upload the content to the upload URL. 1520 // Upload the content to the upload URL.
1523 UploadRangeResponse response; 1521 UploadRangeResponse response;
1524 scoped_ptr<FileResource> new_entry; 1522 std::unique_ptr<FileResource> new_entry;
1525 1523
1526 { 1524 {
1527 base::RunLoop run_loop; 1525 base::RunLoop run_loop;
1528 drive::ResumeUploadRequest* resume_request = 1526 drive::ResumeUploadRequest* resume_request =
1529 new drive::ResumeUploadRequest( 1527 new drive::ResumeUploadRequest(
1530 request_sender_.get(), 1528 request_sender_.get(),
1531 upload_url, 1529 upload_url,
1532 0, // start_position 1530 0, // start_position
1533 kTestContent.size(), // end_position (exclusive) 1531 kTestContent.size(), // end_position (exclusive)
1534 kTestContent.size(), // content_length, 1532 kTestContent.size(), // content_length,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 EXPECT_EQ(kTestETag, http_request_.headers["If-Match"]); 1599 EXPECT_EQ(kTestETag, http_request_.headers["If-Match"]);
1602 1600
1603 EXPECT_EQ(net::test_server::METHOD_PUT, http_request_.method); 1601 EXPECT_EQ(net::test_server::METHOD_PUT, http_request_.method);
1604 EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable", 1602 EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable",
1605 http_request_.relative_url); 1603 http_request_.relative_url);
1606 EXPECT_TRUE(http_request_.has_content); 1604 EXPECT_TRUE(http_request_.has_content);
1607 EXPECT_TRUE(http_request_.content.empty()); 1605 EXPECT_TRUE(http_request_.content.empty());
1608 1606
1609 // Upload the content to the upload URL. 1607 // Upload the content to the upload URL.
1610 UploadRangeResponse response; 1608 UploadRangeResponse response;
1611 scoped_ptr<FileResource> new_entry; 1609 std::unique_ptr<FileResource> new_entry;
1612 1610
1613 { 1611 {
1614 base::RunLoop run_loop; 1612 base::RunLoop run_loop;
1615 drive::ResumeUploadRequest* resume_request = 1613 drive::ResumeUploadRequest* resume_request =
1616 new drive::ResumeUploadRequest( 1614 new drive::ResumeUploadRequest(
1617 request_sender_.get(), 1615 request_sender_.get(),
1618 upload_url, 1616 upload_url,
1619 0, // start_position 1617 0, // start_position
1620 kTestContent.size(), // end_position (exclusive) 1618 kTestContent.size(), // end_position (exclusive)
1621 kTestContent.size(), // content_length, 1619 kTestContent.size(), // content_length,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 EXPECT_TRUE(http_request_.has_content); 1738 EXPECT_TRUE(http_request_.has_content);
1741 EXPECT_TRUE(http_request_.content.empty()); 1739 EXPECT_TRUE(http_request_.content.empty());
1742 1740
1743 // Set PRECONDITION_FAILED to the server. This is the emulation of the 1741 // Set PRECONDITION_FAILED to the server. This is the emulation of the
1744 // confliction during uploading. 1742 // confliction during uploading.
1745 expected_precondition_failed_file_path_ = 1743 expected_precondition_failed_file_path_ =
1746 test_util::GetTestFilePath("drive/error.json"); 1744 test_util::GetTestFilePath("drive/error.json");
1747 1745
1748 // Upload the content to the upload URL. 1746 // Upload the content to the upload URL.
1749 UploadRangeResponse response; 1747 UploadRangeResponse response;
1750 scoped_ptr<FileResource> new_entry; 1748 std::unique_ptr<FileResource> new_entry;
1751 1749
1752 { 1750 {
1753 base::RunLoop run_loop; 1751 base::RunLoop run_loop;
1754 drive::ResumeUploadRequest* resume_request = 1752 drive::ResumeUploadRequest* resume_request =
1755 new drive::ResumeUploadRequest( 1753 new drive::ResumeUploadRequest(
1756 request_sender_.get(), 1754 request_sender_.get(),
1757 upload_url, 1755 upload_url,
1758 0, // start_position 1756 0, // start_position
1759 kTestContent.size(), // end_position (exclusive) 1757 kTestContent.size(), // end_position (exclusive)
1760 kTestContent.size(), // content_length, 1758 kTestContent.size(), // content_length,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 request_sender_->StartRequestWithAuthRetry(request); 1942 request_sender_->StartRequestWithAuthRetry(request);
1945 run_loop.Run(); 1943 run_loop.Run();
1946 } 1944 }
1947 1945
1948 EXPECT_EQ(HTTP_SUCCESS, error); 1946 EXPECT_EQ(HTTP_SUCCESS, error);
1949 EXPECT_EQ(net::test_server::METHOD_POST, http_request_.method); 1947 EXPECT_EQ(net::test_server::METHOD_POST, http_request_.method);
1950 EXPECT_EQ("/drive/v2/files/resource_id/permissions", 1948 EXPECT_EQ("/drive/v2/files/resource_id/permissions",
1951 http_request_.relative_url); 1949 http_request_.relative_url);
1952 EXPECT_EQ("application/json", http_request_.headers["Content-Type"]); 1950 EXPECT_EQ("application/json", http_request_.headers["Content-Type"]);
1953 1951
1954 scoped_ptr<base::Value> expected = base::JSONReader::Read( 1952 std::unique_ptr<base::Value> expected = base::JSONReader::Read(
1955 "{\"additionalRoles\":[\"commenter\"], \"role\":\"reader\", " 1953 "{\"additionalRoles\":[\"commenter\"], \"role\":\"reader\", "
1956 "\"type\":\"user\",\"value\":\"user@example.com\"}"); 1954 "\"type\":\"user\",\"value\":\"user@example.com\"}");
1957 ASSERT_TRUE(expected); 1955 ASSERT_TRUE(expected);
1958 1956
1959 scoped_ptr<base::Value> result = 1957 std::unique_ptr<base::Value> result =
1960 base::JSONReader::Read(http_request_.content); 1958 base::JSONReader::Read(http_request_.content);
1961 EXPECT_TRUE(http_request_.has_content); 1959 EXPECT_TRUE(http_request_.has_content);
1962 EXPECT_TRUE(base::Value::Equals(expected.get(), result.get())); 1960 EXPECT_TRUE(base::Value::Equals(expected.get(), result.get()));
1963 1961
1964 // Add "can edit" permission to users in "example.com". 1962 // Add "can edit" permission to users in "example.com".
1965 error = DRIVE_OTHER_ERROR; 1963 error = DRIVE_OTHER_ERROR;
1966 { 1964 {
1967 base::RunLoop run_loop; 1965 base::RunLoop run_loop;
1968 drive::PermissionsInsertRequest* request = 1966 drive::PermissionsInsertRequest* request =
1969 new drive::PermissionsInsertRequest( 1967 new drive::PermissionsInsertRequest(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 ASSERT_TRUE(test_util::WriteStringToFile(kTestFilePath, kTestContent)); 2002 ASSERT_TRUE(test_util::WriteStringToFile(kTestFilePath, kTestContent));
2005 2003
2006 // Create batch request. 2004 // Create batch request.
2007 drive::BatchUploadRequest* const request = 2005 drive::BatchUploadRequest* const request =
2008 new drive::BatchUploadRequest(request_sender_.get(), *url_generator_); 2006 new drive::BatchUploadRequest(request_sender_.get(), *url_generator_);
2009 request->SetBoundaryForTesting("OUTERBOUNDARY"); 2007 request->SetBoundaryForTesting("OUTERBOUNDARY");
2010 request_sender_->StartRequestWithAuthRetry(request); 2008 request_sender_->StartRequestWithAuthRetry(request);
2011 2009
2012 // Create child request. 2010 // Create child request.
2013 DriveApiErrorCode errors[] = {DRIVE_OTHER_ERROR, DRIVE_OTHER_ERROR}; 2011 DriveApiErrorCode errors[] = {DRIVE_OTHER_ERROR, DRIVE_OTHER_ERROR};
2014 scoped_ptr<FileResource> file_resources[2]; 2012 std::unique_ptr<FileResource> file_resources[2];
2015 base::RunLoop run_loop[2]; 2013 base::RunLoop run_loop[2];
2016 for (int i = 0; i < 2; ++i) { 2014 for (int i = 0; i < 2; ++i) {
2017 const FileResourceCallback callback = test_util::CreateQuitCallback( 2015 const FileResourceCallback callback = test_util::CreateQuitCallback(
2018 &run_loop[i], 2016 &run_loop[i],
2019 test_util::CreateCopyResultCallback(&errors[i], &file_resources[i])); 2017 test_util::CreateCopyResultCallback(&errors[i], &file_resources[i]));
2020 drive::MultipartUploadNewFileDelegate* const child_request = 2018 drive::MultipartUploadNewFileDelegate* const child_request =
2021 new drive::MultipartUploadNewFileDelegate( 2019 new drive::MultipartUploadNewFileDelegate(
2022 request_sender_->blocking_task_runner(), 2020 request_sender_->blocking_task_runner(),
2023 base::StringPrintf("new file title %d", i), 2021 base::StringPrintf("new file title %d", i),
2024 "parent_resource_id", kTestContentType, kTestContent.size(), 2022 "parent_resource_id", kTestContentType, kTestContent.size(),
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 "Header: value\r\n" 2288 "Header: value\r\n"
2291 "\r\n" 2289 "\r\n"
2292 "BODY\r\n" 2290 "BODY\r\n"
2293 "--BOUNDARY-- \t", 2291 "--BOUNDARY-- \t",
2294 &parts)); 2292 &parts));
2295 ASSERT_EQ(1u, parts.size()); 2293 ASSERT_EQ(1u, parts.size());
2296 EXPECT_EQ(HTTP_SUCCESS, parts[0].code); 2294 EXPECT_EQ(HTTP_SUCCESS, parts[0].code);
2297 EXPECT_EQ("BODY", parts[0].body); 2295 EXPECT_EQ("BODY", parts[0].body);
2298 } 2296 }
2299 } // namespace google_apis 2297 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698