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

Side by Side Diff: chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js

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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 chrome.test.runTests([ 5 chrome.test.runTests([
6 function testActivate() { 6 function testActivate() {
7 var focused = false; 7 var focused = false;
8 var activated = false; 8 var activated = false;
9 chrome.input.ime.onFocus.addListener(function(context) { 9 chrome.input.ime.onFocus.addListener(function(context) {
10 if (context.type == 'none') { 10 if (context.type == 'none') {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 chrome.test.assertFalse(win.document.webkitHidden); 48 chrome.test.assertFalse(win.document.webkitHidden);
49 // test for security origin. 49 // test for security origin.
50 // If security origin is not correctly set, there will be securtiy 50 // If security origin is not correctly set, there will be securtiy
51 // exceptions when accessing DOM or add event listeners. 51 // exceptions when accessing DOM or add event listeners.
52 win.addEventListener('unload', function() {}); 52 win.addEventListener('unload', function() {});
53 chrome.test.succeed(); 53 chrome.test.succeed();
54 }); 54 });
55 }, 55 },
56 56
57 function testSendKeyEvents() { 57 function testSendKeyEvents() {
58 // Sends a normal character key.
58 chrome.input.ime.sendKeyEvents({ 59 chrome.input.ime.sendKeyEvents({
59 'contextID': 1, 60 'contextID': 1,
60 'keyData': [{ 61 'keyData': [{
61 'type': 'keydown', 62 'type': 'keydown',
62 'requestId': '0', 63 'requestId': '0',
63 'key': 'a', 64 'key': 'a',
64 'code': 'KeyA' 65 'code': 'KeyA'
65 }, { 66 }, {
66 'type': 'keyup', 67 'type': 'keyup',
67 'requestId': '1', 68 'requestId': '1',
68 'key': 'a', 69 'key': 'a',
69 'code': 'KeyA' 70 'code': 'KeyA'
70 }] 71 }]
72 }, function() {
73 if (chrome.runtime.lastError) {}
Devlin 2016/06/22 16:33:12 Can we not tell whether or not we expect these to
Azure Wei 2016/06/23 02:45:23 Done.
74 });
75
76 // Sends Ctrl+A that should fail on special pages.
77 chrome.input.ime.sendKeyEvents({
78 'contextID': 1,
79 'keyData': [{
80 'type': 'keydown',
81 'requestId': '2',
82 'key': 'a',
83 'code': 'KeyA',
84 'ctrlKey': true
85 }, {
86 'type': 'keyup',
87 'requestId': '3',
88 'key': 'a',
89 'code': 'KeyA',
90 'ctrlKey': true
91 }]
92 }, function() {
93 if (chrome.runtime.lastError) {}
94 });
95
96 // Sends Tab key that should fail on special pages.
97 chrome.input.ime.sendKeyEvents({
98 'contextID': 1,
99 'keyData': [{
100 'type': 'keydown',
101 'requestId': '4',
102 'key': '\u0009',
103 'code': 'Tab'
104 }]
105 }, function() {
106 if (chrome.runtime.lastError) {}
71 }); 107 });
72 chrome.test.succeed(); 108 chrome.test.succeed();
73 } 109 }
74 ]); 110 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698