OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 var messages = []; |
| 6 |
| 7 function messageReceived(data) { |
| 8 messages.push(data); |
| 9 } |
| 10 |
| 11 function evaluateMessages() { |
| 12 if (messages.length != 3) |
| 13 chrome.test.notifyFail("Got " + messages.length + " messages instead of 3"); |
| 14 else if (messages[0] != "no restriction" || |
| 15 messages[1] != "http://a.com/" || |
| 16 messages[2] != "last message") |
| 17 chrome.test.notifyFail("Got wrong messages: " + messages[0] + ", " + |
| 18 messages[1] + ", " + messages[2]); |
| 19 else |
| 20 chrome.test.notifyPass(); |
| 21 } |
| 22 |
| 23 |
| 24 chrome.test.onMessage.addListener(function (info) { |
| 25 messageReceived(info.data); |
| 26 if (info.lastMessage) |
| 27 evaluateMessages(); |
| 28 }); |
OLD | NEW |