1 // Copyright 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.
5 // This test checks the page loaded inside an <adview> has the ability to
6 // 1) receive "message" events from the application, and 2) use
7 // "window.postMessage" to post back a message to the application.
9 function runTests(guestURL) {
10 chrome.test.runTests([
12 var adview = document.getElementsByTagName("adview")[0];
14 adview.addEventListener("loadcommit", function() {
15 adview.contentWindow.postMessage({
16 message: "onloadcommit",
21 window.addEventListener("message", function(event) {
22 if (event.data.message == "onloadcommit-ack") {
23 console.log("onloadcommit-ack message received.");
24 chrome.test.succeed();
28 adview.setAttribute("src", guestURL);
33 window.onload = function() {
34 chrome.test.getConfig(function(config) {
35 var guestURL = 'http://localhost:' + config.testServer.port +
36 '/extensions/platform_apps/ad_view/ad_network_site/testsdk.html';