| Index: chrome/test/data/extensions/api_test/passwords_private/test.js
|
| diff --git a/chrome/test/data/extensions/api_test/passwords_private/test.js b/chrome/test/data/extensions/api_test/passwords_private/test.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d0e8d7c5f13c2048923df695b237aefee590ba7c
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/passwords_private/test.js
|
| @@ -0,0 +1,81 @@
|
| +// Copyright 2015 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.
|
| +
|
| +// This just tests the interface. It does not test for specific results, only
|
| +// that callbacks are correctly invoked, expected parameters are correct,
|
| +// and failures are detected.
|
| +
|
| +var availableTests = [
|
| + function canPasswordAccountBeManaged() {
|
| + var callback = function() {
|
| + // Ensure that the callback is invoked.
|
| + chrome.test.succeed();
|
| + };
|
| +
|
| + chrome.passwordsPrivate.canPasswordAccountBeManaged(callback);
|
| + },
|
| +
|
| + function removeSavedPassword() {
|
| + var numCalls = 0;
|
| + var numSavedPasswords;
|
| + var callback = function(savedPasswordsList) {
|
| + numCalls++;
|
| +
|
| + if (numCalls == 1) {
|
| + numSavedPasswords = savedPasswordsList.length;
|
| + chrome.passwordsPrivate.removeSavedPassword({
|
| + originUrl: savedPasswordsList[0].loginPair.originUrl,
|
| + username: savedPasswordsList[0].loginPair.username
|
| + });
|
| + } else if (numCalls == 2) {
|
| + chrome.test.assertEq(
|
| + savedPasswordsList.length, numSavedPasswords - 1);
|
| + chrome.test.succeed();
|
| + } else {
|
| + chrome.test.fail();
|
| + }
|
| + };
|
| +
|
| + chrome.passwordsPrivate.onSavedPasswordsListChanged.addListener(callback);
|
| + },
|
| +
|
| + function removePasswordException() {
|
| + var numCalls = 0;
|
| + var numPasswordExceptions;
|
| + var callback = function(passwordExceptionsList) {
|
| + numCalls++;
|
| +
|
| + if (numCalls == 1) {
|
| + numPasswordExceptions = passwordExceptionsList.length;
|
| + chrome.passwordsPrivate.removePasswordException(
|
| + passwordExceptionsList[0]);
|
| + } else if (numCalls == 2) {
|
| + chrome.test.assertEq(
|
| + passwordExceptionsList.length, numPasswordExceptions - 1);
|
| + chrome.test.succeed();
|
| + } else {
|
| + chrome.test.fail();
|
| + }
|
| + };
|
| +
|
| + chrome.passwordsPrivate.onPasswordExceptionsListChanged.addListener(
|
| + callback);
|
| + },
|
| +
|
| + function requestPlaintextPassword() {
|
| + var callback = function() {
|
| + // Ensure that the callback is invoked.
|
| + chrome.test.succeed();
|
| + };
|
| +
|
| + chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback);
|
| + chrome.passwordsPrivate.requestPlaintextPassword(
|
| + {originUrl: 'http://www.test.com', username: 'test@test.com'});
|
| + },
|
| +];
|
| +
|
| +var testToRun = window.location.search.substring(1);
|
| +chrome.test.runTests(availableTests.filter(function(op) {
|
| + return op.name == testToRun;
|
| +}));
|
|
|