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

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

Issue 60583003: The chrome.screenlockPrivate API allows select apps to control the ChromeOS ScreenLocker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 var stage = 0;
6
7 function step() {
8 chrome.screenlockPrivate.getLocked(function gotLocked(locked) {
9 if (stage === 0) {
10 if (locked) {
11 chrome.test.fail('locked at stage ' + stage);
12 } else {
13 chrome.screenlockPrivate.setLocked(true);
14 ++stage;
15 return true;
16 }
17 } else if (stage === 1) {
18 if (!locked) {
19 chrome.test.fail('unlocked at stage ' + stage);
20 } else {
21 chrome.screenlockPrivate.setLocked(false);
22 ++stage;
23 return true;
24 }
25 } else if (stage === 2) {
26 if (locked) {
27 chrome.test.fail('locked at stage ' + stage);
28 } else {
29 chrome.test.succeed();
30 }
31 }
32 });
33 };
34
35 chrome.screenlockPrivate.onChanged.addListener(function(locked) {
36 if (locked != (1 == (stage % 2))) {
37 chrome.test.fail((locked ? '' : 'un') + 'locked at stage ' + stage +
38 ' onChanged');
39 } else {
40 return step();
41 }
42 });
43
44 step();
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/screenlockPrivate/manifest.json ('k') | extensions/common/permissions/api_permission.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698