| 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" |
| 11 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" | 11 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" |
| 12 #include "content/common/gamepad_hardware_buffer.h" | 12 #include "content/common/gamepad_hardware_buffer.h" |
| 13 #include "ppapi/c/pp_errors.h" | 13 #include "ppapi/c/pp_errors.h" |
| 14 #include "ppapi/host/host_message_context.h" | 14 #include "ppapi/host/host_message_context.h" |
| 15 #include "ppapi/proxy/gamepad_resource.h" | 15 #include "ppapi/proxy/gamepad_resource.h" |
| 16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
| 17 #include "ppapi/proxy/resource_message_params.h" | 17 #include "ppapi/proxy/resource_message_params.h" |
| 18 #include "ppapi/shared_impl/ppb_gamepad_shared.h" | 18 #include "ppapi/shared_impl/ppb_gamepad_shared.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 class PepperGamepadHostTest : public testing::Test, | 25 class PepperGamepadHostTest : public testing::Test, |
| 26 public BrowserPpapiHostTest { | 26 public BrowserPpapiHostTest { |
| 27 public: | 27 public: |
| 28 PepperGamepadHostTest() {} | 28 PepperGamepadHostTest() {} |
| 29 virtual ~PepperGamepadHostTest() {} | 29 ~PepperGamepadHostTest() override {} |
| 30 | 30 |
| 31 void ConstructService(const blink::WebGamepads& test_data) { | 31 void ConstructService(const blink::WebGamepads& test_data) { |
| 32 service_.reset(new GamepadServiceTestConstructor(test_data)); | 32 service_.reset(new GamepadServiceTestConstructor(test_data)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 GamepadService* gamepad_service() { return service_->gamepad_service(); } | 35 GamepadService* gamepad_service() { return service_->gamepad_service(); } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 scoped_ptr<GamepadServiceTestConstructor> service_; | 38 scoped_ptr<GamepadServiceTestConstructor> service_; |
| 39 | 39 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 buffer->buffer.items[0].buttons[i].pressed); | 181 buffer->buffer.items[0].buttons[i].pressed); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Duplicate requests should be denied. | 184 // Duplicate requests should be denied. |
| 185 EXPECT_EQ(PP_ERROR_FAILED, | 185 EXPECT_EQ(PP_ERROR_FAILED, |
| 186 gamepad_host.OnResourceMessageReceived( | 186 gamepad_host.OnResourceMessageReceived( |
| 187 PpapiHostMsg_Gamepad_RequestMemory(), &context)); | 187 PpapiHostMsg_Gamepad_RequestMemory(), &context)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace content | 190 } // namespace content |
| OLD | NEW |