Index: chrome/test/data/extensions/api_test/webstore_private/common.js |
diff --git a/chrome/test/data/extensions/api_test/webstore_private/common.js b/chrome/test/data/extensions/api_test/webstore_private/common.js |
index bc0805ab11188de71b7caca73589913e46e88fcd..1021877fc0b07b00dca55cc80524ef1d4da4e2f3 100644 |
--- a/chrome/test/data/extensions/api_test/webstore_private/common.js |
+++ b/chrome/test/data/extensions/api_test/webstore_private/common.js |
@@ -41,6 +41,7 @@ var img = null; |
function getIconData(callback) { |
if (cachedIcon) { |
callback(cachedIcon); |
+ return; |
} |
var canvas = document.createElement("canvas"); |
canvas.style.display = "none"; |
@@ -69,3 +70,27 @@ function getManifest(alternativePath) { |
xhr.send(null); |
return xhr.responseText; |
} |
+ |
+// Installs the extension with the given |installOptions|, calls |
+// |whileInstalled| and then uninstalls the extension. |
+function installAndCleanUp(installOptions, whileInstalled) { |
+ // Begin installing. |
+ chrome.webstorePrivate.beginInstallWithManifest3( |
+ installOptions, |
+ callbackPass(function(result) { |
+ assertNoLastError(); |
+ assertEq("", result); |
+ |
+ // Now complete the installation. |
+ chrome.webstorePrivate.completeInstall( |
+ extensionId, |
+ callbackPass(function(result) { |
+ assertNoLastError(); |
+ assertEq(undefined, result); |
+ |
+ whileInstalled(); |
+ |
+ chrome.management.uninstall(extensionId, {}, callbackPass()); |
+ })); |
+ })); |
+} |