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

Unified Diff: chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc

Issue 2077783002: Make limitations for input.ime.sendKeyEvents API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Blacklist extension window. Created 4 years, 6 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/ui/views/ime/input_ime_apitest_nonchromeos.cc
diff --git a/chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc b/chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc
index 55eadfcb04b16911613f2e486468ddf23fa097d5..6a42fa7ce5c1098adad765b69731acdc0b98687e 100644
--- a/chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc
+++ b/chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/test/base/ui_test_utils.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/ime/dummy_text_input_client.h"
@@ -45,7 +46,33 @@ IN_PROC_BROWSER_TEST_F(InputImeApiTest, CreateWindowTest) {
ASSERT_EQ(client->insert_char_count(), 1);
ASSERT_EQ(client->last_insert_char(), L'a');
+ std::vector<ui::KeyEvent*> key_events = input_method->GetKeyEventsForTest();
+ ASSERT_EQ(key_events.size(), 5U);
+ ASSERT_EQ(key_events[0]->key_code(), ui::VKEY_A);
+ ASSERT_EQ(key_events[2]->key_code(), ui::VKEY_A);
+ ASSERT_EQ(key_events[4]->key_code(), ui::VKEY_TAB);
+
input_method->DetachTextInputClient(client.get());
}
+IN_PROC_BROWSER_TEST_F(InputImeApiTest, SendKeyEventsOnSpecialPages) {
+ // Navigates to special page that sendKeyEvents API has limition with.
+ ui_test_utils::NavigateToURL(browser(), GURL("chrome://flags"));
+
+ BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
+ ui::InputMethod* input_method =
+ browser_view->GetNativeWindow()->GetHost()->GetInputMethod();
+ std::unique_ptr<ui::DummyTextInputClient> client(
+ new ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT));
+ input_method->SetFocusedTextInputClient(client.get());
+ ExtensionFunction::ScopedUserGestureForTests scoped_user_gesture;
+ InputImeActivateFunction::disable_bubble_for_testing_ = true;
+
+ ASSERT_TRUE(RunExtensionTest("input_ime_nonchromeos")) << message_;
+
+ std::vector<ui::KeyEvent*> key_events = input_method->GetKeyEventsForTest();
+ ASSERT_EQ(key_events.size(), 2U);
Devlin 2016/06/22 16:33:12 switch the order here: expected, actual
Azure Wei 2016/06/23 02:45:23 Done.
+ ASSERT_EQ(key_events[0]->key_code(), ui::VKEY_A);
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698