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

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

Issue 1894773002: Remove implicit update when adding a listener in passwords private API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicit-password-api-update.gitbr
Patch Set: feedback Created 4 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
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 removeSavedPassword() { 10 function removeSavedPassword() {
(...skipping 11 matching lines...) Expand all
22 } else if (numCalls == 2) { 22 } else if (numCalls == 2) {
23 chrome.test.assertEq( 23 chrome.test.assertEq(
24 savedPasswordsList.length, numSavedPasswords - 1); 24 savedPasswordsList.length, numSavedPasswords - 1);
25 chrome.test.succeed(); 25 chrome.test.succeed();
26 } else { 26 } else {
27 chrome.test.fail(); 27 chrome.test.fail();
28 } 28 }
29 }; 29 };
30 30
31 chrome.passwordsPrivate.onSavedPasswordsListChanged.addListener(callback); 31 chrome.passwordsPrivate.onSavedPasswordsListChanged.addListener(callback);
32 chrome.passwordsPrivate.getSavedPasswordList(callback);
32 }, 33 },
33 34
34 function removePasswordException() { 35 function removePasswordException() {
35 var numCalls = 0; 36 var numCalls = 0;
36 var numPasswordExceptions; 37 var numPasswordExceptions;
37 var callback = function(passwordExceptionsList) { 38 var callback = function(passwordExceptionsList) {
38 numCalls++; 39 numCalls++;
39 40
40 if (numCalls == 1) { 41 if (numCalls == 1) {
41 numPasswordExceptions = passwordExceptionsList.length; 42 numPasswordExceptions = passwordExceptionsList.length;
42 chrome.passwordsPrivate.removePasswordException( 43 chrome.passwordsPrivate.removePasswordException(
43 passwordExceptionsList[0]); 44 passwordExceptionsList[0]);
44 } else if (numCalls == 2) { 45 } else if (numCalls == 2) {
45 chrome.test.assertEq( 46 chrome.test.assertEq(
46 passwordExceptionsList.length, numPasswordExceptions - 1); 47 passwordExceptionsList.length, numPasswordExceptions - 1);
47 chrome.test.succeed(); 48 chrome.test.succeed();
48 } else { 49 } else {
49 chrome.test.fail(); 50 chrome.test.fail();
50 } 51 }
51 }; 52 };
52 53
53 chrome.passwordsPrivate.onPasswordExceptionsListChanged.addListener( 54 chrome.passwordsPrivate.onPasswordExceptionsListChanged.addListener(
54 callback); 55 callback);
56 chrome.passwordsPrivate.getPasswordExceptionList(callback);
55 }, 57 },
56 58
57 function requestPlaintextPassword() { 59 function requestPlaintextPassword() {
58 var callback = function() { 60 var callback = function() {
59 // Ensure that the callback is invoked. 61 // Ensure that the callback is invoked.
60 chrome.test.succeed(); 62 chrome.test.succeed();
61 }; 63 };
62 64
63 chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback); 65 chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback);
64 chrome.passwordsPrivate.requestPlaintextPassword( 66 chrome.passwordsPrivate.requestPlaintextPassword(
(...skipping 18 matching lines...) Expand all
83 }; 85 };
84 86
85 chrome.passwordsPrivate.getPasswordExceptionList(callback); 87 chrome.passwordsPrivate.getPasswordExceptionList(callback);
86 }, 88 },
87 ]; 89 ];
88 90
89 var testToRun = window.location.search.substring(1); 91 var testToRun = window.location.search.substring(1);
90 chrome.test.runTests(availableTests.filter(function(op) { 92 chrome.test.runTests(availableTests.filter(function(op) {
91 return op.name == testToRun; 93 return op.name == testToRun;
92 })); 94 }));
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/passwords_private.idl ('k') | third_party/closure_compiler/externs/passwords_private.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698