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

Unified Diff: chrome/browser/chromeos/drive/sync_client_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/sync_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/sync_client_unittest.cc
diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc
index d30e34c942488b43b0d6a246e4847690a7d20ab8..99ac4338248c457d3766b3e990989f49cbf8c31b 100644
--- a/chrome/browser/chromeos/drive/sync_client_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc
@@ -10,7 +10,9 @@
#include "base/memory/scoped_ptr.h"
#include "base/prefs/testing_pref_service.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/test/test_timeouts.h"
+#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h"
@@ -57,7 +59,7 @@ class SyncClientTestDriveService : public ::drive::FakeDriveService {
const google_apis::ProgressCallback& progress_callback) override {
++download_file_count_;
if (resource_id == resource_id_to_be_cancelled_) {
- base::MessageLoopProxy::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(download_action_callback,
google_apis::DRIVE_CANCELLED,
@@ -113,38 +115,39 @@ class SyncClientTest : public testing::Test {
drive_service_.reset(new SyncClientTestDriveService);
- scheduler_.reset(new JobScheduler(pref_service_.get(),
- logger_.get(),
- drive_service_.get(),
- base::MessageLoopProxy::current().get()));
+ scheduler_.reset(new JobScheduler(
+ pref_service_.get(),
+ logger_.get(),
+ drive_service_.get(),
+ base::ThreadTaskRunnerHandle::Get().get()));
metadata_storage_.reset(new ResourceMetadataStorage(
- temp_dir_.path(), base::MessageLoopProxy::current().get()));
+ temp_dir_.path(), base::ThreadTaskRunnerHandle::Get().get()));
ASSERT_TRUE(metadata_storage_->Initialize());
cache_.reset(new FileCache(metadata_storage_.get(),
temp_dir_.path(),
- base::MessageLoopProxy::current().get(),
+ base::ThreadTaskRunnerHandle::Get().get(),
NULL /* free_disk_space_getter */));
ASSERT_TRUE(cache_->Initialize());
metadata_.reset(new internal::ResourceMetadata(
metadata_storage_.get(), cache_.get(),
- base::MessageLoopProxy::current()));
+ base::ThreadTaskRunnerHandle::Get()));
ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize());
about_resource_loader_.reset(new AboutResourceLoader(scheduler_.get()));
loader_controller_.reset(new LoaderController);
change_list_loader_.reset(new ChangeListLoader(
logger_.get(),
- base::MessageLoopProxy::current().get(),
+ base::ThreadTaskRunnerHandle::Get().get(),
metadata_.get(),
scheduler_.get(),
about_resource_loader_.get(),
loader_controller_.get()));
ASSERT_NO_FATAL_FAILURE(SetUpTestData());
- sync_client_.reset(new SyncClient(base::MessageLoopProxy::current().get(),
+ sync_client_.reset(new SyncClient(base::ThreadTaskRunnerHandle::Get().get(),
&delegate_,
scheduler_.get(),
metadata_.get(),
@@ -217,7 +220,7 @@ class SyncClientTest : public testing::Test {
// Prepare a removed file.
file_system::RemoveOperation remove_operation(
- base::MessageLoopProxy::current().get(), &delegate_, metadata_.get(),
+ base::ThreadTaskRunnerHandle::Get().get(), &delegate_, metadata_.get(),
cache_.get());
remove_operation.Remove(
util::GetDriveMyDriveRootPath().AppendASCII("removed"),
@@ -228,7 +231,7 @@ class SyncClientTest : public testing::Test {
// Prepare a moved file.
file_system::MoveOperation move_operation(
- base::MessageLoopProxy::current().get(), &delegate_, metadata_.get());
+ base::ThreadTaskRunnerHandle::Get().get(), &delegate_, metadata_.get());
move_operation.Move(
util::GetDriveMyDriveRootPath().AppendASCII("moved"),
util::GetDriveMyDriveRootPath().AppendASCII("moved_new_title"),
@@ -387,7 +390,7 @@ TEST_F(SyncClientTest, RetryOnDisconnection) {
// FILE_ERROR_NO_CONNECTION is handled by SyncClient correctly.
// Without this delay, JobScheduler will keep the jobs unrun and SyncClient
// will receive no error.
- base::MessageLoopProxy::current()->PostDelayedTask(
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&test_util::FakeNetworkChangeNotifier::SetConnectionType,
base::Unretained(fake_network_change_notifier_.get()),
« no previous file with comments | « chrome/browser/chromeos/drive/sync_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698