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 LOG = function(msg) {
6 window.console.log(msg);
9 var failTest = function() {
10 chrome.test.sendMessage('WebViewTest.FAILURE');
13 var waitingForLoadstop = false;
15 var startTest = function() {
16 var webview = document.createElement('webview');
17 webview.style.display = 'none';
18 document.body.appendChild(webview);
20 var onLoadstop = function(e) {
21 if (waitingForLoadstop) {
22 chrome.test.sendMessage('WebViewTest.PASSED');
25 webview.addEventListener('loadstop', onLoadstop);
27 chrome.test.sendMessage('LAUNCHED');
30 window.onAppCommand = function(command) {
31 LOG('onAppCommand: ' + command);
33 case 'navigate-guest':
34 window.console.log('navigate-guest command');
35 document.querySelector('webview').src =
36 'data:text/html,<body>Guest</body>';
39 waitingForLoadstop = true;
40 document.querySelector('webview').style.display = '';
43 document.querySelector('webview').style.display = 'none';
51 window.onload = startTest;