summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/input_method/xkeyboard.cc6
-rw-r--r--chrome/browser/chromeos/input_method/xkeyboard_unittest.cc15
2 files changed, 13 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/input_method/xkeyboard.cc b/chrome/browser/chromeos/input_method/xkeyboard.cc
index b16cc34..61c8338 100644
--- a/chrome/browser/chromeos/input_method/xkeyboard.cc
+++ b/chrome/browser/chromeos/input_method/xkeyboard.cc
@@ -319,8 +319,7 @@ bool XKeyboard::SetAutoRepeatRate(const AutoRepeatRate& rate) {
// static
bool XKeyboard::CapsLockIsEnabled() {
- // Do not call CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); to make
- // unit_tests happy.
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
XkbStateRec status;
XkbGetState(ui::GetXDisplay(), XkbUseCoreKbd, &status);
return status.locked_mods & LockMask;
@@ -328,8 +327,7 @@ bool XKeyboard::CapsLockIsEnabled() {
// static
void XKeyboard::SetCapsLockEnabled(bool enable_caps_lock) {
- // Do not call CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); to make
- // unit_tests happy.
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
XkbLockModifiers(ui::GetXDisplay(), XkbUseCoreKbd, LockMask,
enable_caps_lock ? LockMask : 0);
}
diff --git a/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc b/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc
index 4ffa9a0..02068dc 100644
--- a/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc
+++ b/chrome/browser/chromeos/input_method/xkeyboard_unittest.cc
@@ -8,14 +8,16 @@
#include <set>
#include <string>
-#include <gtest/gtest.h>
-#include <X11/Xlib.h>
-
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
+#include "content/browser/browser_thread.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/x/x11_util.h"
+#include <X11/Xlib.h>
+
#if defined(TOUCH_UI)
// Since TOUCH_UI build only supports a few keyboard layouts, we skip the tests
// for now.
@@ -45,14 +47,19 @@ class XKeyboardTest : public testing::Test {
XKeyboardTest()
: controller_(IBusController::Create()),
util_(controller_->GetSupportedInputMethods()),
- xkey_(util_) {
+ xkey_(util_),
+ ui_thread_(BrowserThread::UI, &message_loop_) {
}
+
static void SetUpTestCase() {
}
scoped_ptr<IBusController> controller_;
InputMethodUtil util_;
TestableXKeyboard xkey_;
+
+ MessageLoopForUI message_loop_;
+ BrowserThread ui_thread_;
};
// Returns a ModifierMap object that contains the following mapping: