diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 20:13:21 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 20:13:21 +0000 |
commit | b7c2041e034432303469669390ac2f456ca6c751 (patch) | |
tree | 426e60e1ead3dded756f8d7ef170f5f2f1fbe915 /chrome/renderer/resources | |
parent | 6445c40fe17dd1d89833ced8495f84d56119221a (diff) | |
download | chromium_src-b7c2041e034432303469669390ac2f456ca6c751.zip chromium_src-b7c2041e034432303469669390ac2f456ca6c751.tar.gz chromium_src-b7c2041e034432303469669390ac2f456ca6c751.tar.bz2 |
Update ExtensionApiTest.Tabs and re-enable
BUG=20828
Review URL: http://codereview.chromium.org/199091
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26002 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources')
-rw-r--r-- | chrome/renderer/resources/extension_apitest.js | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/chrome/renderer/resources/extension_apitest.js b/chrome/renderer/resources/extension_apitest.js index 7b2d583..90cc055 100644 --- a/chrome/renderer/resources/extension_apitest.js +++ b/chrome/renderer/resources/extension_apitest.js @@ -50,20 +50,14 @@ var chrome = chrome || {}; } var pendingCallbacks = 0; - var totalCallbacks = 0; - + function callbackAdded() { pendingCallbacks++; - chrome.test.assertEq(totalCallbacks, 0); }; - + function callbackCompleted() { - if (!totalCallbacks) - totalCallbacks = pendingCallbacks; pendingCallbacks--; if (pendingCallbacks == 0) { - //chrome.test.log(" " + totalCallbacks + " callbacks ran"); - totalCallbacks = 0; chrome.test.succeed(); } }; @@ -126,7 +120,7 @@ var chrome = chrome || {}; chrome.extension.lastError.message); } }; - + function safeFunctionApply(func, arguments) { try { if (func) { @@ -154,7 +148,6 @@ var chrome = chrome || {}; if (func) { chrome.test.assertEq(typeof(func), 'function'); } - callbackAdded(); return function() { @@ -172,17 +165,34 @@ var chrome = chrome || {}; callbackCompleted(); }; }; - + chrome.test.listenOnce = function(event, func) { callbackAdded(); var listener = function() { event.removeListener(listener); - safeFunctionApply(func, arguments); + safeFunctionApply(func, arguments); callbackCompleted(); }; event.addListener(listener); }; + chrome.test.listenForever = function(event, func) { + callbackAdded(); + + var listener = function() { + safeFunctionApply(func, arguments); + }; + + var done = {}; + done.doneListening = function() { + event.removeListener(listener); + callbackCompleted(); + }; + + event.addListener(listener); + return done; + }; + chrome.test.callbackPass = function(func) { return chrome.test.callback(func); }; @@ -191,14 +201,8 @@ var chrome = chrome || {}; return chrome.test.callback(null, expectedError); }; - // TODO(erikkay) This is deprecated and should be removed. - chrome.test.testCallback = function(succeedWhenDone, func) { - return chrome.test.callback(func); - }; - chrome.test.runTests = function(tests) { chrome.test.tests = tests; chrome.test.runNextTest(); }; - })(); |