This source file includes following definitions.
- TEST
- TEST
#include "content/browser/renderer_host/web_input_event_aura.h"
#include "base/basictypes.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/event.h"
#if defined(USE_X11)
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include "ui/events/test/events_test_utils_x11.h"
#include "ui/gfx/x/x11_types.h"
#endif
namespace content {
TEST(WebInputEventAuraTest, TestMakeWebKeyboardEvent) {
#if defined(USE_X11)
ui::ScopedXI2Event xev;
{
xev.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, 0);
ui::KeyEvent event(xev, false );
blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
EXPECT_EQ(webkit_event.modifiers, blink::WebInputEvent::ControlKey);
}
{
xev.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_CONTROL, ControlMask);
ui::KeyEvent event(xev, false );
blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
EXPECT_EQ(webkit_event.modifiers, 0);
}
#endif
}
TEST(WebInputEventAuraTest, TestMakeWebKeyboardEventWindowsKeyCode) {
#if defined(USE_X11)
ui::ScopedXI2Event xev;
{
xev.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, 0);
XEvent* xevent = xev;
xevent->xkey.keycode = XKeysymToKeycode(gfx::GetXDisplay(), XK_Control_L);
ui::KeyEvent event(xev, false );
blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
EXPECT_EQ(ui::VKEY_LCONTROL, webkit_event.windowsKeyCode);
}
{
xev.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, 0);
XEvent* xevent = xev;
xevent->xkey.keycode = XKeysymToKeycode(gfx::GetXDisplay(), XK_Control_R);
ui::KeyEvent event(xev, false );
blink::WebKeyboardEvent webkit_event = MakeWebKeyboardEvent(&event);
EXPECT_EQ(ui::VKEY_RCONTROL, webkit_event.windowsKeyCode);
}
#elif defined(OS_WIN)
#endif
}
}