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

Unified Diff: chrome/test/data/extensions/api_test/screenlock_private/auth_type/test.js

Issue 168623003: Add chrome.screenlockPrivate API functions to handle alternate auth types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update screen locker to send event Created 6 years, 10 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/test/data/extensions/api_test/screenlock_private/auth_type/test.js
diff --git a/chrome/test/data/extensions/api_test/screenlock_private/auth_type/test.js b/chrome/test/data/extensions/api_test/screenlock_private/auth_type/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..05c199e70b68b9df52995acbee3f50d3112b49e7
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/screenlock_private/auth_type/test.js
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var authAttempted = false;
+
+function setAuthType() {
+ chrome.screenlockPrivate.setAuthType('userClick');
+ chrome.screenlockPrivate.getAuthType(function(authType) {
+ chrome.test.assertEq('userClick', authType);
+ chrome.test.sendMessage('attemptClickAuth');
+ });
+}
+
+chrome.screenlockPrivate.onChanged.addListener(function(locked) {
+ if (locked && !authAttempted) {
+ setAuthType();
+ } else if (!locked && authAttempted) {
+ chrome.test.succeed();
+ } else {
+ var action = locked ? "lock" : "unlock";
+ chrome.test.fail('Unexpected ' + action);
+ }
+});
+
+chrome.screenlockPrivate.onAuthAttempted.addListener(function(authType, input) {
+ chrome.test.assertEq('userClick', authType);
+ authAttempted = true;
+ chrome.screenlockPrivate.acceptAuthAttempt(true);
+});
+
+chrome.test.runTests([
+ function testAuthType() {
+ chrome.screenlockPrivate.setLocked(true);
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698