OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This just tests the interface. It does not test for specific results, only | 5 // This just tests the interface. It does not test for specific results, only |
6 // that callbacks are correctly invoked, expected parameters are correct, | 6 // that callbacks are correctly invoked, expected parameters are correct, |
7 // and failures are detected. | 7 // and failures are detected. |
8 | 8 |
9 var availableTests = [ | 9 var availableTests = [ |
10 function canPasswordAccountBeManaged() { | |
11 var callback = function() { | |
12 // Ensure that the callback is invoked. | |
13 chrome.test.succeed(); | |
14 }; | |
15 | |
16 chrome.passwordsPrivate.canPasswordAccountBeManaged(callback); | |
17 }, | |
18 | |
19 function removeSavedPassword() { | 10 function removeSavedPassword() { |
20 var numCalls = 0; | 11 var numCalls = 0; |
21 var numSavedPasswords; | 12 var numSavedPasswords; |
22 var callback = function(savedPasswordsList) { | 13 var callback = function(savedPasswordsList) { |
23 numCalls++; | 14 numCalls++; |
24 | 15 |
25 if (numCalls == 1) { | 16 if (numCalls == 1) { |
26 numSavedPasswords = savedPasswordsList.length; | 17 numSavedPasswords = savedPasswordsList.length; |
27 chrome.passwordsPrivate.removeSavedPassword({ | 18 chrome.passwordsPrivate.removeSavedPassword({ |
28 originUrl: savedPasswordsList[0].loginPair.originUrl, | 19 originUrl: savedPasswordsList[0].loginPair.originUrl, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback); | 63 chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback); |
73 chrome.passwordsPrivate.requestPlaintextPassword( | 64 chrome.passwordsPrivate.requestPlaintextPassword( |
74 {originUrl: 'http://www.test.com', username: 'test@test.com'}); | 65 {originUrl: 'http://www.test.com', username: 'test@test.com'}); |
75 }, | 66 }, |
76 ]; | 67 ]; |
77 | 68 |
78 var testToRun = window.location.search.substring(1); | 69 var testToRun = window.location.search.substring(1); |
79 chrome.test.runTests(availableTests.filter(function(op) { | 70 chrome.test.runTests(availableTests.filter(function(op) { |
80 return op.name == testToRun; | 71 return op.name == testToRun; |
81 })); | 72 })); |
OLD | NEW |