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

Side by Side Diff: chrome/browser/sync_file_system/drive/api_util_unittest.cc

Issue 17291017: SyncFS: Use ScopedDisableDriveAPI in APIUtilTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/sync_file_system/drive/api_util.h" 5 #include "chrome/browser/sync_file_system/drive/api_util.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 api_util_ = APIUtil::CreateForTesting( 262 api_util_ = APIUtil::CreateForTesting(
263 &profile_, 263 &profile_,
264 scoped_ptr<DriveServiceInterface>(fake_drive_service_), 264 scoped_ptr<DriveServiceInterface>(fake_drive_service_),
265 scoped_ptr<DriveUploaderInterface>(fake_drive_uploader_)); 265 scoped_ptr<DriveUploaderInterface>(fake_drive_uploader_));
266 266
267 fake_drive_service_->LoadResourceListForWapi( 267 fake_drive_service_->LoadResourceListForWapi(
268 "chromeos/sync_file_system/initialize.json"); 268 "chromeos/sync_file_system/initialize.json");
269 } 269 }
270 270
271 virtual void TearDown() OVERRIDE { 271 virtual void TearDown() OVERRIDE {
272 SetDisableDriveAPI(false);
273 api_util_.reset(); 272 api_util_.reset();
274 } 273 }
275 274
276 protected: 275 protected:
277 void SetUpSyncRootDirectory() { 276 void SetUpSyncRootDirectory() {
278 fake_drive_service()->AddNewDirectory( 277 fake_drive_service()->AddNewDirectory(
279 fake_drive_service_->GetRootResourceId(), 278 fake_drive_service_->GetRootResourceId(),
280 APIUtil::GetSyncRootDirectoryName(), 279 APIUtil::GetSyncRootDirectoryName(),
281 base::Bind(&DidAddNewDirectory, &sync_root_resource_id_)); 280 base::Bind(&DidAddNewDirectory, &sync_root_resource_id_));
282 message_loop()->RunUntilIdle(); 281 message_loop()->RunUntilIdle();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 FakeDriveServiceWrapper* fake_drive_service() { 329 FakeDriveServiceWrapper* fake_drive_service() {
331 return fake_drive_service_; 330 return fake_drive_service_;
332 } 331 }
333 332
334 FakeDriveUploader* fake_drive_uploader() { 333 FakeDriveUploader* fake_drive_uploader() {
335 return fake_drive_uploader_; 334 return fake_drive_uploader_;
336 } 335 }
337 336
338 base::MessageLoop* message_loop() { return &message_loop_; } 337 base::MessageLoop* message_loop() { return &message_loop_; }
339 338
340 void GetSyncRoot_Body(); 339 void TestGetSyncRoot();
341 void CreateSyncRoot_Body(); 340 void TestCreateSyncRoot();
342 void CreateSyncRoot_Conflict_Body(); 341 void TestCreateSyncRoot_Conflict();
343 void GetOriginDirectory_Body(); 342 void TestGetOriginDirectory();
344 void CreateOriginDirectory_Body(); 343 void TestCreateOriginDirectory();
345 void CreateOriginDirectory_Conflict_Body(); 344 void TestCreateOriginDirectory_Conflict();
346 void GetLargestChangeStamp_Body(); 345 void TestGetLargestChangeStamp();
347 void ListFiles_Body(); 346 void TestListFiles();
348 void ListChanges_Body(); 347 void TestListChanges();
349 void DownloadFile_Body(); 348 void TestDownloadFile();
350 void DownloadFileInNotModified_Body(); 349 void TestDownloadFileInNotModified();
351 void UploadNewFile_Body(); 350 void TestUploadNewFile();
352 void UploadNewFile_ConflictWithFile_Body(); 351 void TestUploadNewFile_ConflictWithFile();
353 void UploadExistingFile_Body(); 352 void TestUploadExistingFile();
354 void UploadExistingFileInConflict_Body(); 353 void TestUploadExistingFileInConflict();
355 void DeleteFile_Body(); 354 void TestDeleteFile();
356 void DeleteFileInConflict_Body(); 355 void TestDeleteFileInConflict();
357 void CreateDirectory_Body(); 356 void TestCreateDirectory();
358 357
359 private: 358 private:
360 base::MessageLoop message_loop_; 359 base::MessageLoop message_loop_;
361 content::TestBrowserThread ui_thread_; 360 content::TestBrowserThread ui_thread_;
362 361
363 std::string sync_root_resource_id_; 362 std::string sync_root_resource_id_;
364 std::string origin_root_resource_id_; 363 std::string origin_root_resource_id_;
365 364
366 TestingProfile profile_; 365 TestingProfile profile_;
367 scoped_ptr<APIUtil> api_util_; 366 scoped_ptr<APIUtil> api_util_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 431 }
433 432
434 void DidDeleteFile(bool* done_out, 433 void DidDeleteFile(bool* done_out,
435 GDataErrorCode* error_out, 434 GDataErrorCode* error_out,
436 GDataErrorCode error) { 435 GDataErrorCode error) {
437 EXPECT_FALSE(*done_out); 436 EXPECT_FALSE(*done_out);
438 *done_out = true; 437 *done_out = true;
439 *error_out = error; 438 *error_out = error;
440 } 439 }
441 440
442 void APIUtilTest::GetSyncRoot_Body() { 441 void APIUtilTest::TestGetSyncRoot() {
443 fake_drive_service()->LoadAccountMetadataForWapi( 442 fake_drive_service()->LoadAccountMetadataForWapi(
444 "chromeos/sync_file_system/account_metadata.json"); 443 "chromeos/sync_file_system/account_metadata.json");
445 SetUpSyncRootDirectory(); 444 SetUpSyncRootDirectory();
446 445
447 bool done = false; 446 bool done = false;
448 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 447 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
449 std::string resource_id; 448 std::string resource_id;
450 api_util()->GetDriveDirectoryForSyncRoot( 449 api_util()->GetDriveDirectoryForSyncRoot(
451 base::Bind(&DidGetResourceID, &done, &error, &resource_id)); 450 base::Bind(&DidGetResourceID, &done, &error, &resource_id));
452 message_loop()->RunUntilIdle(); 451 message_loop()->RunUntilIdle();
453 452
454 EXPECT_TRUE(done); 453 EXPECT_TRUE(done);
455 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 454 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
456 EXPECT_EQ(GetSyncRootResourceId(), resource_id); 455 EXPECT_EQ(GetSyncRootResourceId(), resource_id);
457 } 456 }
458 457
459 void APIUtilTest::CreateSyncRoot_Body() { 458 void APIUtilTest::TestCreateSyncRoot() {
460 fake_drive_service()->LoadAccountMetadataForWapi( 459 fake_drive_service()->LoadAccountMetadataForWapi(
461 "chromeos/sync_file_system/account_metadata.json"); 460 "chromeos/sync_file_system/account_metadata.json");
462 bool done = false; 461 bool done = false;
463 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 462 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
464 std::string resource_id; 463 std::string resource_id;
465 api_util()->GetDriveDirectoryForSyncRoot( 464 api_util()->GetDriveDirectoryForSyncRoot(
466 base::Bind(&DidGetResourceID, &done, &error, &resource_id)); 465 base::Bind(&DidGetResourceID, &done, &error, &resource_id));
467 message_loop()->RunUntilIdle(); 466 message_loop()->RunUntilIdle();
468 467
469 EXPECT_TRUE(done); 468 EXPECT_TRUE(done);
470 EXPECT_EQ(google_apis::HTTP_CREATED, error); 469 EXPECT_EQ(google_apis::HTTP_CREATED, error);
471 EXPECT_FALSE(resource_id.empty()); 470 EXPECT_FALSE(resource_id.empty());
472 471
473 fake_drive_service()->SearchByTitle( 472 fake_drive_service()->SearchByTitle(
474 APIUtil::GetSyncRootDirectoryName(), 473 APIUtil::GetSyncRootDirectoryName(),
475 std::string(), // directory_resource_id 474 std::string(), // directory_resource_id
476 base::Bind(&VerifyTitleUniqueness, 475 base::Bind(&VerifyTitleUniqueness,
477 FROM_HERE, 476 FROM_HERE,
478 resource_id, 477 resource_id,
479 google_apis::ENTRY_KIND_FOLDER)); 478 google_apis::ENTRY_KIND_FOLDER));
480 message_loop()->RunUntilIdle(); 479 message_loop()->RunUntilIdle();
481 } 480 }
482 481
483 void APIUtilTest::CreateSyncRoot_Conflict_Body() { 482 void APIUtilTest::TestCreateSyncRoot_Conflict() {
484 fake_drive_service()->LoadAccountMetadataForWapi( 483 fake_drive_service()->LoadAccountMetadataForWapi(
485 "chromeos/sync_file_system/account_metadata.json"); 484 "chromeos/sync_file_system/account_metadata.json");
486 fake_drive_service()->set_make_directory_conflict(true); 485 fake_drive_service()->set_make_directory_conflict(true);
487 486
488 bool done = false; 487 bool done = false;
489 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 488 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
490 std::string resource_id; 489 std::string resource_id;
491 api_util()->GetDriveDirectoryForSyncRoot( 490 api_util()->GetDriveDirectoryForSyncRoot(
492 base::Bind(&DidGetResourceID, &done, &error, &resource_id)); 491 base::Bind(&DidGetResourceID, &done, &error, &resource_id));
493 message_loop()->RunUntilIdle(); 492 message_loop()->RunUntilIdle();
494 493
495 EXPECT_TRUE(done); 494 EXPECT_TRUE(done);
496 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 495 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
497 EXPECT_FALSE(resource_id.empty()); 496 EXPECT_FALSE(resource_id.empty());
498 497
499 // Verify that there is no duplicated directory on the remote side. 498 // Verify that there is no duplicated directory on the remote side.
500 fake_drive_service()->SearchByTitle( 499 fake_drive_service()->SearchByTitle(
501 APIUtil::GetSyncRootDirectoryName(), 500 APIUtil::GetSyncRootDirectoryName(),
502 std::string(), // directory_resource_id 501 std::string(), // directory_resource_id
503 base::Bind(&VerifyTitleUniqueness, 502 base::Bind(&VerifyTitleUniqueness,
504 FROM_HERE, 503 FROM_HERE,
505 resource_id, 504 resource_id,
506 google_apis::ENTRY_KIND_FOLDER)); 505 google_apis::ENTRY_KIND_FOLDER));
507 message_loop()->RunUntilIdle(); 506 message_loop()->RunUntilIdle();
508 } 507 }
509 508
510 void APIUtilTest::GetOriginDirectory_Body() { 509 void APIUtilTest::TestGetOriginDirectory() {
511 SetUpSyncRootDirectory(); 510 SetUpSyncRootDirectory();
512 SetUpOriginRootDirectory(); 511 SetUpOriginRootDirectory();
513 512
514 bool done = false; 513 bool done = false;
515 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 514 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
516 std::string resource_id; 515 std::string resource_id;
517 api_util()->GetDriveDirectoryForOrigin( 516 api_util()->GetDriveDirectoryForOrigin(
518 GetSyncRootResourceId(), 517 GetSyncRootResourceId(),
519 GURL(kOrigin), 518 GURL(kOrigin),
520 base::Bind(&DidGetResourceID, &done, &error, &resource_id)); 519 base::Bind(&DidGetResourceID, &done, &error, &resource_id));
521 message_loop()->RunUntilIdle(); 520 message_loop()->RunUntilIdle();
522 521
523 EXPECT_TRUE(done); 522 EXPECT_TRUE(done);
524 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 523 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
525 EXPECT_EQ(GetOriginRootResourceId(), resource_id); 524 EXPECT_EQ(GetOriginRootResourceId(), resource_id);
526 } 525 }
527 526
528 void APIUtilTest::CreateOriginDirectory_Body() { 527 void APIUtilTest::TestCreateOriginDirectory() {
529 SetUpSyncRootDirectory(); 528 SetUpSyncRootDirectory();
530 529
531 bool done = false; 530 bool done = false;
532 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 531 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
533 std::string resource_id; 532 std::string resource_id;
534 api_util()->GetDriveDirectoryForOrigin( 533 api_util()->GetDriveDirectoryForOrigin(
535 GetSyncRootResourceId(), 534 GetSyncRootResourceId(),
536 GURL(kOrigin), 535 GURL(kOrigin),
537 base::Bind(&DidGetResourceID, &done, &error, &resource_id)); 536 base::Bind(&DidGetResourceID, &done, &error, &resource_id));
538 message_loop()->RunUntilIdle(); 537 message_loop()->RunUntilIdle();
539 538
540 EXPECT_TRUE(done); 539 EXPECT_TRUE(done);
541 EXPECT_EQ(google_apis::HTTP_CREATED, error); 540 EXPECT_EQ(google_apis::HTTP_CREATED, error);
542 EXPECT_FALSE(resource_id.empty()); 541 EXPECT_FALSE(resource_id.empty());
543 542
544 fake_drive_service()->SearchByTitle( 543 fake_drive_service()->SearchByTitle(
545 kOriginDirectoryName, 544 kOriginDirectoryName,
546 GetSyncRootResourceId(), 545 GetSyncRootResourceId(),
547 base::Bind(&VerifyTitleUniqueness, 546 base::Bind(&VerifyTitleUniqueness,
548 FROM_HERE, 547 FROM_HERE,
549 resource_id, 548 resource_id,
550 google_apis::ENTRY_KIND_FOLDER)); 549 google_apis::ENTRY_KIND_FOLDER));
551 message_loop()->RunUntilIdle(); 550 message_loop()->RunUntilIdle();
552 } 551 }
553 552
554 void APIUtilTest::CreateOriginDirectory_Conflict_Body() { 553 void APIUtilTest::TestCreateOriginDirectory_Conflict() {
555 SetUpSyncRootDirectory(); 554 SetUpSyncRootDirectory();
556 fake_drive_service()->set_make_directory_conflict(true); 555 fake_drive_service()->set_make_directory_conflict(true);
557 556
558 bool done = false; 557 bool done = false;
559 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 558 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
560 std::string resource_id; 559 std::string resource_id;
561 api_util()->GetDriveDirectoryForOrigin( 560 api_util()->GetDriveDirectoryForOrigin(
562 GetSyncRootResourceId(), 561 GetSyncRootResourceId(),
563 GURL(kOrigin), 562 GURL(kOrigin),
564 base::Bind(&DidGetResourceID, &done, &error, &resource_id)); 563 base::Bind(&DidGetResourceID, &done, &error, &resource_id));
565 message_loop()->RunUntilIdle(); 564 message_loop()->RunUntilIdle();
566 565
567 EXPECT_TRUE(done); 566 EXPECT_TRUE(done);
568 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 567 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
569 EXPECT_FALSE(resource_id.empty()); 568 EXPECT_FALSE(resource_id.empty());
570 569
571 // Verify that there is no duplicated directory on the remote side. 570 // Verify that there is no duplicated directory on the remote side.
572 fake_drive_service()->SearchByTitle( 571 fake_drive_service()->SearchByTitle(
573 kOriginDirectoryName, 572 kOriginDirectoryName,
574 GetSyncRootResourceId(), 573 GetSyncRootResourceId(),
575 base::Bind(&VerifyTitleUniqueness, 574 base::Bind(&VerifyTitleUniqueness,
576 FROM_HERE, 575 FROM_HERE,
577 resource_id, 576 resource_id,
578 google_apis::ENTRY_KIND_FOLDER)); 577 google_apis::ENTRY_KIND_FOLDER));
579 message_loop()->RunUntilIdle(); 578 message_loop()->RunUntilIdle();
580 } 579 }
581 580
582 void APIUtilTest::GetLargestChangeStamp_Body() { 581 void APIUtilTest::TestGetLargestChangeStamp() {
583 fake_drive_service()->LoadAccountMetadataForWapi( 582 fake_drive_service()->LoadAccountMetadataForWapi(
584 "chromeos/sync_file_system/account_metadata.json"); 583 "chromeos/sync_file_system/account_metadata.json");
585 584
586 bool done = false; 585 bool done = false;
587 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 586 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
588 int64 largest_changestamp = -1; 587 int64 largest_changestamp = -1;
589 api_util()->GetLargestChangeStamp(base::Bind( 588 api_util()->GetLargestChangeStamp(base::Bind(
590 &DidGetLargestChangeStamp, &done, &error, &largest_changestamp)); 589 &DidGetLargestChangeStamp, &done, &error, &largest_changestamp));
591 message_loop()->RunUntilIdle(); 590 message_loop()->RunUntilIdle();
592 591
593 EXPECT_TRUE(done); 592 EXPECT_TRUE(done);
594 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 593 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
595 EXPECT_EQ(654321, largest_changestamp); 594 EXPECT_EQ(654321, largest_changestamp);
596 } 595 }
597 596
598 void APIUtilTest::ListFiles_Body() { 597 void APIUtilTest::TestListFiles() {
599 fake_drive_service()->set_default_max_results(3); 598 fake_drive_service()->set_default_max_results(3);
600 599
601 SetUpSyncRootDirectory(); 600 SetUpSyncRootDirectory();
602 SetUpOriginRootDirectory(); 601 SetUpOriginRootDirectory();
603 602
604 int kNumberOfFiles = 5; 603 int kNumberOfFiles = 5;
605 for (int i = 0; i < kNumberOfFiles; ++i) { 604 for (int i = 0; i < kNumberOfFiles; ++i) {
606 std::string file_resource_id; 605 std::string file_resource_id;
607 std::string file_md5; 606 std::string file_md5;
608 std::string file_content = base::StringPrintf("test content %d", i); 607 std::string file_content = base::StringPrintf("test content %d", i);
(...skipping 22 matching lines...) Expand all
631 630
632 api_util()->ContinueListing( 631 api_util()->ContinueListing(
633 feed_url, base::Bind(&DidGetResourceList, &done, &error, &document_feed)); 632 feed_url, base::Bind(&DidGetResourceList, &done, &error, &document_feed));
634 message_loop()->RunUntilIdle(); 633 message_loop()->RunUntilIdle();
635 634
636 EXPECT_TRUE(done); 635 EXPECT_TRUE(done);
637 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 636 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
638 EXPECT_EQ(2U, document_feed->entries().size()); 637 EXPECT_EQ(2U, document_feed->entries().size());
639 } 638 }
640 639
641 void APIUtilTest::ListChanges_Body() { 640 void APIUtilTest::TestListChanges() {
642 const int64 kStartChangestamp = 6; 641 const int64 kStartChangestamp = 6;
643 642
644 SetUpSyncRootDirectory(); 643 SetUpSyncRootDirectory();
645 SetUpOriginRootDirectory(); 644 SetUpOriginRootDirectory();
646 645
647 // Files should have changestamp #4+ since creating the sync root directory is 646 // Files should have changestamp #4+ since creating the sync root directory is
648 // #1, moving it out of 'My Drive' is #2, and creating the origin root 647 // #1, moving it out of 'My Drive' is #2, and creating the origin root
649 // directory is #3. 648 // directory is #3.
650 const int kNumberOfFiles = 5; 649 const int kNumberOfFiles = 5;
651 for (int i = 0; i < kNumberOfFiles; ++i) { 650 for (int i = 0; i < kNumberOfFiles; ++i) {
(...skipping 23 matching lines...) Expand all
675 kStartChangestamp, 674 kStartChangestamp,
676 base::Bind(&DidGetResourceList, &done, &error, &document_feed)); 675 base::Bind(&DidGetResourceList, &done, &error, &document_feed));
677 message_loop()->RunUntilIdle(); 676 message_loop()->RunUntilIdle();
678 677
679 // There should be 3 files which have changestamp #6+. 678 // There should be 3 files which have changestamp #6+.
680 EXPECT_TRUE(done); 679 EXPECT_TRUE(done);
681 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 680 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
682 EXPECT_EQ(3U, document_feed->entries().size()); 681 EXPECT_EQ(3U, document_feed->entries().size());
683 } 682 }
684 683
685 void APIUtilTest::DownloadFile_Body() { 684 void APIUtilTest::TestDownloadFile() {
686 const std::string kFileContent = "test content"; 685 const std::string kFileContent = "test content";
687 const std::string kFileTitle = "test.txt"; 686 const std::string kFileTitle = "test.txt";
688 687
689 SetUpSyncRootDirectory(); 688 SetUpSyncRootDirectory();
690 SetUpOriginRootDirectory(); 689 SetUpOriginRootDirectory();
691 std::string file_resource_id; 690 std::string file_resource_id;
692 std::string file_md5; 691 std::string file_md5;
693 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5); 692 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5);
694 693
695 base::ScopedTempDir temp_dir; 694 base::ScopedTempDir temp_dir;
696 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 695 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
697 const base::FilePath kOutputFilePath = 696 const base::FilePath kOutputFilePath =
698 temp_dir.path().AppendASCII(kFileTitle); 697 temp_dir.path().AppendASCII(kFileTitle);
699 698
700 bool done = false; 699 bool done = false;
701 std::string downloaded_file_md5; 700 std::string downloaded_file_md5;
702 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 701 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
703 api_util()->DownloadFile( 702 api_util()->DownloadFile(
704 file_resource_id, 703 file_resource_id,
705 "", // local_file_md5 704 "", // local_file_md5
706 kOutputFilePath, 705 kOutputFilePath,
707 base::Bind(&DidDownloadFile, &done, &downloaded_file_md5, &error)); 706 base::Bind(&DidDownloadFile, &done, &downloaded_file_md5, &error));
708 message_loop()->RunUntilIdle(); 707 message_loop()->RunUntilIdle();
709 708
710 EXPECT_TRUE(done); 709 EXPECT_TRUE(done);
711 EXPECT_EQ(file_md5, downloaded_file_md5); 710 EXPECT_EQ(file_md5, downloaded_file_md5);
712 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 711 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
713 } 712 }
714 713
715 void APIUtilTest::DownloadFileInNotModified_Body() { 714 void APIUtilTest::TestDownloadFileInNotModified() {
716 const std::string kFileContent = "test content"; 715 const std::string kFileContent = "test content";
717 const std::string kFileTitle = "test.txt"; 716 const std::string kFileTitle = "test.txt";
718 717
719 SetUpSyncRootDirectory(); 718 SetUpSyncRootDirectory();
720 SetUpOriginRootDirectory(); 719 SetUpOriginRootDirectory();
721 std::string file_resource_id; 720 std::string file_resource_id;
722 std::string file_md5; 721 std::string file_md5;
723 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5); 722 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5);
724 723
725 base::ScopedTempDir temp_dir; 724 base::ScopedTempDir temp_dir;
(...skipping 13 matching lines...) Expand all
739 kOutputFilePath, 738 kOutputFilePath,
740 base::Bind(&DidDownloadFile, &done, &downloaded_file_md5, &error)); 739 base::Bind(&DidDownloadFile, &done, &downloaded_file_md5, &error));
741 message_loop()->RunUntilIdle(); 740 message_loop()->RunUntilIdle();
742 741
743 EXPECT_TRUE(done); 742 EXPECT_TRUE(done);
744 EXPECT_EQ(google_apis::HTTP_NOT_MODIFIED, error); 743 EXPECT_EQ(google_apis::HTTP_NOT_MODIFIED, error);
745 // TODO(nhiroki): Compare |file_md5| and |downloaded_file_md5| after making 744 // TODO(nhiroki): Compare |file_md5| and |downloaded_file_md5| after making
746 // FakeDriveService::AddNewEntry set the correct MD5. 745 // FakeDriveService::AddNewEntry set the correct MD5.
747 } 746 }
748 747
749 void APIUtilTest::UploadNewFile_Body() { 748 void APIUtilTest::TestUploadNewFile() {
750 const std::string kFileTitle = "test.txt"; 749 const std::string kFileTitle = "test.txt";
751 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); 750 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file"));
752 751
753 SetUpSyncRootDirectory(); 752 SetUpSyncRootDirectory();
754 SetUpOriginRootDirectory(); 753 SetUpOriginRootDirectory();
755 754
756 bool done = false; 755 bool done = false;
757 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 756 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
758 std::string resource_id; 757 std::string resource_id;
759 api_util()->UploadNewFile( 758 api_util()->UploadNewFile(
(...skipping 10 matching lines...) Expand all
770 fake_drive_service()->SearchByTitle( 769 fake_drive_service()->SearchByTitle(
771 kFileTitle, 770 kFileTitle,
772 GetOriginRootResourceId(), 771 GetOriginRootResourceId(),
773 base::Bind(&VerifyTitleUniqueness, 772 base::Bind(&VerifyTitleUniqueness,
774 FROM_HERE, 773 FROM_HERE,
775 resource_id, 774 resource_id,
776 google_apis::ENTRY_KIND_FILE)); 775 google_apis::ENTRY_KIND_FILE));
777 message_loop()->RunUntilIdle(); 776 message_loop()->RunUntilIdle();
778 } 777 }
779 778
780 void APIUtilTest::UploadNewFile_ConflictWithFile_Body() { 779 void APIUtilTest::TestUploadNewFile_ConflictWithFile() {
781 const std::string kFileTitle = "test.txt"; 780 const std::string kFileTitle = "test.txt";
782 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); 781 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file"));
783 782
784 fake_drive_uploader()->set_make_file_conflict(true); 783 fake_drive_uploader()->set_make_file_conflict(true);
785 784
786 SetUpSyncRootDirectory(); 785 SetUpSyncRootDirectory();
787 SetUpOriginRootDirectory(); 786 SetUpOriginRootDirectory();
788 787
789 bool done = false; 788 bool done = false;
790 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 789 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
(...skipping 14 matching lines...) Expand all
805 fake_drive_service()->SearchByTitle( 804 fake_drive_service()->SearchByTitle(
806 kFileTitle, 805 kFileTitle,
807 GetOriginRootResourceId(), 806 GetOriginRootResourceId(),
808 base::Bind(&VerifyTitleUniqueness, 807 base::Bind(&VerifyTitleUniqueness,
809 FROM_HERE, 808 FROM_HERE,
810 resource_id, 809 resource_id,
811 google_apis::ENTRY_KIND_FILE)); 810 google_apis::ENTRY_KIND_FILE));
812 message_loop()->RunUntilIdle(); 811 message_loop()->RunUntilIdle();
813 } 812 }
814 813
815 void APIUtilTest::UploadExistingFile_Body() { 814 void APIUtilTest::TestUploadExistingFile() {
816 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); 815 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file"));
817 const std::string kFileContent = "test content"; 816 const std::string kFileContent = "test content";
818 const std::string kFileTitle = "test.txt"; 817 const std::string kFileTitle = "test.txt";
819 818
820 SetUpSyncRootDirectory(); 819 SetUpSyncRootDirectory();
821 SetUpOriginRootDirectory(); 820 SetUpOriginRootDirectory();
822 std::string file_resource_id; 821 std::string file_resource_id;
823 std::string file_md5; 822 std::string file_md5;
824 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5); 823 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5);
825 824
(...skipping 14 matching lines...) Expand all
840 fake_drive_service()->SearchByTitle( 839 fake_drive_service()->SearchByTitle(
841 kFileTitle, 840 kFileTitle,
842 GetOriginRootResourceId(), 841 GetOriginRootResourceId(),
843 base::Bind(&VerifyTitleUniqueness, 842 base::Bind(&VerifyTitleUniqueness,
844 FROM_HERE, 843 FROM_HERE,
845 file_resource_id, 844 file_resource_id,
846 google_apis::ENTRY_KIND_FILE)); 845 google_apis::ENTRY_KIND_FILE));
847 message_loop()->RunUntilIdle(); 846 message_loop()->RunUntilIdle();
848 } 847 }
849 848
850 void APIUtilTest::UploadExistingFileInConflict_Body() { 849 void APIUtilTest::TestUploadExistingFileInConflict() {
851 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); 850 const base::FilePath kLocalFilePath(FPL("/tmp/dir/file"));
852 const std::string kFileContent = "test content"; 851 const std::string kFileContent = "test content";
853 const std::string kFileTitle = "test.txt"; 852 const std::string kFileTitle = "test.txt";
854 853
855 SetUpSyncRootDirectory(); 854 SetUpSyncRootDirectory();
856 SetUpOriginRootDirectory(); 855 SetUpOriginRootDirectory();
857 std::string file_resource_id; 856 std::string file_resource_id;
858 std::string file_md5; 857 std::string file_md5;
859 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5); 858 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5);
860 859
(...skipping 19 matching lines...) Expand all
880 fake_drive_service()->SearchByTitle( 879 fake_drive_service()->SearchByTitle(
881 kFileTitle, 880 kFileTitle,
882 GetOriginRootResourceId(), 881 GetOriginRootResourceId(),
883 base::Bind(&VerifyTitleUniqueness, 882 base::Bind(&VerifyTitleUniqueness,
884 FROM_HERE, 883 FROM_HERE,
885 file_resource_id, 884 file_resource_id,
886 google_apis::ENTRY_KIND_FILE)); 885 google_apis::ENTRY_KIND_FILE));
887 message_loop()->RunUntilIdle(); 886 message_loop()->RunUntilIdle();
888 } 887 }
889 888
890 void APIUtilTest::DeleteFile_Body() { 889 void APIUtilTest::TestDeleteFile() {
891 const std::string kFileContent = "test content"; 890 const std::string kFileContent = "test content";
892 const std::string kFileTitle = "test.txt"; 891 const std::string kFileTitle = "test.txt";
893 892
894 SetUpSyncRootDirectory(); 893 SetUpSyncRootDirectory();
895 SetUpOriginRootDirectory(); 894 SetUpOriginRootDirectory();
896 std::string file_resource_id; 895 std::string file_resource_id;
897 std::string file_md5; 896 std::string file_md5;
898 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5); 897 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5);
899 898
900 bool done = false; 899 bool done = false;
901 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 900 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
902 std::string resource_id; 901 std::string resource_id;
903 api_util()->DeleteFile(file_resource_id, 902 api_util()->DeleteFile(file_resource_id,
904 file_md5, 903 file_md5,
905 base::Bind(&DidDeleteFile, &done, &error)); 904 base::Bind(&DidDeleteFile, &done, &error));
906 message_loop()->RunUntilIdle(); 905 message_loop()->RunUntilIdle();
907 906
908 EXPECT_TRUE(done); 907 EXPECT_TRUE(done);
909 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 908 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
910 909
911 fake_drive_service()->SearchByTitle( 910 fake_drive_service()->SearchByTitle(
912 kFileTitle, 911 kFileTitle,
913 GetOriginRootResourceId(), 912 GetOriginRootResourceId(),
914 base::Bind(&VerifyFileDeletion, FROM_HERE)); 913 base::Bind(&VerifyFileDeletion, FROM_HERE));
915 message_loop()->RunUntilIdle(); 914 message_loop()->RunUntilIdle();
916 } 915 }
917 916
918 void APIUtilTest::DeleteFileInConflict_Body() { 917 void APIUtilTest::TestDeleteFileInConflict() {
919 const std::string kFileContent = "test content"; 918 const std::string kFileContent = "test content";
920 const std::string kFileTitle = "test.txt"; 919 const std::string kFileTitle = "test.txt";
921 920
922 SetUpSyncRootDirectory(); 921 SetUpSyncRootDirectory();
923 SetUpOriginRootDirectory(); 922 SetUpOriginRootDirectory();
924 std::string file_resource_id; 923 std::string file_resource_id;
925 std::string file_md5; 924 std::string file_md5;
926 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5); 925 SetUpFile(kFileContent, kFileTitle, &file_resource_id, &file_md5);
927 926
928 // Since remote file's hash value is different from the expected one, it is 927 // Since remote file's hash value is different from the expected one, it is
(...skipping 14 matching lines...) Expand all
943 fake_drive_service()->SearchByTitle( 942 fake_drive_service()->SearchByTitle(
944 kFileTitle, 943 kFileTitle,
945 GetOriginRootResourceId(), 944 GetOriginRootResourceId(),
946 base::Bind(&VerifyTitleUniqueness, 945 base::Bind(&VerifyTitleUniqueness,
947 FROM_HERE, 946 FROM_HERE,
948 file_resource_id, 947 file_resource_id,
949 google_apis::ENTRY_KIND_FILE)); 948 google_apis::ENTRY_KIND_FILE));
950 message_loop()->RunUntilIdle(); 949 message_loop()->RunUntilIdle();
951 } 950 }
952 951
953 void APIUtilTest::CreateDirectory_Body() { 952 void APIUtilTest::TestCreateDirectory() {
954 const std::string kDirectoryTitle("directory"); 953 const std::string kDirectoryTitle("directory");
955 954
956 SetUpSyncRootDirectory(); 955 SetUpSyncRootDirectory();
957 SetUpOriginRootDirectory(); 956 SetUpOriginRootDirectory();
958 957
959 bool done = false; 958 bool done = false;
960 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 959 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
961 std::string resource_id; 960 std::string resource_id;
962 api_util()->CreateDirectory( 961 api_util()->CreateDirectory(
963 GetOriginRootResourceId(), 962 GetOriginRootResourceId(),
(...skipping 10 matching lines...) Expand all
974 GetOriginRootResourceId(), 973 GetOriginRootResourceId(),
975 base::Bind(&VerifyTitleUniqueness, 974 base::Bind(&VerifyTitleUniqueness,
976 FROM_HERE, 975 FROM_HERE,
977 resource_id, 976 resource_id,
978 google_apis::ENTRY_KIND_FOLDER)); 977 google_apis::ENTRY_KIND_FOLDER));
979 message_loop()->RunUntilIdle(); 978 message_loop()->RunUntilIdle();
980 } 979 }
981 980
982 TEST_F(APIUtilTest, GetSyncRoot) { 981 TEST_F(APIUtilTest, GetSyncRoot) {
983 ASSERT_FALSE(IsDriveAPIDisabled()); 982 ASSERT_FALSE(IsDriveAPIDisabled());
984 GetSyncRoot_Body(); 983 TestGetSyncRoot();
985 } 984 }
986 985
987 TEST_F(APIUtilTest, GetSyncRoot_WAPI) { 986 TEST_F(APIUtilTest, GetSyncRoot_WAPI) {
988 SetDisableDriveAPI(true); 987 ScopedDisableDriveAPI disable_drive_api;
989 GetSyncRoot_Body(); 988 TestGetSyncRoot();
990 } 989 }
991 990
992 TEST_F(APIUtilTest, CreateSyncRoot) { 991 TEST_F(APIUtilTest, CreateSyncRoot) {
993 ASSERT_FALSE(IsDriveAPIDisabled()); 992 ASSERT_FALSE(IsDriveAPIDisabled());
994 CreateSyncRoot_Body(); 993 TestCreateSyncRoot();
995 } 994 }
996 995
997 TEST_F(APIUtilTest, CreateSyncRoot_WAPI) { 996 TEST_F(APIUtilTest, CreateSyncRoot_WAPI) {
998 SetDisableDriveAPI(true); 997 ScopedDisableDriveAPI disable_drive_api;
999 CreateSyncRoot_Body(); 998 TestCreateSyncRoot();
1000 } 999 }
1001 1000
1002 TEST_F(APIUtilTest, CreateSyncRoot_Conflict) { 1001 TEST_F(APIUtilTest, CreateSyncRoot_Conflict) {
1003 ASSERT_FALSE(IsDriveAPIDisabled()); 1002 ASSERT_FALSE(IsDriveAPIDisabled());
1004 CreateSyncRoot_Conflict_Body(); 1003 TestCreateSyncRoot_Conflict();
1005 } 1004 }
1006 1005
1007 TEST_F(APIUtilTest, CreateSyncRoot_Conflict_WAPI) { 1006 TEST_F(APIUtilTest, CreateSyncRoot_Conflict_WAPI) {
1008 SetDisableDriveAPI(true); 1007 ScopedDisableDriveAPI disable_drive_api;
1009 CreateSyncRoot_Conflict_Body(); 1008 TestCreateSyncRoot_Conflict();
1010 } 1009 }
1011 1010
1012 TEST_F(APIUtilTest, GetOriginDirectory) { 1011 TEST_F(APIUtilTest, GetOriginDirectory) {
1013 ASSERT_FALSE(IsDriveAPIDisabled()); 1012 ASSERT_FALSE(IsDriveAPIDisabled());
1014 GetOriginDirectory_Body(); 1013 TestGetOriginDirectory();
1015 } 1014 }
1016 1015
1017 TEST_F(APIUtilTest, GetOriginDirectory_WAPI) { 1016 TEST_F(APIUtilTest, GetOriginDirectory_WAPI) {
1018 SetDisableDriveAPI(true); 1017 ScopedDisableDriveAPI disable_drive_api;
1019 GetOriginDirectory_Body(); 1018 TestGetOriginDirectory();
1020 } 1019 }
1021 1020
1022 TEST_F(APIUtilTest, CreateOriginDirectory) { 1021 TEST_F(APIUtilTest, CreateOriginDirectory) {
1023 ASSERT_FALSE(IsDriveAPIDisabled()); 1022 ASSERT_FALSE(IsDriveAPIDisabled());
1024 CreateOriginDirectory_Body(); 1023 TestCreateOriginDirectory();
1025 } 1024 }
1026 1025
1027 TEST_F(APIUtilTest, CreateOriginDirectory_WAPI) { 1026 TEST_F(APIUtilTest, CreateOriginDirectory_WAPI) {
1028 SetDisableDriveAPI(true); 1027 ScopedDisableDriveAPI disable_drive_api;
1029 CreateOriginDirectory_Body(); 1028 TestCreateOriginDirectory();
1030 } 1029 }
1031 1030
1032 TEST_F(APIUtilTest, CreateOriginDirectory_Conflict) { 1031 TEST_F(APIUtilTest, CreateOriginDirectory_Conflict) {
1033 ASSERT_FALSE(IsDriveAPIDisabled()); 1032 ASSERT_FALSE(IsDriveAPIDisabled());
1034 CreateOriginDirectory_Conflict_Body(); 1033 TestCreateOriginDirectory_Conflict();
1035 } 1034 }
1036 1035
1037 TEST_F(APIUtilTest, CreateOriginDirectory_Conflict_WAPI) { 1036 TEST_F(APIUtilTest, CreateOriginDirectory_Conflict_WAPI) {
1038 SetDisableDriveAPI(true); 1037 ScopedDisableDriveAPI disable_drive_api;
1039 CreateOriginDirectory_Conflict_Body(); 1038 TestCreateOriginDirectory_Conflict();
1040 } 1039 }
1041 1040
1042 TEST_F(APIUtilTest, GetLargestChangeStamp) { 1041 TEST_F(APIUtilTest, GetLargestChangeStamp) {
1043 ASSERT_FALSE(IsDriveAPIDisabled()); 1042 ASSERT_FALSE(IsDriveAPIDisabled());
1044 GetLargestChangeStamp_Body(); 1043 TestGetLargestChangeStamp();
1045 } 1044 }
1046 1045
1047 TEST_F(APIUtilTest, GetLargestChangeStamp_WAPI) { 1046 TEST_F(APIUtilTest, GetLargestChangeStamp_WAPI) {
1048 SetDisableDriveAPI(true); 1047 ScopedDisableDriveAPI disable_drive_api;
1049 GetLargestChangeStamp_Body(); 1048 TestGetLargestChangeStamp();
1050 } 1049 }
1051 1050
1052 TEST_F(APIUtilTest, ListFiles) { 1051 TEST_F(APIUtilTest, ListFiles) {
1053 ASSERT_FALSE(IsDriveAPIDisabled()); 1052 ASSERT_FALSE(IsDriveAPIDisabled());
1054 ListFiles_Body(); 1053 TestListFiles();
1055 } 1054 }
1056 1055
1057 TEST_F(APIUtilTest, ListFiles_WAPI) { 1056 TEST_F(APIUtilTest, ListFiles_WAPI) {
1058 SetDisableDriveAPI(true); 1057 ScopedDisableDriveAPI disable_drive_api;
1059 ListFiles_Body(); 1058 TestListFiles();
1060 } 1059 }
1061 1060
1062 TEST_F(APIUtilTest, ListChanges) { 1061 TEST_F(APIUtilTest, ListChanges) {
1063 ASSERT_FALSE(IsDriveAPIDisabled()); 1062 ASSERT_FALSE(IsDriveAPIDisabled());
1064 ListChanges_Body(); 1063 TestListChanges();
1065 } 1064 }
1066 1065
1067 TEST_F(APIUtilTest, ListChanges_WAPI) { 1066 TEST_F(APIUtilTest, ListChanges_WAPI) {
1068 SetDisableDriveAPI(true); 1067 ScopedDisableDriveAPI disable_drive_api;
1069 ListChanges_Body(); 1068 TestListChanges();
1070 } 1069 }
1071 1070
1072 TEST_F(APIUtilTest, DownloadFile) { 1071 TEST_F(APIUtilTest, DownloadFile) {
1073 ASSERT_FALSE(IsDriveAPIDisabled()); 1072 ASSERT_FALSE(IsDriveAPIDisabled());
1074 DownloadFile_Body(); 1073 TestDownloadFile();
1075 } 1074 }
1076 1075
1077 TEST_F(APIUtilTest, DownloadFile_WAPI) { 1076 TEST_F(APIUtilTest, DownloadFile_WAPI) {
1078 SetDisableDriveAPI(true); 1077 ScopedDisableDriveAPI disable_drive_api;
1079 DownloadFile_Body(); 1078 TestDownloadFile();
1080 } 1079 }
1081 1080
1082 TEST_F(APIUtilTest, DownloadFileInNotModified) { 1081 TEST_F(APIUtilTest, DownloadFileInNotModified) {
1083 ASSERT_FALSE(IsDriveAPIDisabled()); 1082 ASSERT_FALSE(IsDriveAPIDisabled());
1084 DownloadFileInNotModified_Body(); 1083 TestDownloadFileInNotModified();
1085 } 1084 }
1086 1085
1087 TEST_F(APIUtilTest, DownloadFileInNotModified_WAPI) { 1086 TEST_F(APIUtilTest, DownloadFileInNotModified_WAPI) {
1088 SetDisableDriveAPI(true); 1087 ScopedDisableDriveAPI disable_drive_api;
1089 DownloadFileInNotModified_Body(); 1088 TestDownloadFileInNotModified();
1090 } 1089 }
1091 1090
1092 TEST_F(APIUtilTest, UploadNewFile) { 1091 TEST_F(APIUtilTest, UploadNewFile) {
1093 ASSERT_FALSE(IsDriveAPIDisabled()); 1092 ASSERT_FALSE(IsDriveAPIDisabled());
1094 UploadNewFile_Body(); 1093 TestUploadNewFile();
1095 } 1094 }
1096 1095
1097 TEST_F(APIUtilTest, UploadNewFile_WAPI) { 1096 TEST_F(APIUtilTest, UploadNewFile_WAPI) {
1098 SetDisableDriveAPI(true); 1097 ScopedDisableDriveAPI disable_drive_api;
1099 UploadNewFile_Body(); 1098 TestUploadNewFile();
1100 } 1099 }
1101 1100
1102 TEST_F(APIUtilTest, UploadNewFile_ConflictWithFile) { 1101 TEST_F(APIUtilTest, UploadNewFile_ConflictWithFile) {
1103 ASSERT_FALSE(IsDriveAPIDisabled()); 1102 ASSERT_FALSE(IsDriveAPIDisabled());
1104 UploadNewFile_ConflictWithFile_Body(); 1103 TestUploadNewFile_ConflictWithFile();
1105 } 1104 }
1106 1105
1107 TEST_F(APIUtilTest, UploadNewFile_ConflictWithFile_WAPI) { 1106 TEST_F(APIUtilTest, UploadNewFile_ConflictWithFile_WAPI) {
1108 SetDisableDriveAPI(true); 1107 ScopedDisableDriveAPI disable_drive_api;
1109 UploadNewFile_ConflictWithFile_Body(); 1108 TestUploadNewFile_ConflictWithFile();
1110 } 1109 }
1111 1110
1112 TEST_F(APIUtilTest, UploadExistingFile) { 1111 TEST_F(APIUtilTest, UploadExistingFile) {
1113 ASSERT_FALSE(IsDriveAPIDisabled()); 1112 ASSERT_FALSE(IsDriveAPIDisabled());
1114 UploadExistingFile_Body(); 1113 TestUploadExistingFile();
1115 } 1114 }
1116 1115
1117 TEST_F(APIUtilTest, UploadExistingFile_WAPI) { 1116 TEST_F(APIUtilTest, UploadExistingFile_WAPI) {
1118 SetDisableDriveAPI(true); 1117 ScopedDisableDriveAPI disable_drive_api;
1119 UploadExistingFile_Body(); 1118 TestUploadExistingFile();
1120 } 1119 }
1121 1120
1122 TEST_F(APIUtilTest, UploadExistingFileInConflict) { 1121 TEST_F(APIUtilTest, UploadExistingFileInConflict) {
1123 ASSERT_FALSE(IsDriveAPIDisabled()); 1122 ASSERT_FALSE(IsDriveAPIDisabled());
1124 UploadExistingFileInConflict_Body(); 1123 TestUploadExistingFileInConflict();
1125 } 1124 }
1126 1125
1127 TEST_F(APIUtilTest, UploadExistingFileInConflict_WAPI) { 1126 TEST_F(APIUtilTest, UploadExistingFileInConflict_WAPI) {
1128 SetDisableDriveAPI(true); 1127 ScopedDisableDriveAPI disable_drive_api;
1129 UploadExistingFileInConflict_Body(); 1128 TestUploadExistingFileInConflict();
1130 } 1129 }
1131 1130
1132 TEST_F(APIUtilTest, DeleteFile) { 1131 TEST_F(APIUtilTest, DeleteFile) {
1133 ASSERT_FALSE(IsDriveAPIDisabled()); 1132 ASSERT_FALSE(IsDriveAPIDisabled());
1134 DeleteFile_Body(); 1133 TestDeleteFile();
1135 } 1134 }
1136 1135
1137 TEST_F(APIUtilTest, DeleteFile_WAPI) { 1136 TEST_F(APIUtilTest, DeleteFile_WAPI) {
1138 SetDisableDriveAPI(true); 1137 ScopedDisableDriveAPI disable_drive_api;
1139 DeleteFile_Body(); 1138 TestDeleteFile();
1140 } 1139 }
1141 1140
1142 TEST_F(APIUtilTest, DeleteFileInConflict) { 1141 TEST_F(APIUtilTest, DeleteFileInConflict) {
1143 ASSERT_FALSE(IsDriveAPIDisabled()); 1142 ASSERT_FALSE(IsDriveAPIDisabled());
1144 DeleteFileInConflict_Body(); 1143 TestDeleteFileInConflict();
1145 } 1144 }
1146 1145
1147 TEST_F(APIUtilTest, DeleteFileInConflict_WAPI) { 1146 TEST_F(APIUtilTest, DeleteFileInConflict_WAPI) {
1148 SetDisableDriveAPI(true); 1147 ScopedDisableDriveAPI disable_drive_api;
1149 DeleteFileInConflict_Body(); 1148 TestDeleteFileInConflict();
1150 } 1149 }
1151 1150
1152 TEST_F(APIUtilTest, CreateDirectory) { 1151 TEST_F(APIUtilTest, CreateDirectory) {
1153 ASSERT_FALSE(IsDriveAPIDisabled()); 1152 ASSERT_FALSE(IsDriveAPIDisabled());
1154 CreateDirectory_Body(); 1153 TestCreateDirectory();
1155 } 1154 }
1156 1155
1157 TEST_F(APIUtilTest, CreateDirectory_WAPI) { 1156 TEST_F(APIUtilTest, CreateDirectory_WAPI) {
1158 SetDisableDriveAPI(true); 1157 ScopedDisableDriveAPI disable_drive_api;
1159 CreateDirectory_Body(); 1158 TestCreateDirectory();
1160 } 1159 }
1161 1160
1162 #endif // !defined(OS_ANDROID) 1161 #endif // !defined(OS_ANDROID)
1163 1162
1164 } // namespace drive 1163 } // namespace drive
1165 } // namespace sync_file_system 1164 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698