diff options
author | yusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 10:29:28 +0000 |
---|---|---|
committer | yusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 10:29:28 +0000 |
commit | d51269fbfd9444f9ab0ca38c6197e9e000b3cd8e (patch) | |
tree | f45ad6b2dc0e6c39c0e367ca2cff9556cf1bbd5e | |
parent | c7c8e7773c5da5d24db24ba5a93c831957b65eca (diff) | |
download | chromium_src-d51269fbfd9444f9ab0ca38c6197e9e000b3cd8e.zip chromium_src-d51269fbfd9444f9ab0ca38c6197e9e000b3cd8e.tar.gz chromium_src-d51269fbfd9444f9ab0ca38c6197e9e000b3cd8e.tar.bz2 |
cleanup: Run xkeyboard_unittest.cc on UI thread, and add CHECKs back to xkeyboard.cc.
BUG=None
TEST=ran try
Review URL: http://codereview.chromium.org/8344039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106264 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/input_method/xkeyboard.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/input_method/xkeyboard_unittest.cc | 15 |
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: |