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 var util = {}; | 5 var util = {}; |
6 var embedder = {}; | 6 var embedder = {}; |
7 embedder.baseGuestURL = ''; | 7 embedder.baseGuestURL = ''; |
8 embedder.emptyGuestURL = ''; | 8 embedder.emptyGuestURL = ''; |
9 embedder.windowOpenGuestURL = ''; | 9 embedder.windowOpenGuestURL = ''; |
10 embedder.noReferrerGuestURL = ''; | 10 embedder.noReferrerGuestURL = ''; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 embedder.test.assertFalse = function(condition) { | 87 embedder.test.assertFalse = function(condition) { |
88 if (condition) { | 88 if (condition) { |
89 console.log('assertion failed: false != ' + condition); | 89 console.log('assertion failed: false != ' + condition); |
90 embedder.test.fail(); | 90 embedder.test.fail(); |
91 } | 91 } |
92 }; | 92 }; |
93 | 93 |
94 // Tests begin. | 94 // Tests begin. |
95 | 95 |
| 96 // This test verifies that the allowtransparency property cannot be changed |
| 97 // once set. The attribute can only be deleted. |
| 98 function testAllowTransparencyAttribute() { |
| 99 var webview = document.createElement('webview'); |
| 100 webview.src = 'data:text/html,webview test'; |
| 101 webview.allowtransparency = true; |
| 102 |
| 103 webview.addEventListener('loadstop', function(e) { |
| 104 embedder.test.assertTrue(webview.hasAttribute('allowtransparency')); |
| 105 webview.allowtransparency = false; |
| 106 embedder.test.assertTrue(webview.allowtransparency); |
| 107 embedder.test.assertTrue(webview.hasAttribute('allowtransparency')); |
| 108 webview.removeAttribute('allowtransparency'); |
| 109 embedder.test.assertFalse(webview.allowtransparency); |
| 110 embedder.test.succeed(); |
| 111 }); |
| 112 |
| 113 document.body.appendChild(webview); |
| 114 } |
| 115 |
96 // This test verifies that a lengthy page with autosize enabled will report | 116 // This test verifies that a lengthy page with autosize enabled will report |
97 // the correct height in the sizechanged event. | 117 // the correct height in the sizechanged event. |
98 function testAutosizeHeight() { | 118 function testAutosizeHeight() { |
99 var webview = document.createElement('webview'); | 119 var webview = document.createElement('webview'); |
100 | 120 |
101 webview.autosize = true; | 121 webview.autosize = true; |
102 webview.minwidth = 200; | 122 webview.minwidth = 200; |
103 webview.maxwidth = 210; | 123 webview.maxwidth = 210; |
104 webview.minheight = 40; | 124 webview.minheight = 40; |
105 webview.maxheight = 200; | 125 webview.maxheight = 200; |
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1801 }); | 1821 }); |
1802 wv.find("dog"); | 1822 wv.find("dog"); |
1803 wv.find("cat"); | 1823 wv.find("cat"); |
1804 wv.find("dog"); | 1824 wv.find("dog"); |
1805 }); | 1825 }); |
1806 | 1826 |
1807 document.body.appendChild(webview); | 1827 document.body.appendChild(webview); |
1808 }; | 1828 }; |
1809 | 1829 |
1810 embedder.test.testList = { | 1830 embedder.test.testList = { |
| 1831 'testAllowTransparencyAttribute': testAllowTransparencyAttribute, |
1811 'testAutosizeHeight': testAutosizeHeight, | 1832 'testAutosizeHeight': testAutosizeHeight, |
1812 'testAutosizeAfterNavigation': testAutosizeAfterNavigation, | 1833 'testAutosizeAfterNavigation': testAutosizeAfterNavigation, |
1813 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation, | 1834 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation, |
1814 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, | 1835 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, |
1815 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, | 1836 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, |
1816 'testAPIMethodExistence': testAPIMethodExistence, | 1837 'testAPIMethodExistence': testAPIMethodExistence, |
1817 'testChromeExtensionURL': testChromeExtensionURL, | 1838 'testChromeExtensionURL': testChromeExtensionURL, |
1818 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, | 1839 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, |
1819 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, | 1840 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, |
1820 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, | 1841 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 'testFindAPI': testFindAPI, | 1899 'testFindAPI': testFindAPI, |
1879 'testFindAPI_findupdate': testFindAPI | 1900 'testFindAPI_findupdate': testFindAPI |
1880 }; | 1901 }; |
1881 | 1902 |
1882 onload = function() { | 1903 onload = function() { |
1883 chrome.test.getConfig(function(config) { | 1904 chrome.test.getConfig(function(config) { |
1884 embedder.setUp_(config); | 1905 embedder.setUp_(config); |
1885 chrome.test.sendMessage("Launched"); | 1906 chrome.test.sendMessage("Launched"); |
1886 }); | 1907 }); |
1887 }; | 1908 }; |
OLD | NEW |