OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // out/Debug/browser_tests --gtest_filter=ExtensionWebUITest.SendMessage | 5 // out/Debug/browser_tests --gtest_filter=ExtensionWebUITest.SendMessage |
6 | 6 |
| 7 if (!chrome || !chrome.test || !chrome.test.sendMessage) { |
| 8 console.error('chrome.test.sendMessage is unavailable on ' + |
| 9 document.location.href); |
| 10 domAutomationController.send(false); |
| 11 return; |
| 12 } |
| 13 |
7 chrome.test.sendMessage('ping', function(reply) { | 14 chrome.test.sendMessage('ping', function(reply) { |
8 if (reply != 'pong') { | 15 if (reply != 'pong') { |
9 console.error('Expected "pong", Actual ' + JSON.stringify(reply)); | 16 console.error('Expected "pong", Actual ' + JSON.stringify(reply)); |
10 chrome.test.sendMessage('false'); | 17 chrome.test.sendMessage('false'); |
11 } else { | 18 } else { |
12 chrome.test.sendMessage('true'); | 19 chrome.test.sendMessage('true'); |
13 } | 20 } |
14 }); | 21 }); |
15 | 22 |
16 domAutomationController.send(true); | 23 domAutomationController.send(true); |
OLD | NEW |