summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-14 21:42:57 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-14 21:42:57 +0000
commit51a9ec43d16c0c7decd9ae286ca15359a709a4af (patch)
treea24af3f3067a2a67ca6649ecc531a35ba9b6042c /chrome/renderer
parent46dd2f69b4df18364e8a5fc22a63a8e1ec3f5419 (diff)
downloadchromium_src-51a9ec43d16c0c7decd9ae286ca15359a709a4af.zip
chromium_src-51a9ec43d16c0c7decd9ae286ca15359a709a4af.tar.gz
chromium_src-51a9ec43d16c0c7decd9ae286ca15359a709a4af.tar.bz2
Refactor browser action apitest and port for mac.
BUG=29709 TEST=none Review URL: http://codereview.chromium.org/443013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34498 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/resources/extension_apitest.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/chrome/renderer/resources/extension_apitest.js b/chrome/renderer/resources/extension_apitest.js
index e9d92b5..de3b150 100644
--- a/chrome/renderer/resources/extension_apitest.js
+++ b/chrome/renderer/resources/extension_apitest.js
@@ -23,13 +23,15 @@ var chrome = chrome || {};
if (completed) throw "completed";
chrome.test.log("( FAILED ) " + currentTest.name);
- var stack;
+ var stack = "(no stack available)";
try {
crash.me += 0; // An intentional exception to get the stack trace.
} catch (e) {
- stack = e.stack.split("\n");
- stack = stack.slice(2); // Remove title and fail() lines.
- stack = stack.join("\n");
+ if (typeof(e.stack) != undefined) {
+ stack = e.stack.split("\n");
+ stack = stack.slice(2); // Remove title and fail() lines.
+ stack = stack.join("\n");
+ }
}
if (!message) {
@@ -48,7 +50,7 @@ var chrome = chrome || {};
chrome.test.notifyPass();
complete();
}
-
+
var pendingCallbacks = 0;
chrome.test.callbackAdded = function () {
@@ -74,7 +76,7 @@ var chrome = chrome || {};
chrome.test.log("( RUN ) " + currentTest.name);
currentTest.call();
} catch (e) {
- var message = e.stack;
+ var message = e.stack || "(no stack available)";
console.log("[FAIL] " + currentTest.name + ": " + message);
chrome.test.notifyFail(message);
complete();
@@ -127,18 +129,16 @@ var chrome = chrome || {};
func.apply(null, arguments);
}
} catch (e) {
- var stack = null;
+ var stack = "(no stack available)";
if (typeof(e.stack) != "undefined") {
stack = e.stack.toString();
}
var msg = "Exception during execution of callback in " +
currentTest.name;
- if (stack) {
- msg += "\n" + stack;
- } else {
- msg += "\n(no stack available)";
- }
- chrome.test.fail(msg);
+ msg += "\n" + stack;
+ console.log("[FAIL] " + currentTest.name + ": " + msg);
+ chrome.test.notifyFail(msg);
+ complete();
}
};
@@ -157,7 +157,7 @@ var chrome = chrome || {};
chrome.test.assertEq(typeof(expectedError), 'string');
chrome.test.assertEq(expectedError, chrome.extension.lastError.message);
}
-
+
if (func) {
safeFunctionApply(func, arguments);
}
@@ -175,10 +175,10 @@ var chrome = chrome || {};
};
event.addListener(listener);
};
-
+
chrome.test.listenForever = function(event, func) {
var callbackCompleted = chrome.test.callbackAdded();
-
+
var listener = function() {
safeFunctionApply(func, arguments);
};
@@ -187,7 +187,7 @@ var chrome = chrome || {};
event.removeListener(listener);
callbackCompleted();
};
-
+
event.addListener(listener);
return done;
};