Chromium Code Reviews| Index: device/gamepad/gamepad_service_unittest.cc |
| diff --git a/content/browser/gamepad/gamepad_service_unittest.cc b/device/gamepad/gamepad_service_unittest.cc |
| similarity index 87% |
| rename from content/browser/gamepad/gamepad_service_unittest.cc |
| rename to device/gamepad/gamepad_service_unittest.cc |
| index ea5765d3f04cbe08de40a127b4d37686f592df8b..5dc9e4c7d0ad5ca3bb688c09d3883df9636ee56c 100644 |
| --- a/content/browser/gamepad/gamepad_service_unittest.cc |
| +++ b/device/gamepad/gamepad_service_unittest.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "content/browser/gamepad/gamepad_service.h" |
| +#include "device/gamepad/gamepad_service.h" |
| #include <string.h> |
| @@ -10,12 +10,11 @@ |
| #include "base/macros.h" |
| #include "base/run_loop.h" |
| -#include "content/public/test/test_browser_thread_bundle.h" |
| #include "device/gamepad/gamepad_consumer.h" |
| #include "device/gamepad/gamepad_test_helpers.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -namespace content { |
| +namespace device { |
| namespace { |
| static const int kNumberOfGamepads = blink::WebGamepads::itemsLengthCap; |
| @@ -25,9 +24,7 @@ using blink::WebGamepads; |
| class ConnectionListener : public device::GamepadConsumer { |
| public: |
| - ConnectionListener() { |
| - ClearCounters(); |
| - } |
| + ConnectionListener() { ClearCounters(); } |
| void OnGamepadConnected(unsigned index, |
| const blink::WebGamepad& gamepad) override { |
| @@ -68,18 +65,19 @@ class GamepadServiceTest : public testing::Test { |
| void SetUp() override; |
| + void TearDown() override { base::RunLoop().RunUntilIdle(); } |
|
blundell
2016/12/09 13:35:22
Why is this necessary?
ke.he
2016/12/09 15:15:23
not necessary, removed.
|
| + |
| private: |
| + base::MessageLoop message_loop_; |
| device::MockGamepadDataFetcher* fetcher_; |
| GamepadService* service_; |
| std::unique_ptr<ConnectionListener> connection_listener_; |
| - TestBrowserThreadBundle browser_thread_; |
| WebGamepads test_data_; |
| DISALLOW_COPY_AND_ASSIGN(GamepadServiceTest); |
| }; |
| -GamepadServiceTest::GamepadServiceTest() |
| - : browser_thread_(TestBrowserThreadBundle::IO_MAINLOOP) { |
| +GamepadServiceTest::GamepadServiceTest() { |
| memset(&test_data_, 0, sizeof(test_data_)); |
| // Set it so that we have user gesture. |
| @@ -94,8 +92,8 @@ GamepadServiceTest::~GamepadServiceTest() { |
| void GamepadServiceTest::SetUp() { |
| fetcher_ = new device::MockGamepadDataFetcher(test_data_); |
| - service_ = new GamepadService( |
| - std::unique_ptr<device::GamepadDataFetcher>(fetcher_)); |
| + service_ = |
| + new GamepadService(std::unique_ptr<device::GamepadDataFetcher>(fetcher_)); |
| connection_listener_.reset((new ConnectionListener)); |
| service_->SetSanitizationEnabled(false); |
| service_->ConsumerBecameActive(connection_listener_.get()); |
| @@ -134,4 +132,4 @@ TEST_F(GamepadServiceTest, ConnectionsTest) { |
| EXPECT_EQ(0, GetDisconnectedCounter()); |
| } |
| -} // namespace content |
| +} // namespace device |