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

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc

Issue 1112573002: [chrome/browser/extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving ng browser unittest issues 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/thread_task_runner_handle.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/sync_file_system/file_status_observer.h" 10 #include "chrome/browser/sync_file_system/file_status_observer.h"
10 #include "chrome/browser/sync_file_system/local_change_processor.h" 11 #include "chrome/browser/sync_file_system/local_change_processor.h"
11 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" 12 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h"
12 #include "chrome/browser/sync_file_system/sync_file_system_service.h" 13 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
13 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" 14 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h"
14 #include "chrome/browser/sync_file_system/sync_status_code.h" 15 #include "chrome/browser/sync_file_system/sync_status_code.h"
15 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" 16 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
16 #include "chrome/common/chrome_version_info.h" 17 #include "chrome/common/chrome_version_info.h"
17 #include "chrome/test/base/test_switches.h" 18 #include "chrome/test/base/test_switches.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 private: 79 private:
79 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service_; 80 ::testing::NiceMock<MockRemoteFileSyncService>* mock_remote_service_;
80 int64 real_minimum_preserved_space_; 81 int64 real_minimum_preserved_space_;
81 int64 real_default_quota_; 82 int64 real_default_quota_;
82 }; 83 };
83 84
84 ACTION_P(NotifyOkStateAndCallback, mock_remote_service) { 85 ACTION_P(NotifyOkStateAndCallback, mock_remote_service) {
85 mock_remote_service->NotifyRemoteServiceStateUpdated( 86 mock_remote_service->NotifyRemoteServiceStateUpdated(
86 sync_file_system::REMOTE_SERVICE_OK, "Test event description."); 87 sync_file_system::REMOTE_SERVICE_OK, "Test event description.");
87 base::MessageLoopProxy::current()->PostTask( 88 base::ThreadTaskRunnerHandle::Get()->PostTask(
88 FROM_HERE, base::Bind(arg1, sync_file_system::SYNC_STATUS_OK)); 89 FROM_HERE, base::Bind(arg1, sync_file_system::SYNC_STATUS_OK));
89 } 90 }
90 91
91 ACTION_P2(UpdateRemoteChangeQueue, origin, mock_remote_service) { 92 ACTION_P2(UpdateRemoteChangeQueue, origin, mock_remote_service) {
92 *origin = arg0; 93 *origin = arg0;
93 mock_remote_service->NotifyRemoteChangeQueueUpdated(1); 94 mock_remote_service->NotifyRemoteChangeQueueUpdated(1);
94 } 95 }
95 96
96 ACTION_P6(ReturnWithFakeFileAddedStatus, 97 ACTION_P6(ReturnWithFakeFileAddedStatus,
97 origin, 98 origin,
98 mock_remote_service, 99 mock_remote_service,
99 file_type, 100 file_type,
100 sync_file_status, 101 sync_file_status,
101 sync_action_taken, 102 sync_action_taken,
102 sync_direction) { 103 sync_direction) {
103 FileSystemURL mock_url = sync_file_system::CreateSyncableFileSystemURL( 104 FileSystemURL mock_url = sync_file_system::CreateSyncableFileSystemURL(
104 *origin, 105 *origin,
105 base::FilePath(FILE_PATH_LITERAL("foo.txt"))); 106 base::FilePath(FILE_PATH_LITERAL("foo.txt")));
106 mock_remote_service->NotifyRemoteChangeQueueUpdated(0); 107 mock_remote_service->NotifyRemoteChangeQueueUpdated(0);
107 base::MessageLoopProxy::current()->PostTask( 108 base::ThreadTaskRunnerHandle::Get()->PostTask(
108 FROM_HERE, base::Bind(arg0, 109 FROM_HERE, base::Bind(arg0,
109 sync_file_system::SYNC_STATUS_OK, 110 sync_file_system::SYNC_STATUS_OK,
110 mock_url)); 111 mock_url));
111 mock_remote_service->NotifyFileStatusChanged( 112 mock_remote_service->NotifyFileStatusChanged(
112 mock_url, 113 mock_url,
113 file_type, 114 file_type,
114 sync_file_status, 115 sync_file_status,
115 sync_action_taken, 116 sync_action_taken,
116 sync_direction); 117 sync_direction);
117 } 118 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy")) 194 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/conflict_resolution_policy"))
194 << message_; 195 << message_;
195 } 196 }
196 197
197 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetServiceStatus) { 198 IN_PROC_BROWSER_TEST_F(SyncFileSystemApiTest, GetServiceStatus) {
198 mock_remote_service()->SetServiceState( 199 mock_remote_service()->SetServiceState(
199 sync_file_system::REMOTE_SERVICE_AUTHENTICATION_REQUIRED); 200 sync_file_system::REMOTE_SERVICE_AUTHENTICATION_REQUIRED);
200 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_service_status")) 201 ASSERT_TRUE(RunPlatformAppTest("sync_file_system/get_service_status"))
201 << message_; 202 << message_;
202 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698