Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in
(84)

Issue 2846723005: Use ScopedTaskEnvironment instead of MessageLoopForUI in components tests. (Closed)

Created:
2 years, 4 months ago by fdoray
Modified:
2 years, 4 months ago
Reviewers:
gab, sdefresne
CC:
chromium-reviews, yusukes+watch_chromium.org, zea+watch_chromium.org, rogerm+autofillwatch_chromium.org, hidehiko+watch_chromium.org, browser-components-watch_chromium.org, lhchavez+watch_chromium.org, wifiprefetch-reviews_google.com, sebsg+autofillwatch_chromium.org, jam, rouslan+autofill_chromium.org, darin-cc_chromium.org, vabr+watchlistautofill_chromium.org, tbansal+watch-data-reduction-proxy_chromium.org, johnme+watch_chromium.org, vabr+watchlistpasswordmanager_chromium.org, Peter Beverloo, asvitkine+watch_chromium.org, gcasto+watchlist_chromium.org, sync-reviews_chromium.org, elijahtaylor+arcwatch_chromium.org, mathp+autofillwatch_chromium.org, tfarina, victorhsieh+watch_chromium.org, estade+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Use ScopedTaskEnvironment instead of MessageLoopForUI in components tests. ScopedTaskEnvironment allows usage of ThreadTaskRunnerHandle and base/task_scheduler/post_task.h within its scope. It should be instantiated in everytest that uses either of these APIs (i.e. no test should instantiate a MessageLoop directly). Motivation for ScopedTaskEnvironment can be found in: https://docs.google.com/document/d/1QabRo8c7D9LsYY3cEcaPQbOCLo8Tu-6VLykYXyl3Pkk/edit BUG=708584 R=gab@chromium.org TBR=sdefresne@chromium.org Review-Url: https://codereview.chromium.org/2846723005 Cr-Commit-Position: refs/heads/master@{#468361} Committed: https://chromium.googlesource.com/chromium/src/+/66a9a083d5158d54b7db7aecd60175fb96e6dc0b

Patch Set 1 #

Patch Set 2 : self-review #

Patch Set 3 : deps #

Patch Set 4 : self-review #

Patch Set 5 : self-review #

Total comments: 12

Patch Set 6 : CR #

Patch Set 7 : fix-build-errors #

Patch Set 8 : fix-build-errors #

Patch Set 9 : fix-build-errors #

Patch Set 10 : fix-build-errors #

Patch Set 11 : fix-test-errors #

Unified diffs Side-by-side diffs Delta from patch set Stats (+146 lines, -82 lines) Patch
M components/arc/arc_session_runner_unittest.cc View 1 3 chunks +5 lines, -2 lines 0 comments Download
M components/autofill/core/browser/webdata/web_data_service_unittest.cc View 3 chunks +6 lines, -2 lines 0 comments Download
M components/bookmarks/browser/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M components/bookmarks/browser/bookmark_node_data_unittest.cc View 3 chunks +5 lines, -3 lines 0 comments Download
M components/bookmarks/browser/bookmark_utils_unittest.cc View 1 3 chunks +8 lines, -5 lines 0 comments Download
M components/component_updater/timer_unittest.cc View 2 chunks +5 lines, -3 lines 0 comments Download
M components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc View 3 chunks +5 lines, -2 lines 0 comments Download
M components/favicon/core/favicon_handler_unittest.cc View 3 chunks +5 lines, -3 lines 0 comments Download
M components/gcm_driver/instance_id/instance_id_driver_unittest.cc View 1 2 3 4 5 6 3 chunks +6 lines, -5 lines 0 comments Download
M components/history/core/browser/history_service_unittest.cc View 3 chunks +6 lines, -2 lines 0 comments Download
M components/history/core/test/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M components/history/core/test/history_backend_db_base_test.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M components/history/core/test/history_backend_db_base_test.cc View 1 2 3 4 1 chunk +4 lines, -3 lines 0 comments Download
M components/password_manager/core/browser/password_store_default_unittest.cc View 1 2 3 4 5 6 7 8 9 2 chunks +8 lines, -3 lines 0 comments Download
M components/password_manager/core/browser/password_store_unittest.cc View 1 2 3 4 5 3 chunks +6 lines, -1 line 0 comments Download
M components/policy/core/common/cloud/cloud_policy_validator_unittest.cc View 3 chunks +5 lines, -3 lines 0 comments Download
M components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc View 1 2 3 10 chunks +21 lines, -20 lines 0 comments Download
M components/precache/core/precache_database_unittest.cc View 1 2 3 4 5 3 chunks +5 lines, -4 lines 0 comments Download
M components/precache/core/precache_fetcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 8 chunks +14 lines, -7 lines 0 comments Download
M components/rappor/log_uploader_unittest.cc View 2 chunks +5 lines, -2 lines 0 comments Download
M components/sync/device_info/device_info_data_type_controller_unittest.cc View 1 2 3 4 5 6 7 8 3 chunks +7 lines, -2 lines 0 comments Download
M components/sync/driver/async_directory_type_controller_unittest.cc View 3 chunks +6 lines, -2 lines 0 comments Download
M components/sync/driver/generic_change_processor_unittest.cc View 3 chunks +5 lines, -3 lines 0 comments Download
M components/sync_sessions/favicon_cache_unittest.cc View 1 2 3 4 5 6 3 chunks +5 lines, -3 lines 0 comments Download

