| 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 "content/browser/renderer_host/pepper/pepper_gamepad_host.h" | 5 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 static_assert(sizeof(ppapi::WebKitGamepads) == sizeof(blink::WebGamepads), | 75 static_assert(sizeof(ppapi::WebKitGamepads) == sizeof(blink::WebGamepads), |
| 76 "gamepads data must match"); | 76 "gamepads data must match"); |
| 77 ppapi::WebKitGamepads ppapi_gamepads; | 77 ppapi::WebKitGamepads ppapi_gamepads; |
| 78 blink::WebGamepads web_gamepads; | 78 blink::WebGamepads web_gamepads; |
| 79 | 79 |
| 80 // See comment below on storage & the EXPECT macro. | 80 // See comment below on storage & the EXPECT macro. |
| 81 size_t webkit_items_length_cap = blink::WebGamepads::itemsLengthCap; | 81 size_t webkit_items_length_cap = blink::WebGamepads::itemsLengthCap; |
| 82 size_t ppapi_items_length_cap = ppapi::WebKitGamepads::kItemsLengthCap; | 82 size_t ppapi_items_length_cap = ppapi::WebKitGamepads::kItemsLengthCap; |
| 83 EXPECT_EQ(webkit_items_length_cap, ppapi_items_length_cap); | 83 EXPECT_EQ(webkit_items_length_cap, ppapi_items_length_cap); |
| 84 | 84 |
| 85 for (size_t i = 0; i < web_gamepads.itemsLengthCap; i++) { | 85 for (size_t i = 0; i < webkit_items_length_cap; i++) { |
| 86 EXPECT_EQ(AddressDiff(&web_gamepads.items[0], &web_gamepads), | 86 EXPECT_EQ(AddressDiff(&web_gamepads.items[0], &web_gamepads), |
| 87 AddressDiff(&ppapi_gamepads.items[0], &ppapi_gamepads)); | 87 AddressDiff(&ppapi_gamepads.items[0], &ppapi_gamepads)); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 TEST_F(PepperGamepadHostTest, ValidateGamepadMatch) { | 91 TEST_F(PepperGamepadHostTest, ValidateGamepadMatch) { |
| 92 // Gamepad. | 92 // Gamepad. |
| 93 static_assert(sizeof(ppapi::WebKitGamepad) == sizeof(blink::WebGamepad), | 93 static_assert(sizeof(ppapi::WebKitGamepad) == sizeof(blink::WebGamepad), |
| 94 "gamepad data must match"); | 94 "gamepad data must match"); |
| 95 ppapi::WebKitGamepad ppapi_gamepad; | 95 ppapi::WebKitGamepad ppapi_gamepad; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 buffer->buffer.items[0].buttons[i].pressed); | 185 buffer->buffer.items[0].buttons[i].pressed); |
| 186 } | 186 } |
| 187 | 187 |
| 188 // Duplicate requests should be denied. | 188 // Duplicate requests should be denied. |
| 189 EXPECT_EQ(PP_ERROR_FAILED, | 189 EXPECT_EQ(PP_ERROR_FAILED, |
| 190 gamepad_host.OnResourceMessageReceived( | 190 gamepad_host.OnResourceMessageReceived( |
| 191 PpapiHostMsg_Gamepad_RequestMemory(), &context)); | 191 PpapiHostMsg_Gamepad_RequestMemory(), &context)); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace content | 194 } // namespace content |
| OLD | NEW |