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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "content/browser/gamepad/gamepad_test_helpers.h" | 9 #include "content/browser/gamepad/gamepad_test_helpers.h" |
10 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" | 10 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 TEST_F(PepperGamepadHostTest, WaitForReply) { | 128 TEST_F(PepperGamepadHostTest, WaitForReply) { |
129 WebKit::WebGamepads default_data; | 129 WebKit::WebGamepads default_data; |
130 memset(&default_data, 0, sizeof(WebKit::WebGamepads)); | 130 memset(&default_data, 0, sizeof(WebKit::WebGamepads)); |
131 default_data.length = 1; | 131 default_data.length = 1; |
132 default_data.items[0].connected = true; | 132 default_data.items[0].connected = true; |
133 default_data.items[0].buttonsLength = 1; | 133 default_data.items[0].buttonsLength = 1; |
134 ConstructService(default_data); | 134 ConstructService(default_data); |
135 | 135 |
136 PP_Instance pp_instance = 12345; | 136 PP_Instance pp_instance = 12345; |
137 PP_Resource pp_resource = 67890; | 137 PP_Resource pp_resource = 67890; |
138 PepperGamepadHost gamepad_host(gamepad_service(), GetPpapiHost(), | 138 PepperGamepadHost gamepad_host(gamepad_service(), GetBrowserPpapiHost(), |
139 pp_instance, pp_resource); | 139 pp_instance, pp_resource); |
140 | 140 |
141 // Synthesize a request for gamepad data. | 141 // Synthesize a request for gamepad data. |
142 ppapi::host::HostMessageContext context( | 142 ppapi::host::HostMessageContext context( |
143 ppapi::proxy::ResourceMessageCallParams(pp_resource, 1)); | 143 ppapi::proxy::ResourceMessageCallParams(pp_resource, 1)); |
144 EXPECT_EQ(PP_OK_COMPLETIONPENDING, | 144 EXPECT_EQ(PP_OK_COMPLETIONPENDING, |
145 gamepad_host.OnResourceMessageReceived( | 145 gamepad_host.OnResourceMessageReceived( |
146 PpapiHostMsg_Gamepad_RequestMemory(), | 146 PpapiHostMsg_Gamepad_RequestMemory(), |
147 &context)); | 147 &context)); |
148 | 148 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 // Duplicate requests should be denied. | 197 // Duplicate requests should be denied. |
198 EXPECT_EQ(PP_ERROR_FAILED, | 198 EXPECT_EQ(PP_ERROR_FAILED, |
199 gamepad_host.OnResourceMessageReceived( | 199 gamepad_host.OnResourceMessageReceived( |
200 PpapiHostMsg_Gamepad_RequestMemory(), | 200 PpapiHostMsg_Gamepad_RequestMemory(), |
201 &context)); | 201 &context)); |
202 } | 202 } |
203 | 203 |
204 } // namespace content | 204 } // namespace content |
OLD | NEW |