Messages

Total messages: 56 (47 generated)
fdoray
2 years, 4 months ago (2017-04-27 18:29:49 UTC) #1
fdoray
gab@: PTAL The change will then be TBRed to the owner.
2 years, 4 months ago (2017-04-27 18:29:52 UTC) #3
gab
lgmt % comments and https://codereview.chromium.org/2849603003/diff/60001/ui/aura/mus/os_exchange_data_provider_mus_unittest.cc#newcode61 https://codereview.chromium.org/2846723005/diff/80001/components/password_manager/core/browser/password_store_default_unittest.cc File components/password_manager/core/browser/password_store_default_unittest.cc (right): https://codereview.chromium.org/2846723005/diff/80001/components/password_manager/core/browser/password_store_default_unittest.cc#newcode85 components/password_manager/core/browser/password_store_default_unittest.cc:85: base::test::ScopedTaskEnvironment::MainThreadType::UI) {} Deleting the ...
2 years, 4 months ago (2017-04-28 01:43:00 UTC) #23
sdefresne
https://codereview.chromium.org/2846723005/diff/80001/components/autofill/content/browser/risk/fingerprint_browsertest.cc File components/autofill/content/browser/risk/fingerprint_browsertest.cc (right): https://codereview.chromium.org/2846723005/diff/80001/components/autofill/content/browser/risk/fingerprint_browsertest.cc#newcode173 components/autofill/content/browser/risk/fingerprint_browsertest.cc:173: base::MessageLoop::current()->QuitWhenIdle(); Shouldn't this use base::RunLoop().RunUntilIdle()? https://codereview.chromium.org/2846723005/diff/80001/components/password_manager/core/browser/password_store_default_unittest.cc File components/password_manager/core/browser/password_store_default_unittest.cc (right): ...
2 years, 4 months ago (2017-04-28 10:00:23 UTC) #24
fdoray
PTAnL https://codereview.chromium.org/2846723005/diff/80001/components/autofill/content/browser/risk/fingerprint_browsertest.cc File components/autofill/content/browser/risk/fingerprint_browsertest.cc (right): https://codereview.chromium.org/2846723005/diff/80001/components/autofill/content/browser/risk/fingerprint_browsertest.cc#newcode173 components/autofill/content/browser/risk/fingerprint_browsertest.cc:173: base::MessageLoop::current()->QuitWhenIdle(); On 2017/04/28 10:00:23, sdefresne wrote: > Shouldn't ...
2 years, 4 months ago (2017-05-01 17:16:51 UTC) #49
gab
lgtm
2 years, 4 months ago (2017-05-01 18:20:31 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2846723005/200001
2 years, 4 months ago (2017-05-01 18:21:51 UTC) #52
commit-bot: I haz the power
Committed patchset #11 (id:200001) as https://chromium.googlesource.com/chromium/src/+/66a9a083d5158d54b7db7aecd60175fb96e6dc0b
2 years, 4 months ago (2017-05-01 18:31:42 UTC) #55
sdefresne
2 years, 4 months ago (2017-05-02 13:10:36 UTC) #56
Message was sent while issue was closed.
lgtm

Powered by Google App Engine
This is Rietveld 408576698