| 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 var LOG = function(msg) { | 5 var LOG = function(msg) { |
| 6 window.console.log(msg); | 6 window.console.log(msg); |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 var failTest = function() { | 9 var failTest = function() { |
| 10 chrome.test.sendMessage('WebViewTest.FAILURE'); | 10 chrome.test.sendMessage('WebViewTest.FAILURE'); |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 var startTest = function() { | 13 var startTest = function() { |
| 14 document.querySelector('#webview-tag-container').innerHTML = | 14 document.querySelector('#webview-tag-container').innerHTML = |
| 15 '<webview style="width: 10px; height: 10px; margin: 0; padding: 0;"' + | 15 '<webview style="width: 10px; height: 10px; margin: 0; padding: 0;"' + |
| 16 '></webview>'; | 16 '></webview>'; |
| 17 | 17 |
| 18 var webview = document.querySelector('webview'); | 18 var webview = document.querySelector('webview'); |
| 19 var onLoadStop = function(e) { | 19 var onLoadStop = function(e) { |
| 20 chrome.test.sendMessage('WebViewTest.LAUNCHED'); | 20 chrome.test.sendMessage('LAUNCHED'); |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 webview.addEventListener('loadstop', onLoadStop); | 23 webview.addEventListener('loadstop', onLoadStop); |
| 24 webview.src = 'data:text/html,<body>Guest</body>'; | 24 webview.src = 'data:text/html,<body>Guest</body>'; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 window.onAppCommand = function(command) { | 27 window.onAppCommand = function(command) { |
| 28 LOG('onAppCommand: ' + command); | 28 LOG('onAppCommand: ' + command); |
| 29 switch (command) { | 29 switch (command) { |
| 30 case 'hide-guest': | 30 case 'hide-guest': |
| 31 document.querySelector('webview').style.display = 'none'; | 31 document.querySelector('webview').style.display = 'none'; |
| 32 break; | 32 break; |
| 33 case 'hide-embedder': | 33 case 'hide-embedder': |
| 34 document.body.style.display = 'none'; | 34 document.body.style.display = 'none'; |
| 35 break; | 35 break; |
| 36 default: | 36 default: |
| 37 failTest(); | 37 failTest(); |
| 38 break; | 38 break; |
| 39 } | 39 } |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 window.onload = startTest; | 42 window.onload = startTest; |
| OLD | NEW |