OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 onload = function() { | 5 onload = function() { |
6 chrome.test.runTests([ | 6 chrome.test.runTests([ |
7 function browserTag() { | 7 function browserTag() { |
8 var browserTag = document.querySelector('browser'); | 8 var browserTag = document.querySelector('browser'); |
9 // Since we can't currently inspect the page loaded inside the <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 | 10 // the only way we can check that the shim is working is by changing the |
(...skipping 30 matching lines...) Expand all Loading... |
41 document.body.appendChild(dynamicBrowserTag); | 41 document.body.appendChild(dynamicBrowserTag); |
42 | 42 |
43 setTimeout(function() { | 43 setTimeout(function() { |
44 chrome.test.assertEq(330, dynamicBrowserTag.offsetWidth); | 44 chrome.test.assertEq(330, dynamicBrowserTag.offsetWidth); |
45 chrome.test.assertEq(230, dynamicBrowserTag.offsetHeight); | 45 chrome.test.assertEq(230, dynamicBrowserTag.offsetHeight); |
46 | 46 |
47 chrome.test.succeed(); | 47 chrome.test.succeed(); |
48 }, 0); | 48 }, 0); |
49 }, 0); | 49 }, 0); |
50 }, 0); | 50 }, 0); |
| 51 }, |
| 52 |
| 53 function browserTagApiMethodExistence() { |
| 54 var browserTag = document.createElement('browser'); |
| 55 browserTag.setAttribute('src', 'data:text/html,browser tag check api'); |
| 56 var apiMethodsToCheck = [ |
| 57 'addEventListener', |
| 58 'back', |
| 59 'forward', |
| 60 'getProcessId', |
| 61 'go', |
| 62 'reload', |
| 63 'removeEventListener', |
| 64 'stop', |
| 65 'terminate' |
| 66 ]; |
| 67 document.body.appendChild(browserTag); |
| 68 |
| 69 // Timeout is necessary to give the mutation observers a chance to fire. |
| 70 setTimeout(function() { |
| 71 for (var i = 0; i < apiMethodsToCheck.length; ++i) { |
| 72 chrome.test.assertEq('function', |
| 73 typeof browserTag[apiMethodsToCheck[i]]); |
| 74 } |
| 75 chrome.test.succeed(); |
| 76 }, 0); |
51 } | 77 } |
52 ]); | 78 ]); |
53 }; | 79 }; |
OLD | NEW |