1 // Copyright 2013 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.
6 var webview = document.querySelector('webview');
7 // Since we can't currently inspect the page loaded inside the <webview>,
8 // the only way we can check that the shim is working is by changing the
9 // size and seeing if the shim updates the size of the DOM.
10 chrome.test.assertEq(300, webview.offsetWidth);
11 chrome.test.assertEq(200, webview.offsetHeight);
13 webview.style.width = '310px';
14 webview.style.height = '210px';
16 chrome.test.assertEq(310, webview.offsetWidth);
17 chrome.test.assertEq(210, webview.offsetHeight);
19 webview.style.width = '320px';
20 webview.style.height = '220px';
22 chrome.test.assertEq(320, webview.offsetWidth);
23 chrome.test.assertEq(220, webview.offsetHeight);
25 var dynamicWebViewTag = document.createElement('webview');
26 dynamicWebViewTag.setAttribute('src', 'data:text/html,dynamic browser');
27 dynamicWebViewTag.style.width = '330px';
28 dynamicWebViewTag.style.height = '230px';
29 document.body.appendChild(dynamicWebViewTag);
31 // Timeout is necessary to give the mutation observers a chance to fire.
32 setTimeout(function() {
33 chrome.test.assertEq(330, dynamicWebViewTag.offsetWidth);
34 chrome.test.assertEq(230, dynamicWebViewTag.offsetHeight);
36 chrome.test.succeed();
41 chrome.test.runTests([testSize]);