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

Side by Side Diff: content/test/data/keyboard_lock/keyboard_lock.js

Issue 2805763004: [System-Keyboard-Lock] Forward navigator functions to RenderFrameHost (Closed)
Patch Set: Add external/wpt tests Created 3 years, 8 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function respondResult(result) {
6 window.domAutomationController.send(result);
7 }
8
9 function testRequestKeyLock() {
10 try {
11 navigator.requestKeyLock(['a', 'b'])
12 .then(() => {
13 respondResult('Succeeded');
14 })
15 .catch((reason) => {
16 respondResult('Failed: ' + reason);
17 });
18 } catch (exception) {
19 respondResult('Failed: ' + exception);
20 }
21 }
22
23 function testCancelKeyLock() {
24 try {
25 navigator.cancelKeyLock();
26 respondResult('Succeeded');
27 } catch (exception) {
28 respondResult('Failed: ' + exception);
29 }
30 }
31
32 function testRequestKeyLockTwice() {
33 try {
34 let result = '';
35 const p1 = navigator.requestKeyLock(['a', 'b'])
36 .then(() => {
37 result += 'Succeeded\n';
38 })
39 .catch((reason) => {
40 result += 'Failed: ' + reason + '\n';
41 });
42 const p2 = navigator.requestKeyLock(['c', 'd'])
43 .then(() => {
44 result += 'Succeeded\n';
45 })
46 .catch((reason) => {
47 result += 'Failed: ' + reason + '\n';
48 });
49 return Promise.all([p1, p2]).then(() => {
50 respondResult(result);
51 });
52 } catch (exception) {
53 result += 'Failed: ' + exception + '\n';
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698