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

Side by Side Diff: content/shell/renderer/test_runner/gamepad_controller.h

Issue 1167703002: Move test runner to a component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 6 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_
7
8 #include <map>
9
10 #include "base/memory/weak_ptr.h"
11 #include "third_party/WebKit/public/platform/WebGamepads.h"
12
13 namespace blink {
14 class WebFrame;
15 class WebGamepadListener;
16 }
17
18 namespace content {
19
20 class WebTestDelegate;
21
22 class GamepadController : public base::SupportsWeakPtr<GamepadController> {
23 public:
24 static base::WeakPtr<GamepadController> Create(WebTestDelegate* delegate);
25 ~GamepadController();
26
27 void Reset();
28 void Install(blink::WebFrame* frame);
29
30 void SampleGamepads(blink::WebGamepads& gamepads);
31 void SetListener(blink::WebGamepadListener* listener);
32
33 private:
34 friend class GamepadControllerBindings;
35 GamepadController();
36
37 // TODO(b.kelemen): for historical reasons Connect just initializes the
38 // object. The 'gamepadconnected' event will be dispatched via
39 // DispatchConnected. Tests for connected events need to first connect(),
40 // then set the gamepad data and finally call dispatchConnected().
41 // We should consider renaming Connect to Init and DispatchConnected to
42 // Connect and at the same time updating all the gamepad tests.
43 void Connect(int index);
44 void DispatchConnected(int index);
45
46 void Disconnect(int index);
47 void SetId(int index, const std::string& src);
48 void SetButtonCount(int index, int buttons);
49 void SetButtonData(int index, int button, double data);
50 void SetAxisCount(int index, int axes);
51 void SetAxisData(int index, int axis, double data);
52
53 blink::WebGamepadListener* listener_;
54
55 blink::WebGamepads gamepads_;
56
57 // Mapping from gamepad index to connection state.
58 std::map<int, bool> pending_changes_;
59
60 base::WeakPtrFactory<GamepadController> weak_factory_;
61
62 DISALLOW_COPY_AND_ASSIGN(GamepadController);
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_GAMEPAD_CONTROLLER_H_
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/event_sender.cc ('k') | content/shell/renderer/test_runner/gamepad_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698