Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2423)

Unified Diff: chrome/browser/chromeos/input_method/input_method_engine_unittest.cc

Issue 641243005: Support a private event - inputMethodPrivate.onCompositionBoundsChanged so that component IME exten… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits + unit test Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/input_method/input_method_engine_unittest.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc b/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc
index 0401f418304868b8655699a6b64e8a7885dc62de..7ea47be7267a47630cce4ce7dde95a701736f23f 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_engine_unittest.cc
@@ -16,6 +16,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ime/chromeos/mock_ime_input_context_handler.h"
#include "ui/base/ime/text_input_flags.h"
+#include "ui/gfx/geometry/rect.h"
namespace chromeos {
@@ -31,7 +32,8 @@ enum CallsBitmap {
ACTIVATE = 1U,
DEACTIVATED = 2U,
ONFOCUS = 4U,
- ONBLUR = 8U
+ ONBLUR = 8U,
+ ONCOMPOSITIONBOUNDSCHANGED = 16U
};
void InitInputMethod() {
@@ -97,6 +99,9 @@ class TestObserver : public InputMethodEngineInterface::Observer {
const std::string& text,
int cursor_pos,
int anchor_pos) override {}
+ virtual void OnCompositionBoundsChanged(const gfx::Rect& bounds) override {
+ calls_bitmap_ |= ONCOMPOSITIONBOUNDSCHANGED;
+ }
virtual void OnReset(const std::string& engine_id) override {}
unsigned char GetCallsBitmapAndReset() {
@@ -250,5 +255,13 @@ TEST_F(InputMethodEngineTest, TestHistograms) {
histograms.ExpectBucketCount("InputMethod.CommitLength", 7, 1);
}
+TEST_F(InputMethodEngineTest, TestCompositionBoundsChanged) {
+ CreateEngine(true);
+ // Enable/disable with focus.
+ engine_->SetCompositionBounds(gfx::Rect());
+ EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED,
+ observer_->GetCallsBitmapAndReset());
+}
+
} // namespace input_method
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698