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

Side by Side Diff: chrome/browser/chromeos/drive/drive_scheduler_unittest.cc

Issue 14235015: Fill JobInfo in DriveScheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/drive/drive_scheduler.h" 5 #include "chrome/browser/chromeos/drive/drive_scheduler.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // Try to get a file in the background 457 // Try to get a file in the background
458 base::ScopedTempDir temp_dir; 458 base::ScopedTempDir temp_dir;
459 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 459 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
460 460
461 const GURL kContentUrl("https://file_content_url/"); 461 const GURL kContentUrl("https://file_content_url/");
462 const base::FilePath kOutputFilePath = 462 const base::FilePath kOutputFilePath =
463 temp_dir.path().AppendASCII("whatever.txt"); 463 temp_dir.path().AppendASCII("whatever.txt");
464 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR; 464 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
465 base::FilePath output_file_path; 465 base::FilePath output_file_path;
466 scheduler_->DownloadFile( 466 scheduler_->DownloadFile(
467 base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path 467 base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
468 kOutputFilePath, 468 kOutputFilePath,
469 kContentUrl, 469 kContentUrl,
470 DriveClientContext(BACKGROUND), 470 DriveClientContext(BACKGROUND),
471 google_apis::test_util::CreateCopyResultCallback( 471 google_apis::test_util::CreateCopyResultCallback(
472 &download_error, &output_file_path), 472 &download_error, &output_file_path),
473 google_apis::GetContentCallback()); 473 google_apis::GetContentCallback());
474 // Metadata should still work 474 // Metadata should still work
475 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; 475 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
476 scoped_ptr<google_apis::AccountMetadata> account_metadata; 476 scoped_ptr<google_apis::AccountMetadata> account_metadata;
477 477
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // Try to get a file in the background 511 // Try to get a file in the background
512 base::ScopedTempDir temp_dir; 512 base::ScopedTempDir temp_dir;
513 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 513 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
514 514
515 const GURL kContentUrl("https://file_content_url/"); 515 const GURL kContentUrl("https://file_content_url/");
516 const base::FilePath kOutputFilePath = 516 const base::FilePath kOutputFilePath =
517 temp_dir.path().AppendASCII("whatever.txt"); 517 temp_dir.path().AppendASCII("whatever.txt");
518 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR; 518 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
519 base::FilePath output_file_path; 519 base::FilePath output_file_path;
520 scheduler_->DownloadFile( 520 scheduler_->DownloadFile(
521 base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path 521 base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
522 kOutputFilePath, 522 kOutputFilePath,
523 kContentUrl, 523 kContentUrl,
524 DriveClientContext(BACKGROUND), 524 DriveClientContext(BACKGROUND),
525 google_apis::test_util::CreateCopyResultCallback( 525 google_apis::test_util::CreateCopyResultCallback(
526 &download_error, &output_file_path), 526 &download_error, &output_file_path),
527 google_apis::GetContentCallback()); 527 google_apis::GetContentCallback());
528 // Metadata should still work 528 // Metadata should still work
529 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; 529 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
530 scoped_ptr<google_apis::AccountMetadata> account_metadata; 530 scoped_ptr<google_apis::AccountMetadata> account_metadata;
531 531
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 // Try to get a file in the background 565 // Try to get a file in the background
566 base::ScopedTempDir temp_dir; 566 base::ScopedTempDir temp_dir;
567 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 567 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
568 568
569 const GURL kContentUrl("https://file_content_url/"); 569 const GURL kContentUrl("https://file_content_url/");
570 const base::FilePath kOutputFilePath = 570 const base::FilePath kOutputFilePath =
571 temp_dir.path().AppendASCII("whatever.txt"); 571 temp_dir.path().AppendASCII("whatever.txt");
572 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR; 572 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
573 base::FilePath output_file_path; 573 base::FilePath output_file_path;
574 scheduler_->DownloadFile( 574 scheduler_->DownloadFile(
575 base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path 575 base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
576 kOutputFilePath, 576 kOutputFilePath,
577 kContentUrl, 577 kContentUrl,
578 DriveClientContext(BACKGROUND), 578 DriveClientContext(BACKGROUND),
579 google_apis::test_util::CreateCopyResultCallback( 579 google_apis::test_util::CreateCopyResultCallback(
580 &download_error, &output_file_path), 580 &download_error, &output_file_path),
581 google_apis::GetContentCallback()); 581 google_apis::GetContentCallback());
582 // Metadata should still work 582 // Metadata should still work
583 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; 583 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
584 scoped_ptr<google_apis::AccountMetadata> account_metadata; 584 scoped_ptr<google_apis::AccountMetadata> account_metadata;
585 585
(...skipping 25 matching lines...) Expand all
611 // Try to get a file in the background 611 // Try to get a file in the background
612 base::ScopedTempDir temp_dir; 612 base::ScopedTempDir temp_dir;
613 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 613 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
614 614
615 const GURL kContentUrl("https://file_content_url/"); 615 const GURL kContentUrl("https://file_content_url/");
616 const base::FilePath kOutputFilePath = 616 const base::FilePath kOutputFilePath =
617 temp_dir.path().AppendASCII("whatever.txt"); 617 temp_dir.path().AppendASCII("whatever.txt");
618 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR; 618 google_apis::GDataErrorCode download_error = google_apis::GDATA_OTHER_ERROR;
619 base::FilePath output_file_path; 619 base::FilePath output_file_path;
620 scheduler_->DownloadFile( 620 scheduler_->DownloadFile(
621 base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path 621 base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
622 kOutputFilePath, 622 kOutputFilePath,
623 kContentUrl, 623 kContentUrl,
624 DriveClientContext(BACKGROUND), 624 DriveClientContext(BACKGROUND),
625 google_apis::test_util::CreateCopyResultCallback( 625 google_apis::test_util::CreateCopyResultCallback(
626 &download_error, &output_file_path), 626 &download_error, &output_file_path),
627 google_apis::GetContentCallback()); 627 google_apis::GetContentCallback());
628 // Metadata should still work 628 // Metadata should still work
629 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR; 629 google_apis::GDataErrorCode metadata_error = google_apis::GDATA_OTHER_ERROR;
630 scoped_ptr<google_apis::AccountMetadata> account_metadata; 630 scoped_ptr<google_apis::AccountMetadata> account_metadata;
631 631
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 scheduler_->GetAccountMetadata( 673 scheduler_->GetAccountMetadata(
674 google_apis::test_util::CreateCopyResultCallback( 674 google_apis::test_util::CreateCopyResultCallback(
675 &error, &account_metadata)); 675 &error, &account_metadata));
676 expected_types.insert(TYPE_RENAME_RESOURCE); 676 expected_types.insert(TYPE_RENAME_RESOURCE);
677 scheduler_->RenameResource( 677 scheduler_->RenameResource(
678 "file:2_file_resource_id", 678 "file:2_file_resource_id",
679 "New Name", 679 "New Name",
680 google_apis::test_util::CreateCopyResultCallback(&error)); 680 google_apis::test_util::CreateCopyResultCallback(&error));
681 expected_types.insert(TYPE_DOWNLOAD_FILE); 681 expected_types.insert(TYPE_DOWNLOAD_FILE);
682 scheduler_->DownloadFile( 682 scheduler_->DownloadFile(
683 base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path 683 base::FilePath::FromUTF8Unsafe("drive/whatever.txt"), // virtual path
684 temp_dir.path().AppendASCII("whatever.txt"), 684 temp_dir.path().AppendASCII("whatever.txt"),
685 GURL("https://file_content_url/"), 685 GURL("https://file_content_url/"),
686 DriveClientContext(BACKGROUND), 686 DriveClientContext(BACKGROUND),
687 google_apis::test_util::CreateCopyResultCallback(&error, &path), 687 google_apis::test_util::CreateCopyResultCallback(&error, &path),
688 google_apis::GetContentCallback()); 688 google_apis::GetContentCallback());
689 689
690 // The number of jobs queued so far. 690 // The number of jobs queued so far.
691 EXPECT_EQ(4U, scheduler_->GetJobInfoList().size()); 691 EXPECT_EQ(4U, scheduler_->GetJobInfoList().size());
692 692
693 // Add more jobs. 693 // Add more jobs.
(...skipping 26 matching lines...) Expand all
720 720
721 // Run the background downloading job as well. 721 // Run the background downloading job as well.
722 ConnectToWifi(); 722 ConnectToWifi();
723 google_apis::test_util::RunBlockingPoolTask(); 723 google_apis::test_util::RunBlockingPoolTask();
724 724
725 // All jobs should have finished. 725 // All jobs should have finished.
726 EXPECT_EQ(0U, scheduler_->GetJobInfoList().size()); 726 EXPECT_EQ(0U, scheduler_->GetJobInfoList().size());
727 } 727 }
728 728
729 } // namespace drive 729 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_scheduler.cc ('k') | chrome/browser/chromeos/drive/job_list_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698