commit | c85e9b80f0ce78e2e7c5e052a88127559931093c | [log] [tgz] |
---|---|---|
author | fdoray <[email protected]> | Thu Apr 06 15:37:22 2017 |
committer | Commit bot <[email protected]> | Thu Apr 06 15:37:22 2017 |
tree | 8e703f35f82ef4944bf107cf0adabe9c79ab9b6c | |
parent | 02bcc3b40ce45caa642e67304a41c812d3ce8955 [diff] [blame] |
Use ScopedTaskEnvironment instead of MessageLoop in chromeos unit tests. ScopedTaskEnvironment allows usage of ThreadTaskRunnerHandle and base/task_scheduler/post_task.h within its scope. It should be instantiated in every unit test 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 [email protected] [email protected], [email protected], [email protected] Review-Url: https://codereview.chromium.org/2799753002 Cr-Commit-Position: refs/heads/master@{#462486}
diff --git a/chromeos/network/network_connect_unittest.cc b/chromeos/network/network_connect_unittest.cc index 90d2444..80689f2 100644 --- a/chromeos/network/network_connect_unittest.cc +++ b/chromeos/network/network_connect_unittest.cc
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/shill_device_client.h" #include "chromeos/dbus/shill_service_client.h" @@ -146,7 +147,7 @@ std::unique_ptr<MockDelegate> mock_delegate_; std::unique_ptr<MockTetherDelegate> mock_tether_delegate_; - base::MessageLoop message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_; ShillDeviceClient::TestInterface* device_test_; ShillServiceClient::TestInterface* service_test_;