1 // Copyright 2014 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 var messages
= ['hey', 100, 25.0];
7 var messagesReceived
= 0;
9 window
.addEventListener('message', function(event
) {
10 if (event
.data
== messages
[messagesReceived
]) {
12 if (messagesReceived
== messages
.length
)
13 // Instruct the extension to call chrome.test.succeed().
14 plugin
.postMessage('succeed');
16 // Instruct the extension to call chrome.test.fail().
17 plugin
.postMessage('fail');
21 var plugin
= document
.getElementById('plugin');
22 function postNextMessage() {
23 plugin
.postMessage(messages
[messagesSent
]);
25 if (messagesSent
< messages
.length
)
26 setTimeout(postNextMessage
, 0);