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

Unified Diff: pkg/unittest/test_controller.js

Issue 11092015: Chrome extension to get console messages upon test failures. Unlike the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: pkg/unittest/test_controller.js
===================================================================
--- pkg/unittest/test_controller.js (revision 13424)
+++ pkg/unittest/test_controller.js (working copy)
@@ -17,8 +17,30 @@
var waitForDone = false;
+// _callback and getMessages are used to retrieve console messages
+// from the Chrome ConsoleCollector extension. run_selenium.py can
+// call getMessages with execute_async_script, and when the messages
+// are returned from the extension they can be returned via a callback
+// provided by Selenium. _callback is used to hold a reference to
+// that callback. The messages are returned from the extension via
+// a window.postMessage call with type property 'gotMessages'.
+var _callback;
+function getMessages(callback) {
+ _callback = callback;
+ window.postMessage("getMessages", "*");
+}
+
function processMessage(msg) {
- if (typeof msg != 'string') return;
+ if (typeof msg != 'string') {
+ if (msg.type == 'gotMessages') {
+ // Handle console messages from Chrome extension.
+ if (_callback) {
+ _callback(msg.messages);
+ _callback = null;
+ }
+ }
+ return;
+ }
if (msg == 'unittest-suite-done') {
if (testRunner) testRunner.notifyDone();
} else if (msg == 'unittest-suite-wait-for-done') {

Powered by Google App Engine
This is Rietveld 408576698