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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 function testAutosizeBeforeNavigation() { | 171 function testAutosizeBeforeNavigation() { |
172 var webview = document.createElement('webview'); | 172 var webview = document.createElement('webview'); |
173 | 173 |
174 webview.setAttribute('autosize', 'true'); | 174 webview.setAttribute('autosize', 'true'); |
175 webview.setAttribute('minwidth', 200); | 175 webview.setAttribute('minwidth', 200); |
176 webview.setAttribute('maxwidth', 210); | 176 webview.setAttribute('maxwidth', 210); |
177 webview.setAttribute('minheight', 100); | 177 webview.setAttribute('minheight', 100); |
178 webview.setAttribute('maxheight', 110); | 178 webview.setAttribute('maxheight', 110); |
179 | 179 |
180 webview.addEventListener('sizechanged', function(e) { | 180 webview.addEventListener('sizechanged', function(e) { |
181 embedder.test.assertEq(0, e.oldWidth); | 181 // The old size should be the default size of the webview, which at the time |
182 embedder.test.assertEq(0, e.oldHeight); | 182 // of writing this comment is 300 x 300, but is not important to this test |
| 183 // and could change in the future, so it is not checked here. |
183 embedder.test.assertTrue(e.newWidth >= 200 && e.newWidth <= 210); | 184 embedder.test.assertTrue(e.newWidth >= 200 && e.newWidth <= 210); |
184 embedder.test.assertTrue(e.newHeight >= 100 && e.newHeight <= 110); | 185 embedder.test.assertTrue(e.newHeight >= 100 && e.newHeight <= 110); |
185 embedder.test.succeed(); | 186 embedder.test.succeed(); |
186 }); | 187 }); |
187 | 188 |
188 webview.setAttribute('src', 'data:text/html,webview test sizechanged event'); | 189 webview.setAttribute('src', 'data:text/html,webview test sizechanged event'); |
189 document.body.appendChild(webview); | 190 document.body.appendChild(webview); |
190 } | 191 } |
191 | 192 |
192 // Makes sure 'sizechanged' event is fired only if autosize attribute is | 193 // Makes sure 'sizechanged' event is fired only if autosize attribute is |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 'testFindAPI_findupdate': testFindAPI, | 2134 'testFindAPI_findupdate': testFindAPI, |
2134 'testLoadDataAPI': testLoadDataAPI | 2135 'testLoadDataAPI': testLoadDataAPI |
2135 }; | 2136 }; |
2136 | 2137 |
2137 onload = function() { | 2138 onload = function() { |
2138 chrome.test.getConfig(function(config) { | 2139 chrome.test.getConfig(function(config) { |
2139 embedder.setUp_(config); | 2140 embedder.setUp_(config); |
2140 chrome.test.sendMessage("Launched"); | 2141 chrome.test.sendMessage("Launched"); |
2141 }); | 2142 }); |
2142 }; | 2143 }; |
OLD | NEW |