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

Side by Side Diff: components/browser_sync/profile_sync_service_unittest.cc

Issue 2798963003: Use ScopedTaskEnvironment instead of MessageLoop in components unit tests. (Closed)
Patch Set: Created 3 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
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 "components/browser_sync/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/feature_list.h" 11 #include "base/feature_list.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/test/scoped_feature_list.h" 17 #include "base/test/scoped_feature_list.h"
18 #include "base/test/scoped_task_environment.h"
18 #include "base/test/sequenced_worker_pool_owner.h" 19 #include "base/test/sequenced_worker_pool_owner.h"
19 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "components/browser_sync/browser_sync_switches.h" 22 #include "components/browser_sync/browser_sync_switches.h"
22 #include "components/browser_sync/profile_sync_test_util.h" 23 #include "components/browser_sync/profile_sync_test_util.h"
23 #include "components/invalidation/impl/profile_invalidation_provider.h" 24 #include "components/invalidation/impl/profile_invalidation_provider.h"
24 #include "components/invalidation/public/invalidation_service.h" 25 #include "components/invalidation/public/invalidation_service.h"
25 #include "components/signin/core/browser/account_tracker_service.h" 26 #include "components/signin/core/browser/account_tracker_service.h"
26 #include "components/signin/core/browser/fake_signin_manager.h" 27 #include "components/signin/core/browser/fake_signin_manager.h"
27 #include "components/strings/grit/components_strings.h" 28 #include "components/strings/grit/components_strings.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 344
344 protected: 345 protected:
345 void PumpLoop() { 346 void PumpLoop() {
346 base::RunLoop run_loop; 347 base::RunLoop run_loop;
347 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 348 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
348 run_loop.QuitClosure()); 349 run_loop.QuitClosure());
349 run_loop.Run(); 350 run_loop.Run();
350 } 351 }
351 352
352 private: 353 private:
353 base::MessageLoop message_loop_; 354 base::test::ScopedTaskEnvironment scoped_task_environment_;
354 ProfileSyncServiceBundle profile_sync_service_bundle_; 355 ProfileSyncServiceBundle profile_sync_service_bundle_;
355 std::unique_ptr<ProfileSyncService> service_; 356 std::unique_ptr<ProfileSyncService> service_;
356 357
357 // The current component factory used by sync. May be null if the server 358 // The current component factory used by sync. May be null if the server
358 // hasn't been created yet. 359 // hasn't been created yet.
359 syncer::SyncApiComponentFactoryMock* component_factory_; 360 syncer::SyncApiComponentFactoryMock* component_factory_;
360 }; 361 };
361 362
362 // Verify that the server URLs are sane. 363 // Verify that the server URLs are sane.
363 TEST_F(ProfileSyncServiceTest, InitialState) { 364 TEST_F(ProfileSyncServiceTest, InitialState) {
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 // Progress the controller to RUNNING first, which is how the service 964 // Progress the controller to RUNNING first, which is how the service
964 // determines whether a type is enabled. 965 // determines whether a type is enabled.
965 controller->StartAssociating(base::Bind(&DoNothing)); 966 controller->StartAssociating(base::Bind(&DoNothing));
966 controller->FinishStart(DataTypeController::OK_FIRST_RUN); 967 controller->FinishStart(DataTypeController::OK_FIRST_RUN);
967 service()->RegisterDataTypeController(std::move(controller)); 968 service()->RegisterDataTypeController(std::move(controller));
968 EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate()); 969 EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate());
969 } 970 }
970 971
971 } // namespace 972 } // namespace
972 } // namespace browser_sync 973 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698