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

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

Issue 14093022: Remove DrivePrefetcher and relevant flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: xxxxx Created 7 years, 7 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/job_scheduler.h" 5 #include "chrome/browser/chromeos/drive/job_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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 std::vector<std::string> resource_ids; 437 std::vector<std::string> resource_ids;
438 438
439 scheduler_->GetResourceEntry( 439 scheduler_->GetResourceEntry(
440 resource_1, // resource ID 440 resource_1, // resource ID
441 DriveClientContext(USER_INITIATED), 441 DriveClientContext(USER_INITIATED),
442 base::Bind(&CopyResourceIdFromGetResourceEntryCallback, 442 base::Bind(&CopyResourceIdFromGetResourceEntryCallback,
443 &resource_ids, 443 &resource_ids,
444 resource_1)); 444 resource_1));
445 scheduler_->GetResourceEntry( 445 scheduler_->GetResourceEntry(
446 resource_2, // resource ID 446 resource_2, // resource ID
447 DriveClientContext(PREFETCH), 447 DriveClientContext(BACKGROUND),
448 base::Bind(&CopyResourceIdFromGetResourceEntryCallback, 448 base::Bind(&CopyResourceIdFromGetResourceEntryCallback,
449 &resource_ids, 449 &resource_ids,
450 resource_2)); 450 resource_2));
451 scheduler_->GetResourceEntry( 451 scheduler_->GetResourceEntry(
452 resource_3, // resource ID 452 resource_3, // resource ID
453 DriveClientContext(BACKGROUND), 453 DriveClientContext(BACKGROUND),
454 base::Bind(&CopyResourceIdFromGetResourceEntryCallback, 454 base::Bind(&CopyResourceIdFromGetResourceEntryCallback,
455 &resource_ids, 455 &resource_ids,
456 resource_3)); 456 resource_3));
457 scheduler_->GetResourceEntry( 457 scheduler_->GetResourceEntry(
458 resource_4, // resource ID 458 resource_4, // resource ID
459 DriveClientContext(USER_INITIATED), 459 DriveClientContext(USER_INITIATED),
460 base::Bind(&CopyResourceIdFromGetResourceEntryCallback, 460 base::Bind(&CopyResourceIdFromGetResourceEntryCallback,
461 &resource_ids, 461 &resource_ids,
462 resource_4)); 462 resource_4));
463 463
464 // Reconnect to the network to start all jobs. 464 // Reconnect to the network to start all jobs.
465 ConnectToWifi(); 465 ConnectToWifi();
466 google_apis::test_util::RunBlockingPoolTask(); 466 google_apis::test_util::RunBlockingPoolTask();
467 467
468 ASSERT_EQ(resource_ids.size(), 4ul); 468 ASSERT_EQ(resource_ids.size(), 4ul);
469 ASSERT_EQ(resource_ids[0], resource_1); 469 ASSERT_EQ(resource_ids[0], resource_1);
470 ASSERT_EQ(resource_ids[1], resource_4); 470 ASSERT_EQ(resource_ids[1], resource_4);
471 ASSERT_EQ(resource_ids[2], resource_3); 471 ASSERT_EQ(resource_ids[2], resource_2);
472 ASSERT_EQ(resource_ids[3], resource_2); 472 ASSERT_EQ(resource_ids[3], resource_3);
473 } 473 }
474 474
475 TEST_F(JobSchedulerTest, GetResourceEntryNoConnection) { 475 TEST_F(JobSchedulerTest, GetResourceEntryNoConnection) {
476 ConnectToNone(); 476 ConnectToNone();
477 477
478 std::string resource("file:1_file_resource_id"); 478 std::string resource("file:1_file_resource_id");
479 std::vector<std::string> resource_ids; 479 std::vector<std::string> resource_ids;
480 480
481 scheduler_->GetResourceEntry( 481 scheduler_->GetResourceEntry(
482 resource, // resource ID 482 resource, // resource ID
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 862
863 std::vector<int64> upload_progress; 863 std::vector<int64> upload_progress;
864 logger.GetProgressInfo(TYPE_UPLOAD_NEW_FILE, &upload_progress); 864 logger.GetProgressInfo(TYPE_UPLOAD_NEW_FILE, &upload_progress);
865 ASSERT_TRUE(!upload_progress.empty()); 865 ASSERT_TRUE(!upload_progress.empty());
866 EXPECT_TRUE(base::STLIsSorted(upload_progress)); 866 EXPECT_TRUE(base::STLIsSorted(upload_progress));
867 EXPECT_GE(upload_progress.front(), 0); 867 EXPECT_GE(upload_progress.front(), 0);
868 EXPECT_LE(upload_progress.back(), 5); 868 EXPECT_LE(upload_progress.back(), 5);
869 } 869 }
870 870
871 } // namespace drive 871 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/job_scheduler.cc ('k') | chrome/browser/ui/webui/chromeos/drive_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698