OLD | NEW |
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 "device/gamepad/gamepad_provider.h" | 5 #include "device/gamepad/gamepad_provider.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 bool has_user_gesture_; | 38 bool has_user_gesture_; |
39 base::WeakPtrFactory<UserGestureListener> weak_factory_; | 39 base::WeakPtrFactory<UserGestureListener> weak_factory_; |
40 }; | 40 }; |
41 | 41 |
42 // Main test fixture | 42 // Main test fixture |
43 class GamepadProviderTest : public testing::Test, public GamepadTestHelper { | 43 class GamepadProviderTest : public testing::Test, public GamepadTestHelper { |
44 public: | 44 public: |
45 GamepadProvider* CreateProvider(const WebGamepads& test_data) { | 45 GamepadProvider* CreateProvider(const WebGamepads& test_data) { |
46 mock_data_fetcher_ = new MockGamepadDataFetcher(test_data); | 46 mock_data_fetcher_ = new MockGamepadDataFetcher(test_data); |
47 provider_.reset(new GamepadProvider( | 47 provider_.reset(new GamepadProvider( |
48 std::unique_ptr<GamepadSharedBuffer>(new MockGamepadSharedBuffer()), | |
49 nullptr, std::unique_ptr<GamepadDataFetcher>(mock_data_fetcher_))); | 48 nullptr, std::unique_ptr<GamepadDataFetcher>(mock_data_fetcher_))); |
50 return provider_.get(); | 49 return provider_.get(); |
51 } | 50 } |
52 | 51 |
53 protected: | 52 protected: |
54 GamepadProviderTest() {} | 53 GamepadProviderTest() {} |
55 | 54 |
56 std::unique_ptr<GamepadProvider> provider_; | 55 std::unique_ptr<GamepadProvider> provider_; |
57 | 56 |
58 // Pointer owned by the provider. | 57 // Pointer owned by the provider. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 EXPECT_EQ(1u, output->items[0].buttonsLength); | 225 EXPECT_EQ(1u, output->items[0].buttonsLength); |
227 EXPECT_EQ(1.f, output->items[0].buttons[0].value); | 226 EXPECT_EQ(1.f, output->items[0].buttons[0].value); |
228 EXPECT_TRUE(output->items[0].buttons[0].pressed); | 227 EXPECT_TRUE(output->items[0].buttons[0].pressed); |
229 EXPECT_EQ(1u, output->items[0].axesLength); | 228 EXPECT_EQ(1u, output->items[0].axesLength); |
230 EXPECT_EQ(-1.f, output->items[0].axes[0]); | 229 EXPECT_EQ(-1.f, output->items[0].axes[0]); |
231 } | 230 } |
232 | 231 |
233 } // namespace | 232 } // namespace |
234 | 233 |
235 } // namespace device | 234 } // namespace device |
OLD | NEW |