Chromium Code Reviews| 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 removeSavedPassword() { | 10 function removeSavedPassword() { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 function removePasswordException() { | 35 function removePasswordException() { |
| 36 var numCalls = 0; | 36 var numCalls = 0; |
| 37 var numPasswordExceptions; | 37 var numPasswordExceptions; |
| 38 var callback = function(passwordExceptionsList) { | 38 var callback = function(passwordExceptionsList) { |
| 39 numCalls++; | 39 numCalls++; |
| 40 | 40 |
| 41 if (numCalls == 1) { | 41 if (numCalls == 1) { |
| 42 numPasswordExceptions = passwordExceptionsList.length; | 42 numPasswordExceptions = passwordExceptionsList.length; |
| 43 chrome.passwordsPrivate.removePasswordException( | 43 chrome.passwordsPrivate.removePasswordException( |
| 44 passwordExceptionsList[0]); | 44 passwordExceptionsList[0].exceptionUrl); |
| 45 } else if (numCalls == 2) { | 45 } else if (numCalls == 2) { |
| 46 chrome.test.assertEq( | 46 chrome.test.assertEq( |
| 47 passwordExceptionsList.length, numPasswordExceptions - 1); | 47 passwordExceptionsList.length, numPasswordExceptions - 1); |
| 48 chrome.test.succeed(); | 48 chrome.test.succeed(); |
| 49 } else { | 49 } else { |
| 50 chrome.test.fail(); | 50 chrome.test.fail(); |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 chrome.passwordsPrivate.onPasswordExceptionsListChanged.addListener( | 54 chrome.passwordsPrivate.onPasswordExceptionsListChanged.addListener( |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 72 chrome.test.assertTrue(!!list); | 72 chrome.test.assertTrue(!!list); |
| 73 // Ensure that the callback is invoked. | 73 // Ensure that the callback is invoked. |
| 74 chrome.test.succeed(); | 74 chrome.test.succeed(); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 chrome.passwordsPrivate.getSavedPasswordList(callback); | 77 chrome.passwordsPrivate.getSavedPasswordList(callback); |
| 78 }, | 78 }, |
| 79 | 79 |
| 80 function getPasswordExceptionList() { | 80 function getPasswordExceptionList() { |
| 81 var callback = function(list) { | 81 var callback = function(list) { |
| 82 chrome.test.assertTrue(!!list); | 82 chrome.test.assertTrue(!!list); |
|
stevenjb
2016/04/22 16:11:20
Ideally we should populate the list in the test/fa
hcarmona
2016/04/23 01:46:08
Done-ish. I've validated that the list has more th
| |
| 83 // Ensure that the callback is invoked. | 83 // Ensure that the callback is invoked. |
| 84 chrome.test.succeed(); | 84 chrome.test.succeed(); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 chrome.passwordsPrivate.getPasswordExceptionList(callback); | 87 chrome.passwordsPrivate.getPasswordExceptionList(callback); |
| 88 }, | 88 }, |
| 89 ]; | 89 ]; |
| 90 | 90 |
| 91 var testToRun = window.location.search.substring(1); | 91 var testToRun = window.location.search.substring(1); |
| 92 chrome.test.runTests(availableTests.filter(function(op) { | 92 chrome.test.runTests(availableTests.filter(function(op) { |
| 93 return op.name == testToRun; | 93 return op.name == testToRun; |
| 94 })); | 94 })); |
| OLD | NEW |