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;
  var finalWidth = 200;
  var finalHeight = 50;
  webview.addEventListener('sizechanged', function(e) {
    embedder.test.assertTrue(e.newHeight >= webview.minheight);
    embedder.test.assertTrue(e.newHeight <= webview.maxheight);
    embedder.test.assertTrue(e.newWidth >= webview.minwidth);
    embedder.test.assertTrue(e.newWidth <= webview.maxwidth);
    if (step == 1)
      webview.maxheight = 50;

    // We are done once the size settles on the final width and height.
    if (e.newHeight == finalHeight && e.newWidth == finalWidth)
      embedder.test.succeed();
    ++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);
}
// the correct height in the sizechanged event.
the correct height in the sizechanged event.
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;
  var finalWidth = 200;
  var finalHeight = 50;
  webview.addEventListener('sizechanged', function(e) {
    embedder.test.assertTrue(e.newHeight >= webview.minheight);
    embedder.test.assertTrue(e.newHeight <= webview.maxheight);
    embedder.test.assertTrue(e.newWidth >= webview.minwidth);
    embedder.test.assertTrue(e.newWidth <= webview.maxwidth);
    if (step == 1)
      webview.maxheight = 50;
    if (e.newHeight == finalHeight && e.newWidth == finalWidth)
      embedder.test.succeed();
    ++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);
}
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 ; var finalWidth = 200 ; var finalHeight = 50 ; webview . addEventListener ( 'sizechanged' , function ( e ) { embedder . test . assertTrue ( e . newHeight >= webview . minheight ) ; embedder . test . assertTrue ( e . newHeight <= webview . maxheight ) ; embedder . test . assertTrue ( e . newWidth >= webview . minwidth ) ; embedder . test . assertTrue ( e . newWidth <= webview . maxwidth ) ; if ( step == 1 ) webview . maxheight = 50 ; if ( e . newHeight == finalHeight && e . newWidth == finalWidth ) embedder . test . succeed ( ) ; ++ 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 ) ; }
the correct height in the sizechanged event.
the correct height in the sizechanged event .
// We are done once the size settles on the final width and height.