1 // Copyright 2013 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.
5 #include "ui/base/test/ui_controls_aura.h"
7 #include "base/logging.h"
9 namespace ui_controls
{
11 UIControlsAura
* instance_
= NULL
;
12 bool g_ui_controls_enabled
= false;
15 void EnableUIControls() {
16 g_ui_controls_enabled
= true;
19 // An interface to provide Aura implementation of UI control.
20 bool SendKeyPress(gfx::NativeWindow window
,
26 CHECK(g_ui_controls_enabled
);
27 return instance_
->SendKeyPress(
28 window
, key
, control
, shift
, alt
, command
);
32 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window
,
38 const base::Closure
& task
) {
39 CHECK(g_ui_controls_enabled
);
40 return instance_
->SendKeyPressNotifyWhenDone(
41 window
, key
, control
, shift
, alt
, command
, task
);
45 bool SendMouseMove(long x
, long y
) {
46 CHECK(g_ui_controls_enabled
);
47 return instance_
->SendMouseMove(x
, y
);
51 bool SendMouseMoveNotifyWhenDone(long x
,
53 const base::Closure
& task
) {
54 CHECK(g_ui_controls_enabled
);
55 return instance_
->SendMouseMoveNotifyWhenDone(x
, y
, task
);
59 bool SendMouseEvents(MouseButton type
, int state
) {
60 CHECK(g_ui_controls_enabled
);
61 return instance_
->SendMouseEvents(type
, state
);
65 bool SendMouseEventsNotifyWhenDone(MouseButton type
,
67 const base::Closure
& task
) {
68 CHECK(g_ui_controls_enabled
);
69 return instance_
->SendMouseEventsNotifyWhenDone(type
, state
, task
);
73 bool SendMouseClick(MouseButton type
) {
74 CHECK(g_ui_controls_enabled
);
75 return instance_
->SendMouseClick(type
);
79 void RunClosureAfterAllPendingUIEvents(const base::Closure
& closure
) {
80 instance_
->RunClosureAfterAllPendingUIEvents(closure
);
83 UIControlsAura::UIControlsAura() {
86 UIControlsAura::~UIControlsAura() {
89 // static. declared in ui_controls.h
90 void InstallUIControlsAura(UIControlsAura
* instance
) {
95 } // namespace ui_controls