Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc

Issue 2466073002: Movw GamepadService out of content/browser/ and into device/ (Closed)
Patch Set: Fixed everything but one unittest Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/browser/gamepad/gamepad_service_test_helpers.h"
17 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" 16 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h"
18 #include "content/common/gamepad_hardware_buffer.h" 17 #include "content/common/gamepad_hardware_buffer.h"
19 #include "device/gamepad/gamepad_test_helpers.h" 18 #include "device/gamepad/gamepad_test_helpers.h"
20 #include "ppapi/c/pp_errors.h" 19 #include "ppapi/c/pp_errors.h"
21 #include "ppapi/host/host_message_context.h" 20 #include "ppapi/host/host_message_context.h"
22 #include "ppapi/proxy/gamepad_resource.h" 21 #include "ppapi/proxy/gamepad_resource.h"
23 #include "ppapi/proxy/ppapi_messages.h" 22 #include "ppapi/proxy/ppapi_messages.h"
24 #include "ppapi/proxy/resource_message_params.h" 23 #include "ppapi/proxy/resource_message_params.h"
25 #include "ppapi/shared_impl/ppb_gamepad_shared.h" 24 #include "ppapi/shared_impl/ppb_gamepad_shared.h"
26 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
27 26
28 namespace content { 27 namespace content {
29 28
30 namespace { 29 namespace {
31 30
32 class PepperGamepadHostTest : public testing::Test, 31 class PepperGamepadHostTest : public testing::Test,
33 public BrowserPpapiHostTest { 32 public BrowserPpapiHostTest {
34 public: 33 public:
35 PepperGamepadHostTest() {} 34 PepperGamepadHostTest() {}
36 ~PepperGamepadHostTest() override {} 35 ~PepperGamepadHostTest() override {}
37 36
38 void ConstructService(const blink::WebGamepads& test_data) { 37 void ConstructService(const blink::WebGamepads& test_data) {
39 service_.reset(new GamepadServiceTestConstructor(test_data)); 38 service_.reset(new device::GamepadServiceTestConstructor(test_data));
40 } 39 }
41 40
42 GamepadService* gamepad_service() { return service_->gamepad_service(); } 41 device::GamepadService* gamepad_service() {
42 return service_->gamepad_service();
43 }
43 44
44 protected: 45 protected:
45 std::unique_ptr<GamepadServiceTestConstructor> service_; 46 std::unique_ptr<device::GamepadServiceTestConstructor> service_;
46 47
47 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHostTest); 48 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHostTest);
48 }; 49 };
49 50
50 inline ptrdiff_t AddressDiff(const void* a, const void* b) { 51 inline ptrdiff_t AddressDiff(const void* a, const void* b) {
51 return static_cast<const char*>(a) - static_cast<const char*>(b); 52 return static_cast<const char*>(a) - static_cast<const char*>(b);
52 } 53 }
53 54
54 } // namespace 55 } // namespace
55 56
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 buffer->buffer.items[0].buttons[i].pressed); 195 buffer->buffer.items[0].buttons[i].pressed);
195 } 196 }
196 197
197 // Duplicate requests should be denied. 198 // Duplicate requests should be denied.
198 EXPECT_EQ(PP_ERROR_FAILED, 199 EXPECT_EQ(PP_ERROR_FAILED,
199 gamepad_host.OnResourceMessageReceived( 200 gamepad_host.OnResourceMessageReceived(
200 PpapiHostMsg_Gamepad_RequestMemory(), &context)); 201 PpapiHostMsg_Gamepad_RequestMemory(), &context));
201 } 202 }
202 203
203 } // namespace content 204 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/pepper_gamepad_host.cc ('k') | content/renderer/gamepad_shared_memory_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698