Chromium Code Reviews| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 ppapi::WebKitGamepads ppapi_gamepads; | 77 ppapi::WebKitGamepads ppapi_gamepads; |
| 78 blink::WebGamepads web_gamepads; | 78 blink::WebGamepads web_gamepads; |
| 79 EXPECT_EQ(AddressDiff(&web_gamepads.length, &web_gamepads), | 79 EXPECT_EQ(AddressDiff(&web_gamepads.length, &web_gamepads), |
| 80 AddressDiff(&ppapi_gamepads.length, &ppapi_gamepads)); | 80 AddressDiff(&ppapi_gamepads.length, &ppapi_gamepads)); |
| 81 | 81 |
| 82 // See comment below on storage & the EXPECT macro. | 82 // See comment below on storage & the EXPECT macro. |
| 83 size_t webkit_items_length_cap = blink::WebGamepads::itemsLengthCap; | 83 size_t webkit_items_length_cap = blink::WebGamepads::itemsLengthCap; |
| 84 size_t ppapi_items_length_cap = ppapi::WebKitGamepads::kItemsLengthCap; | 84 size_t ppapi_items_length_cap = ppapi::WebKitGamepads::kItemsLengthCap; |
| 85 EXPECT_EQ(webkit_items_length_cap, ppapi_items_length_cap); | 85 EXPECT_EQ(webkit_items_length_cap, ppapi_items_length_cap); |
| 86 | 86 |
| 87 for (size_t i = 0; i < web_gamepads.itemsLengthCap; i++) { | 87 for (size_t i = 0; i < webkit_items_length_cap; i++) { |
|
Łukasz Anforowicz
2017/01/04 22:11:24
This probably got missed by the tool, because I ha
| |
| 88 EXPECT_EQ(AddressDiff(&web_gamepads.items[0], &web_gamepads), | 88 EXPECT_EQ(AddressDiff(&web_gamepads.items[0], &web_gamepads), |
| 89 AddressDiff(&ppapi_gamepads.items[0], &ppapi_gamepads)); | 89 AddressDiff(&ppapi_gamepads.items[0], &ppapi_gamepads)); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 TEST_F(PepperGamepadHostTest, ValidateGamepadMatch) { | 93 TEST_F(PepperGamepadHostTest, ValidateGamepadMatch) { |
| 94 // Gamepad. | 94 // Gamepad. |
| 95 static_assert(sizeof(ppapi::WebKitGamepad) == sizeof(blink::WebGamepad), | 95 static_assert(sizeof(ppapi::WebKitGamepad) == sizeof(blink::WebGamepad), |
| 96 "gamepad data must match"); | 96 "gamepad data must match"); |
| 97 ppapi::WebKitGamepad ppapi_gamepad; | 97 ppapi::WebKitGamepad ppapi_gamepad; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 buffer->buffer.items[0].buttons[i].pressed); | 195 buffer->buffer.items[0].buttons[i].pressed); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Duplicate requests should be denied. | 198 // Duplicate requests should be denied. |
| 199 EXPECT_EQ(PP_ERROR_FAILED, | 199 EXPECT_EQ(PP_ERROR_FAILED, |
| 200 gamepad_host.OnResourceMessageReceived( | 200 gamepad_host.OnResourceMessageReceived( |
| 201 PpapiHostMsg_Gamepad_RequestMemory(), &context)); | 201 PpapiHostMsg_Gamepad_RequestMemory(), &context)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace content | 204 } // namespace content |
| OLD | NEW |