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

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

Issue 1124813003: [chrome/browser/chromeos/drive] Avoid use of MessageLoopProxy by use of TTRH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments 3 : Indent Created 5 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
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/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/prefs/testing_pref_service.h" 12 #include "base/prefs/testing_pref_service.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h"
14 #include "base/stl_util.h" 15 #include "base/stl_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/thread_task_runner_handle.h"
16 #include "chrome/browser/chromeos/drive/test_util.h" 18 #include "chrome/browser/chromeos/drive/test_util.h"
17 #include "chrome/browser/drive/event_logger.h" 19 #include "chrome/browser/drive/event_logger.h"
18 #include "chrome/browser/drive/fake_drive_service.h" 20 #include "chrome/browser/drive/fake_drive_service.h"
19 #include "chrome/browser/drive/test_util.h" 21 #include "chrome/browser/drive/test_util.h"
20 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
21 #include "content/public/test/test_browser_thread_bundle.h" 23 #include "content/public/test/test_browser_thread_bundle.h"
22 #include "google_apis/drive/drive_api_parser.h" 24 #include "google_apis/drive/drive_api_parser.h"
23 #include "google_apis/drive/test_util.h" 25 #include "google_apis/drive/test_util.h"
24 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
25 27
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void SetUp() override { 137 void SetUp() override {
136 fake_network_change_notifier_.reset( 138 fake_network_change_notifier_.reset(
137 new test_util::FakeNetworkChangeNotifier); 139 new test_util::FakeNetworkChangeNotifier);
138 140
139 logger_.reset(new EventLogger); 141 logger_.reset(new EventLogger);
140 142
141 fake_drive_service_.reset(new CancelTestableFakeDriveService); 143 fake_drive_service_.reset(new CancelTestableFakeDriveService);
142 test_util::SetUpTestEntries(fake_drive_service_.get()); 144 test_util::SetUpTestEntries(fake_drive_service_.get());
143 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json"); 145 fake_drive_service_->LoadAppListForDriveApi("drive/applist.json");
144 146
145 scheduler_.reset(new JobScheduler(pref_service_.get(), 147 scheduler_.reset(new JobScheduler(
146 logger_.get(), 148 pref_service_.get(),
147 fake_drive_service_.get(), 149 logger_.get(),
148 base::MessageLoopProxy::current().get())); 150 fake_drive_service_.get(),
151 base::ThreadTaskRunnerHandle::Get().get()));
149 scheduler_->SetDisableThrottling(true); 152 scheduler_->SetDisableThrottling(true);
150 } 153 }
151 154
152 protected: 155 protected:
153 // Sets up FakeNetworkChangeNotifier as if it's connected to a network with 156 // Sets up FakeNetworkChangeNotifier as if it's connected to a network with
154 // the specified connection type. 157 // the specified connection type.
155 void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) { 158 void ChangeConnectionType(net::NetworkChangeNotifier::ConnectionType type) {
156 fake_network_change_notifier_->SetConnectionType(type); 159 fake_network_change_notifier_->SetConnectionType(type);
157 } 160 }
158 161
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 scheduler_->CancelJob(first_job_id); 1029 scheduler_->CancelJob(first_job_id);
1027 1030
1028 // Only the first job should be cancelled. 1031 // Only the first job should be cancelled.
1029 base::RunLoop().RunUntilIdle(); 1032 base::RunLoop().RunUntilIdle();
1030 EXPECT_EQ(google_apis::DRIVE_CANCELLED, error1); 1033 EXPECT_EQ(google_apis::DRIVE_CANCELLED, error1);
1031 EXPECT_EQ(google_apis::HTTP_SUCCESS, error2); 1034 EXPECT_EQ(google_apis::HTTP_SUCCESS, error2);
1032 EXPECT_TRUE(scheduler_->GetJobInfoList().empty()); 1035 EXPECT_TRUE(scheduler_->GetJobInfoList().empty());
1033 } 1036 }
1034 1037
1035 } // namespace drive 1038 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/job_scheduler.cc ('k') | chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698