OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 onload = function() { |
| 6 chrome.test.runTests([ |
| 7 function browserTag() { |
| 8 var browserTag = document.querySelector('browser'); |
| 9 // Since we can't currently inspect the page loaded inside the <browser>, |
| 10 // the only way we can check that the shim is working is by changing the |
| 11 // size and seeing if the shim updates the size of the DOM. |
| 12 chrome.test.assertEq(300, browserTag.offsetWidth); |
| 13 chrome.test.assertEq(200, browserTag.offsetHeight); |
| 14 |
| 15 browserTag.setAttribute('width', 310); |
| 16 browserTag.setAttribute('height', 210); |
| 17 |
| 18 // Timeout is necessary to give the mutation observers a chance to fire. |
| 19 setTimeout(function() { |
| 20 chrome.test.assertEq(310, browserTag.offsetWidth); |
| 21 chrome.test.assertEq(210, browserTag.offsetHeight); |
| 22 |
| 23 // Should also be able to query/update the dimensions via getterts/ |
| 24 // setters. |
| 25 chrome.test.assertEq(310, browserTag.width); |
| 26 chrome.test.assertEq(210, browserTag.height); |
| 27 |
| 28 browserTag.width = 320; |
| 29 browserTag.height = 220; |
| 30 |
| 31 // Setters also end up operating via mutation observers. |
| 32 setTimeout(function() { |
| 33 chrome.test.assertEq(320, browserTag.offsetWidth); |
| 34 chrome.test.assertEq(220, browserTag.offsetHeight); |
| 35 |
| 36 chrome.test.succeed(); |
| 37 }, 0); |
| 38 }, 0); |
| 39 } |
| 40 ]); |
| 41 }; |
OLD | NEW |