OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "third_party/WebKit/public/platform/WebGamepads.h" | 9 #include "third_party/WebKit/public/platform/WebGamepads.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 GamepadController(); | 23 GamepadController(); |
24 ~GamepadController(); | 24 ~GamepadController(); |
25 | 25 |
26 void Reset(); | 26 void Reset(); |
27 void Install(blink::WebFrame* frame); | 27 void Install(blink::WebFrame* frame); |
28 void SetDelegate(WebTestRunner::WebTestDelegate* delegate); | 28 void SetDelegate(WebTestRunner::WebTestDelegate* delegate); |
29 | 29 |
30 private: | 30 private: |
31 friend class GamepadControllerBindings; | 31 friend class GamepadControllerBindings; |
32 | 32 |
| 33 // TODO(b.kelemen): for historical reasons Connect just initializes the |
| 34 // object. The 'gamepadconnected' event will be dispatched via |
| 35 // DispatchConnected. Tests for connected events need to first connect(), |
| 36 // then set the gamepad data and finally call dispatchConnected(). |
| 37 // We should consider renaming Connect to Init and DispatchConnected to |
| 38 // Connect and at the same time updating all the gamepad tests. |
33 void Connect(int index); | 39 void Connect(int index); |
| 40 void DispatchConnected(int index); |
| 41 |
34 void Disconnect(int index); | 42 void Disconnect(int index); |
35 void SetId(int index, const std::string& src); | 43 void SetId(int index, const std::string& src); |
36 void SetButtonCount(int index, int buttons); | 44 void SetButtonCount(int index, int buttons); |
37 void SetButtonData(int index, int button, double data); | 45 void SetButtonData(int index, int button, double data); |
38 void SetAxisCount(int index, int axes); | 46 void SetAxisCount(int index, int axes); |
39 void SetAxisData(int index, int axis, double data); | 47 void SetAxisData(int index, int axis, double data); |
40 | 48 |
41 blink::WebGamepads gamepads_; | 49 blink::WebGamepads gamepads_; |
42 | 50 |
43 WebTestRunner::WebTestDelegate* delegate_; | 51 WebTestRunner::WebTestDelegate* delegate_; |
44 | 52 |
45 base::WeakPtrFactory<GamepadController> weak_factory_; | 53 base::WeakPtrFactory<GamepadController> weak_factory_; |
46 | 54 |
47 DISALLOW_COPY_AND_ASSIGN(GamepadController); | 55 DISALLOW_COPY_AND_ASSIGN(GamepadController); |
48 }; | 56 }; |
49 | 57 |
50 } // namespace content | 58 } // namespace content |
51 | 59 |
52 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ | 60 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_ |
OLD | NEW |