| Index: device/gamepad/gamepad_provider_unittest.cc
|
| diff --git a/device/gamepad/gamepad_provider_unittest.cc b/device/gamepad/gamepad_provider_unittest.cc
|
| index 2f1633e7c656cf41bfa3a3dff29e734feab841bc..a416474f23abecfc8391f4dc81f094d2d23824e1 100644
|
| --- a/device/gamepad/gamepad_provider_unittest.cc
|
| +++ b/device/gamepad/gamepad_provider_unittest.cc
|
| @@ -18,8 +18,6 @@ namespace device {
|
|
|
| namespace {
|
|
|
| -using blink::WebGamepads;
|
| -
|
| // Helper class to generate and record user gesture callbacks.
|
| class UserGestureListener {
|
| public:
|
| @@ -42,7 +40,7 @@ class UserGestureListener {
|
| // Main test fixture
|
| class GamepadProviderTest : public testing::Test, public GamepadTestHelper {
|
| public:
|
| - GamepadProvider* CreateProvider(const WebGamepads& test_data) {
|
| + GamepadProvider* CreateProvider(const Gamepads& test_data) {
|
| mock_data_fetcher_ = new MockGamepadDataFetcher(test_data);
|
| provider_.reset(new GamepadProvider(
|
| nullptr, std::unique_ptr<GamepadDataFetcher>(mock_data_fetcher_)));
|
| @@ -50,12 +48,12 @@ class GamepadProviderTest : public testing::Test, public GamepadTestHelper {
|
| }
|
|
|
| void ReadGamepadHardwareBuffer(GamepadHardwareBuffer* buffer,
|
| - WebGamepads* output) {
|
| - memset(output, 0, sizeof(WebGamepads));
|
| + Gamepads* output) {
|
| + memset(output, 0, sizeof(Gamepads));
|
| base::subtle::Atomic32 version;
|
| do {
|
| version = buffer->seqlock.ReadBegin();
|
| - memcpy(output, &buffer->data, sizeof(WebGamepads));
|
| + memcpy(output, &buffer->data, sizeof(Gamepads));
|
| } while (buffer->seqlock.ReadRetry(version));
|
| }
|
|
|
| @@ -72,8 +70,8 @@ class GamepadProviderTest : public testing::Test, public GamepadTestHelper {
|
|
|
| // Test is flaky. crbug.com/705367
|
| TEST_F(GamepadProviderTest, DISABLED_PollingAccess) {
|
| - WebGamepads test_data;
|
| - memset(&test_data, 0, sizeof(WebGamepads));
|
| + Gamepads test_data;
|
| + memset(&test_data, 0, sizeof(Gamepads));
|
| test_data.items[0].connected = true;
|
| test_data.items[0].timestamp = 0;
|
| test_data.items[0].buttons_length = 1;
|
| @@ -100,7 +98,7 @@ TEST_F(GamepadProviderTest, DISABLED_PollingAccess) {
|
|
|
| GamepadHardwareBuffer* buffer =
|
| static_cast<GamepadHardwareBuffer*>(shared_memory->memory());
|
| - WebGamepads output;
|
| + Gamepads output;
|
| ReadGamepadHardwareBuffer(buffer, &output);
|
|
|
| EXPECT_EQ(1u, output.items[0].buttons_length);
|
| @@ -113,7 +111,7 @@ TEST_F(GamepadProviderTest, DISABLED_PollingAccess) {
|
|
|
| // Flaky on all platforms: http://crbug.com/692219
|
| TEST_F(GamepadProviderTest, DISABLED_ConnectDisconnectMultiple) {
|
| - WebGamepads test_data;
|
| + Gamepads test_data;
|
| test_data.items[0].connected = true;
|
| test_data.items[0].timestamp = 0;
|
| test_data.items[0].axes_length = 2;
|
| @@ -126,7 +124,7 @@ TEST_F(GamepadProviderTest, DISABLED_ConnectDisconnectMultiple) {
|
| test_data.items[1].axes[0] = 1.f;
|
| test_data.items[1].axes[1] = -.5f;
|
|
|
| - WebGamepads test_data_onedisconnected;
|
| + Gamepads test_data_onedisconnected;
|
| test_data_onedisconnected.items[1].connected = true;
|
| test_data_onedisconnected.items[1].timestamp = 0;
|
| test_data_onedisconnected.items[1].axes_length = 2;
|
| @@ -150,7 +148,7 @@ TEST_F(GamepadProviderTest, DISABLED_ConnectDisconnectMultiple) {
|
|
|
| GamepadHardwareBuffer* buffer =
|
| static_cast<GamepadHardwareBuffer*>(shared_memory->memory());
|
| - WebGamepads output;
|
| + Gamepads output;
|
| ReadGamepadHardwareBuffer(buffer, &output);
|
|
|
| EXPECT_EQ(2u, output.items[0].axes_length);
|
| @@ -172,7 +170,7 @@ TEST_F(GamepadProviderTest, DISABLED_ConnectDisconnectMultiple) {
|
|
|
| // Tests that waiting for a user gesture works properly.
|
| TEST_F(GamepadProviderTest, UserGesture) {
|
| - WebGamepads no_button_data;
|
| + Gamepads no_button_data;
|
| no_button_data.items[0].connected = true;
|
| no_button_data.items[0].timestamp = 0;
|
| no_button_data.items[0].buttons_length = 1;
|
| @@ -182,7 +180,7 @@ TEST_F(GamepadProviderTest, UserGesture) {
|
| no_button_data.items[0].axes[0] = 0.f;
|
| no_button_data.items[0].axes[1] = .4f;
|
|
|
| - WebGamepads button_down_data = no_button_data;
|
| + Gamepads button_down_data = no_button_data;
|
| button_down_data.items[0].buttons[0].value = 1.f;
|
| button_down_data.items[0].buttons[0].pressed = true;
|
|
|
| @@ -215,7 +213,7 @@ TEST_F(GamepadProviderTest, UserGesture) {
|
| #endif
|
| // Tests that waiting for a user gesture works properly.
|
| TEST_F(GamepadProviderTest, MAYBE_Sanitization) {
|
| - WebGamepads active_data;
|
| + Gamepads active_data;
|
| active_data.items[0].connected = true;
|
| active_data.items[0].timestamp = 0;
|
| active_data.items[0].buttons_length = 1;
|
| @@ -224,7 +222,7 @@ TEST_F(GamepadProviderTest, MAYBE_Sanitization) {
|
| active_data.items[0].buttons[0].pressed = true;
|
| active_data.items[0].axes[0] = -1.f;
|
|
|
| - WebGamepads zero_data;
|
| + Gamepads zero_data;
|
| zero_data.items[0].connected = true;
|
| zero_data.items[0].timestamp = 0;
|
| zero_data.items[0].buttons_length = 1;
|
| @@ -251,7 +249,7 @@ TEST_F(GamepadProviderTest, MAYBE_Sanitization) {
|
|
|
| GamepadHardwareBuffer* buffer =
|
| static_cast<GamepadHardwareBuffer*>(shared_memory->memory());
|
| - WebGamepads output;
|
| + Gamepads output;
|
| ReadGamepadHardwareBuffer(buffer, &output);
|
|
|
| // Initial data should all be zeroed out due to sanitization, even though the
|
|
|