| OLD | NEW |
| 1 <script> | 1 <!-- |
| 2 var messages = []; | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
| 3 | 3 * source code is governed by a BSD-style license that can be found in the |
| 4 function messageReceived(data) { | 4 * LICENSE file. |
| 5 messages.push(data); | 5 --> |
| 6 } | 6 <script src="test.js"></script> |
| 7 | |
| 8 function evaluateMessages() { | |
| 9 if (messages.length != 3) | |
| 10 chrome.test.notifyFail("Got " + messages.length + " messages instead of 3"); | |
| 11 else if (messages[0] != "no restriction" || | |
| 12 messages[1] != "http://a.com/" || | |
| 13 messages[2] != "last message") | |
| 14 chrome.test.notifyFail("Got wrong messages: " + messages[0] + ", " + | |
| 15 messages[1] + ", " + messages[2]); | |
| 16 else | |
| 17 chrome.test.notifyPass(); | |
| 18 } | |
| 19 | |
| 20 | |
| 21 chrome.test.onMessage.addListener(function (info) { | |
| 22 messageReceived(info.data); | |
| 23 if (info.lastMessage) | |
| 24 evaluateMessages(); | |
| 25 }); | |
| 26 </script> | |
| OLD | NEW |