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

Side by Side Diff: components/exo/gamepad_unittest.cc

Issue 2315833003: Remove calls to deprecated MessageLoop methods in components. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | components/storage_monitor/storage_monitor_chromeos_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/run_loop.h"
7 #include "base/test/test_simple_task_runner.h" 8 #include "base/test/test_simple_task_runner.h"
8 #include "components/exo/buffer.h" 9 #include "components/exo/buffer.h"
9 #include "components/exo/gamepad.h" 10 #include "components/exo/gamepad.h"
10 #include "components/exo/gamepad_delegate.h" 11 #include "components/exo/gamepad_delegate.h"
11 #include "components/exo/shell_surface.h" 12 #include "components/exo/shell_surface.h"
12 #include "components/exo/surface.h" 13 #include "components/exo/surface.h"
13 #include "components/exo/test/exo_test_base.h" 14 #include "components/exo/test/exo_test_base.h"
14 #include "components/exo/test/exo_test_helper.h" 15 #include "components/exo/test/exo_test_helper.h"
15 #include "device/gamepad/gamepad_test_helpers.h" 16 #include "device/gamepad/gamepad_test_helpers.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 polling_task_runner_->RunPendingTasks(); 63 polling_task_runner_->RunPendingTasks();
63 polling_task_runner_ = nullptr; 64 polling_task_runner_ = nullptr;
64 } 65 }
65 66
66 void SetDataAndPostToDelegate(const blink::WebGamepads& new_data) { 67 void SetDataAndPostToDelegate(const blink::WebGamepads& new_data) {
67 ASSERT_TRUE(mock_data_fetcher_ != nullptr); 68 ASSERT_TRUE(mock_data_fetcher_ != nullptr);
68 mock_data_fetcher_->SetTestData(new_data); 69 mock_data_fetcher_->SetTestData(new_data);
69 // Run one polling cycle, which will post a task to the origin task runner. 70 // Run one polling cycle, which will post a task to the origin task runner.
70 polling_task_runner_->RunPendingTasks(); 71 polling_task_runner_->RunPendingTasks();
71 // Run origin task runner to invoke delegate. 72 // Run origin task runner to invoke delegate.
72 base::MessageLoop::current()->RunUntilIdle(); 73 base::RunLoop().RunUntilIdle();
73 } 74 }
74 75
75 protected: 76 protected:
76 std::unique_ptr<Gamepad> gamepad_; 77 std::unique_ptr<Gamepad> gamepad_;
77 78
78 // Task runner to simulate the polling thread. 79 // Task runner to simulate the polling thread.
79 scoped_refptr<base::TestSimpleTaskRunner> polling_task_runner_; 80 scoped_refptr<base::TestSimpleTaskRunner> polling_task_runner_;
80 81
81 // Weak reference to the mock data fetcher provided by MockDataFetcherFactory. 82 // Weak reference to the mock data fetcher provided by MockDataFetcherFactory.
82 // This instance is valid until both gamepad_ and polling_task_runner_ are 83 // This instance is valid until both gamepad_ and polling_task_runner_ are
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // scheduled in the next round. 213 // scheduled in the next round.
213 polling_task_runner_->RunPendingTasks(); 214 polling_task_runner_->RunPendingTasks();
214 polling_task_runner_->RunPendingTasks(); 215 polling_task_runner_->RunPendingTasks();
215 ASSERT_FALSE(polling_task_runner_->HasPendingTask()); 216 ASSERT_FALSE(polling_task_runner_->HasPendingTask());
216 217
217 DestroyGamepad(&delegate); 218 DestroyGamepad(&delegate);
218 } 219 }
219 220
220 } // namespace 221 } // namespace
221 } // namespace exo 222 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | components/storage_monitor/storage_monitor_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698