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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc

Issue 346513003: Adds the legacy KeyboardEvent.keyCode attribute for extension IMEs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased. Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/ime/input_method_menu_item.h" 5 #include "ash/ime/input_method_menu_item.h"
6 #include "ash/ime/input_method_menu_manager.h" 6 #include "ash/ime/input_method_menu_manager.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 10 #include "chrome/browser/extensions/extension_test_message_listener.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 ASSERT_TRUE(content::ExecuteScript(host->host_contents(), 439 ASSERT_TRUE(content::ExecuteScript(host->host_contents(),
440 send_key_events_test_script)); 440 send_key_events_test_script));
441 441
442 ASSERT_TRUE(keyevent_listener_down.WaitUntilSatisfied()); 442 ASSERT_TRUE(keyevent_listener_down.WaitUntilSatisfied());
443 EXPECT_TRUE(keyevent_listener_down.was_satisfied()); 443 EXPECT_TRUE(keyevent_listener_down.was_satisfied());
444 ASSERT_TRUE(keyevent_listener_up.WaitUntilSatisfied()); 444 ASSERT_TRUE(keyevent_listener_up.WaitUntilSatisfied());
445 EXPECT_TRUE(keyevent_listener_up.was_satisfied()); 445 EXPECT_TRUE(keyevent_listener_up.was_satisfied());
446 } 446 }
447 { 447 {
448 SCOPED_TRACE("sendKeyEvents test with keyCode");
449 mock_input_context->Reset();
450 mock_candidate_window->Reset();
451
452 const char send_key_events_test_script[] =
453 "chrome.input.ime.sendKeyEvents({"
454 " contextID: engineBridge.getFocusedContextID().contextID,"
455 " keyData : [{"
456 " type : 'keydown',"
457 " requestId : '2',"
458 " key : 'a',"
459 " code : 'KeyQ',"
460 " keyCode : 0x41,"
461 " },{"
462 " type : 'keyup',"
463 " requestId : '3',"
464 " key : 'a',"
465 " code : 'KeyQ',"
466 " keyCode : 0x41,"
467 " }]"
468 "});";
469
470 ExtensionTestMessageListener keyevent_listener_down(
471 std::string("onKeyEvent:") + kExtensionID +
472 ":keydown:a:KeyQ:false:false:false:false",
473 false);
474 ExtensionTestMessageListener keyevent_listener_up(
475 std::string("onKeyEvent:") + kExtensionID +
476 ":keyup:a:KeyQ:false:false:false:false",
477 false);
478
479 ASSERT_TRUE(content::ExecuteScript(host->host_contents(),
480 send_key_events_test_script));
481
482 ASSERT_TRUE(keyevent_listener_down.WaitUntilSatisfied());
483 EXPECT_TRUE(keyevent_listener_down.was_satisfied());
484 ASSERT_TRUE(keyevent_listener_up.WaitUntilSatisfied());
485 EXPECT_TRUE(keyevent_listener_up.was_satisfied());
486 }
487 {
448 SCOPED_TRACE("setComposition test"); 488 SCOPED_TRACE("setComposition test");
449 mock_input_context->Reset(); 489 mock_input_context->Reset();
450 mock_candidate_window->Reset(); 490 mock_candidate_window->Reset();
451 491
452 const char set_composition_test_script[] = 492 const char set_composition_test_script[] =
453 "chrome.input.ime.setComposition({" 493 "chrome.input.ime.setComposition({"
454 " contextID: engineBridge.getFocusedContextID().contextID," 494 " contextID: engineBridge.getFocusedContextID().contextID,"
455 " text:'COMPOSITION_TEXT'," 495 " text:'COMPOSITION_TEXT',"
456 " cursor:4," 496 " cursor:4,"
457 " segments : [{" 497 " segments : [{"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 939 }
900 } 940 }
901 941
902 IMEBridge::Get()->SetInputContextHandler(NULL); 942 IMEBridge::Get()->SetInputContextHandler(NULL);
903 IMEBridge::Get()->SetCandidateWindowHandler(NULL); 943 IMEBridge::Get()->SetCandidateWindowHandler(NULL);
904 } 944 }
905 945
906 } // namespace 946 } // namespace
907 } // namespace input_method 947 } // namespace input_method
908 } // namespace chromeos 948 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698