Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/test/data/extensions/platform_apps/web_view/main.js

Issue 11231086: Remove width and height property from <webview> tag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments + Sync <browser> to <webview> renaming. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 webView() { 7 function webView() {
8 var webview = document.querySelector('webview'); 8 var webview = document.querySelector('webview');
9 // Since we can't currently inspect the page loaded inside the <webview>, 9 // Since we can't currently inspect the page loaded inside the <webview>,
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
11 // size and seeing if the shim updates the size of the DOM. 11 // size and seeing if the shim updates the size of the DOM.
12 chrome.test.assertEq(300, webview.offsetWidth); 12 chrome.test.assertEq(300, webview.offsetWidth);
13 chrome.test.assertEq(200, webview.offsetHeight); 13 chrome.test.assertEq(200, webview.offsetHeight);
14 14
15 webview.setAttribute('width', 310); 15 webview.style.width = '310px';
16 webview.setAttribute('height', 210); 16 webview.style.height = '210px';
17
18 chrome.test.assertEq(310, webview.offsetWidth);
19 chrome.test.assertEq(210, webview.offsetHeight);
20
21 webview.style.width = '320px';
22 webview.style.height = '220px';
23
24 chrome.test.assertEq(320, webview.offsetWidth);
25 chrome.test.assertEq(220, webview.offsetHeight);
26
27 var dynamicWebViewTag = document.createElement('webview');
28 dynamicWebViewTag.setAttribute('src', 'data:text/html,dynamic browser');
29 dynamicWebViewTag.style.width = '330px';
30 dynamicWebViewTag.style.height = '230px';
31 document.body.appendChild(dynamicWebViewTag);
17 32
18 // Timeout is necessary to give the mutation observers a chance to fire. 33 // Timeout is necessary to give the mutation observers a chance to fire.
19 setTimeout(function() { 34 setTimeout(function() {
20 chrome.test.assertEq(310, webview.offsetWidth); 35 chrome.test.assertEq(330, dynamicWebViewTag.offsetWidth);
21 chrome.test.assertEq(210, webview.offsetHeight); 36 chrome.test.assertEq(230, dynamicWebViewTag.offsetHeight);
22 37
23 // Should also be able to query/update the dimensions via getterts/ 38 chrome.test.succeed();
24 // setters.
25 chrome.test.assertEq(310, webview.width);
26 chrome.test.assertEq(210, webview.height);
27
28 webview.width = 320;
29 webview.height = 220;
30
31 // Setters also end up operating via mutation observers.
32 setTimeout(function() {
33 chrome.test.assertEq(320, webview.offsetWidth);
34 chrome.test.assertEq(220, webview.offsetHeight);
35
36 var dynamicWebViewTag = document.createElement('webview');
37 dynamicWebViewTag.setAttribute(
38 'src', 'data:text/html,dynamic browser');
39 dynamicWebViewTag.setAttribute('width', '330');
40 dynamicWebViewTag.setAttribute('height', '230');
41 document.body.appendChild(dynamicWebViewTag);
42
43 setTimeout(function() {
44 chrome.test.assertEq(330, dynamicWebViewTag.offsetWidth);
45 chrome.test.assertEq(230, dynamicWebViewTag.offsetHeight);
46
47 chrome.test.succeed();
48 }, 0);
49 }, 0);
50 }, 0); 39 }, 0);
51 }, 40 },
52 41
53 function webViewApiMethodExistence() { 42 function webViewApiMethodExistence() {
54 var webview = document.createElement('webview'); 43 var webview = document.createElement('webview');
55 webview.setAttribute('src', 'data:text/html,webview check api'); 44 webview.setAttribute('src', 'data:text/html,webview check api');
56 var apiMethodsToCheck = [ 45 var apiMethodsToCheck = [
57 'addEventListener', 46 'addEventListener',
58 'back', 47 'back',
59 'canGoBack', 48 'canGoBack',
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 webview.addEventListener('exit', function(evt) { 126 webview.addEventListener('exit', function(evt) {
138 chrome.test.assertEq('exit', evt.name); 127 chrome.test.assertEq('exit', evt.name);
139 chrome.test.succeed(); 128 chrome.test.succeed();
140 }); 129 });
141 130
142 webview.setAttribute('src', 'data:text/html,trigger navigation'); 131 webview.setAttribute('src', 'data:text/html,trigger navigation');
143 }, 0); 132 }, 0);
144 } 133 }
145 ]); 134 ]);
146 }; 135 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698