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

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

Issue 544313002: BrowserPlugin: Grab the correct viewsize to report to BrowserPluginGuestDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extra spaces Created 6 years, 3 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
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 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
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 a lengthy page with autosize enabled will report
97 // the correct height in the sizechanged event.
98 function testAutosizeHeight() {
99 var webview = document.createElement('webview');
100
101 webview.setAttribute('autosize', 'true');
102 webview.setAttribute('minwidth', 200);
103 webview.setAttribute('maxwidth', 210);
104 webview.setAttribute('minheight', 40);
105 webview.setAttribute('maxheight', 50);
danakj 2014/09/05 21:13:19 This makes a layer tree in the child that is talle
Fady Samuel 2014/09/05 21:31:53 This test is focused on height. I've added steps t
106
107 webview.addEventListener('sizechanged', function(e) {
108 embedder.test.assertEq(50, e.newHeight);
109 embedder.test.succeed();
110 });
111
112 webview.setAttribute('src',
113 'data:text/html,' +
114 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
115 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
116 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
117 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
118 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>');
119 document.body.appendChild(webview);
120 }
121
96 // This test verifies that if a browser plugin is in autosize mode before 122 // This test verifies that if a browser plugin is in autosize mode before
97 // navigation then the guest starts auto-sized. 123 // navigation then the guest starts auto-sized.
98 function testAutosizeBeforeNavigation() { 124 function testAutosizeBeforeNavigation() {
99 var webview = document.createElement('webview'); 125 var webview = document.createElement('webview');
100 126
101 webview.setAttribute('autosize', 'true'); 127 webview.setAttribute('autosize', 'true');
102 webview.setAttribute('minwidth', 200); 128 webview.setAttribute('minwidth', 200);
103 webview.setAttribute('maxwidth', 210); 129 webview.setAttribute('maxwidth', 210);
104 webview.setAttribute('minheight', 100); 130 webview.setAttribute('minheight', 100);
105 webview.setAttribute('maxheight', 110); 131 webview.setAttribute('maxheight', 110);
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 }); 1751 });
1726 wv.find("dog"); 1752 wv.find("dog");
1727 wv.find("cat"); 1753 wv.find("cat");
1728 wv.find("dog"); 1754 wv.find("dog");
1729 }); 1755 });
1730 1756
1731 document.body.appendChild(webview); 1757 document.body.appendChild(webview);
1732 }; 1758 };
1733 1759
1734 embedder.test.testList = { 1760 embedder.test.testList = {
1761 'testAutosizeHeight': testAutosizeHeight,
1735 'testAutosizeAfterNavigation': testAutosizeAfterNavigation, 1762 'testAutosizeAfterNavigation': testAutosizeAfterNavigation,
1736 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation, 1763 'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation,
1737 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes, 1764 'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes,
1738 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes, 1765 'testAutosizeWithPartialAttributes': testAutosizeWithPartialAttributes,
1739 'testAPIMethodExistence': testAPIMethodExistence, 1766 'testAPIMethodExistence': testAPIMethodExistence,
1740 'testChromeExtensionURL': testChromeExtensionURL, 1767 'testChromeExtensionURL': testChromeExtensionURL,
1741 'testChromeExtensionRelativePath': testChromeExtensionRelativePath, 1768 'testChromeExtensionRelativePath': testChromeExtensionRelativePath,
1742 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad, 1769 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad,
1743 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild, 1770 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild,
1744 'testInlineScriptFromAccessibleResources': 1771 'testInlineScriptFromAccessibleResources':
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 'testFindAPI': testFindAPI, 1827 'testFindAPI': testFindAPI,
1801 'testFindAPI_findupdate': testFindAPI 1828 'testFindAPI_findupdate': testFindAPI
1802 }; 1829 };
1803 1830
1804 onload = function() { 1831 onload = function() {
1805 chrome.test.getConfig(function(config) { 1832 chrome.test.getConfig(function(config) {
1806 embedder.setUp_(config); 1833 embedder.setUp_(config);
1807 chrome.test.sendMessage("Launched"); 1834 chrome.test.sendMessage("Launched");
1808 }); 1835 });
1809 }; 1836 };
OLDNEW
« no previous file with comments | « chrome/browser/apps/web_view_browsertest.cc ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698