1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 chrome.devtools.inspectedWindow.eval("console.log(unescape('" +
10 var hadErrors = false;
12 function assertEquals(expected, actual) {
13 if (expected === actual)
15 output("FAIL: expected '" + expected + "', got '" + actual + "'");
17 throw "assertion failed";
20 function completeTest() {
26 chrome.extension.sendRequest("foo", function(response) {
27 assertEquals('onRequest callback: "foo"', response);
33 var object = { "string": "foo", "number": 42 };
34 chrome.extension.sendRequest(object, function(response) {
35 assertEquals('onRequest callback: ' + JSON.stringify(object), response);
41 function onMessage(message) {
42 assertEquals("port.onMessage: foo", message);
45 var port = chrome.runtime.connect();
46 port.onMessage.addListener(onMessage);
47 port.postMessage("foo");