Update broken references to image assets
[chromium-blink-merge.git] / content / test / mock_keyboard.cc
blob55b695d44d50c63ddeec3a695ab55f1ff1b27383
1 // Copyright (c) 2011 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 "content/test/mock_keyboard.h"
7 #include "base/logging.h"
9 namespace content {
11 MockKeyboard::MockKeyboard()
12 : keyboard_layout_(LAYOUT_NULL),
13 keyboard_modifiers_(INVALID) {
16 MockKeyboard::~MockKeyboard() {
19 int MockKeyboard::GetCharacters(Layout layout,
20 int key_code,
21 Modifiers modifiers,
22 std::wstring* output) {
23 #if defined(OS_WIN)
24 CHECK(output);
25 // Change the keyboard layout only when we have to because it takes a lot of
26 // time to load a keyboard-layout driver.
27 // When we change the layout, we reset the modifier status to force updating
28 // the keyboard status.
29 if (layout != keyboard_layout_) {
30 if (!driver_.SetLayout(layout))
31 return -1;
32 keyboard_layout_ = layout;
33 keyboard_modifiers_ = INVALID;
36 // Update the keyboard states.
37 if (modifiers != keyboard_modifiers_) {
38 if (!driver_.SetModifiers(modifiers))
39 return -1;
40 keyboard_modifiers_ = modifiers;
43 // Retrieve Unicode characters associate with the key code.
44 return driver_.GetCharacters(key_code, output);
45 #else
46 NOTIMPLEMENTED();
47 return -1;
48 #endif
51 } // namespace content