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

Unified 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: Switched to property notation from attribute notation for readability 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/platform_apps/web_view/shim/main.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
index 86094df512d3b658dabcf60cfc73b0e976cbe0e9..b0487a901afadc51443010597be84eefec461c4a 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
@@ -93,6 +93,48 @@ embedder.test.assertFalse = function(condition) {
// Tests begin.
+// This test verifies that a lengthy page with autosize enabled will report
+// the correct height in the sizechanged event.
+function testAutosizeHeight() {
+ var webview = document.createElement('webview');
+
+ webview.autosize = true;
+ webview.minwidth = 200;
+ webview.maxwidth = 210;
+ webview.minheight = 40;
+ webview.maxheight = 200;
+
+ var step = 1;
+ webview.addEventListener('sizechanged', function(e) {
+ switch (step) {
+ case 1:
+ embedder.test.assertEq(0, e.oldHeight);
+ embedder.test.assertEq(200, e.newHeight);
+ // Change the maxheight to verify that we see the change.
+ webview.maxheight = 50;
+ break;
+ case 2:
+ embedder.test.assertEq(200, e.oldHeight);
+ embedder.test.assertEq(50, e.newHeight);
+ embedder.test.succeed();
+ break;
+ default:
+ window.console.log('Unexpected sizechanged event, step = ' + step);
+ embedder.test.fail();
+ break;
+ }
+ ++step;
+ });
+
+ webview.src = 'data:text/html,' +
+ 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
+ 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
+ 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
+ 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>' +
+ 'a<br/>b<br/>c<br/>d<br/>e<br/>f<br/>';
+ document.body.appendChild(webview);
+}
+
// This test verifies that if a browser plugin is in autosize mode before
// navigation then the guest starts auto-sized.
function testAutosizeBeforeNavigation() {
@@ -1732,6 +1774,7 @@ function testFindAPI_findupdate() {
};
embedder.test.testList = {
+ 'testAutosizeHeight': testAutosizeHeight,
'testAutosizeAfterNavigation': testAutosizeAfterNavigation,
'testAutosizeBeforeNavigation': testAutosizeBeforeNavigation,
'testAutosizeRemoveAttributes': testAutosizeRemoveAttributes,
« 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