function testAutosizeWithPartialAttributes() {
  window.console.log('testAutosizeWithPartialAttributes');
  var webview = document.createElement('webview');

  var step = 1;
  var sizeChangeHandler = function(e) {
    window.console.log('sizeChangeHandler, new: ' +
                       e.newWidth + ' X ' + e.newHeight);
    switch (step) {
      case 1:
        // Expect 300x200.
        embedder.test.assertEq(300, e.newWidth);
        embedder.test.assertEq(200, e.newHeight);

        // Change the min size to cause a relayout.
        webview.minwidth = 500;
        break;
      case 2:
        embedder.test.assertTrue(e.newWidth >= webview.minwidth);
        embedder.test.assertTrue(e.newWidth <= webview.maxwidth);

        // Tests when minwidth > maxwidth, minwidth = maxwidth.
        // i.e. minwidth is essentially 700.
        webview.minwidth = 800;
        break;
      case 3:
        // Expect 700X?
        embedder.test.assertEq(700, e.newWidth);
        embedder.test.assertTrue(e.newHeight >= 200);
        embedder.test.assertTrue(e.newHeight <= 600);

        embedder.test.succeed();
        break;
      default:
        window.console.log('Unexpected sizechanged event, step = ' + step);
        embedder.test.fail();
        break;
    }

    ++step;
  };

  webview.addEventListener('sizechanged', sizeChangeHandler);

  webview.addEventListener('loadstop', function(e) {
    webview.minwidth = 300;
    webview.maxwidth = 700;
    webview.minheight = 200;
    webview.maxheight = 600;
    webview.autosize = true;
  });

  webview.style.width = '640px';
  webview.style.height = '480px';
  webview.setAttribute('src', 'data:text/html,webview check autosize');
  document.body.appendChild(webview);
}
// This test verifies that autosize works when some of the parameters are unset.
This test verifies that autosize works when some of the parameters are unset.
This test verifies that autosize works when some of the parameters are unset .
function testAutosizeWithPartialAttributes() {
  window.console.log('testAutosizeWithPartialAttributes');
  var webview = document.createElement('webview');
  var step = 1;
  var sizeChangeHandler = function(e) {
    window.console.log('sizeChangeHandler, new: ' +
                       e.newWidth + ' X ' + e.newHeight);
    switch (step) {
      case 1:
        embedder.test.assertEq(300, e.newWidth);
        embedder.test.assertEq(200, e.newHeight);
        webview.minwidth = 500;
        break;
      case 2:
        embedder.test.assertTrue(e.newWidth >= webview.minwidth);
        embedder.test.assertTrue(e.newWidth <= webview.maxwidth);
        webview.minwidth = 800;
        break;
      case 3:
        embedder.test.assertEq(700, e.newWidth);
        embedder.test.assertTrue(e.newHeight >= 200);
        embedder.test.assertTrue(e.newHeight <= 600);
        embedder.test.succeed();
        break;
      default:
        window.console.log('Unexpected sizechanged event, step = ' + step);
        embedder.test.fail();
        break;
    }
    ++step;
  };
  webview.addEventListener('sizechanged', sizeChangeHandler);
  webview.addEventListener('loadstop', function(e) {
    webview.minwidth = 300;
    webview.maxwidth = 700;
    webview.minheight = 200;
    webview.maxheight = 600;
    webview.autosize = true;
  });
  webview.style.width = '640px';
  webview.style.height = '480px';
  webview.setAttribute('src', 'data:text/html,webview check autosize');
  document.body.appendChild(webview);
}
function testAutosizeWithPartialAttributes ( ) { window . console . log ( 'testAutosizeWithPartialAttributes' ) ; var webview = document . createElement ( 'webview' ) ; var step = 1 ; var sizeChangeHandler = function ( e ) { window . console . log ( 'sizeChangeHandler, new: ' + e . newWidth + ' X ' + e . newHeight ) ; switch ( step ) { case 1 : embedder . test . assertEq ( 300 , e . newWidth ) ; embedder . test . assertEq ( 200 , e . newHeight ) ; webview . minwidth = 500 ; break ; case 2 : embedder . test . assertTrue ( e . newWidth >= webview . minwidth ) ; embedder . test . assertTrue ( e . newWidth <= webview . maxwidth ) ; webview . minwidth = 800 ; break ; case 3 : embedder . test . assertEq ( 700 , e . newWidth ) ; embedder . test . assertTrue ( e . newHeight >= 200 ) ; embedder . test . assertTrue ( e . newHeight <= 600 ) ; embedder . test . succeed ( ) ; break ; default : window . console . log ( 'Unexpected sizechanged event, step = ' + step ) ; embedder . test . fail ( ) ; break ; } ++ step ; } ; webview . addEventListener ( 'sizechanged' , sizeChangeHandler ) ; webview . addEventListener ( 'loadstop' , function ( e ) { webview . minwidth = 300 ; webview . maxwidth = 700 ; webview . minheight = 200 ; webview . maxheight = 600 ; webview . autosize = true ; } ) ; webview . style . width = '640px' ; webview . style . height = '480px' ; webview . setAttribute ( 'src' , 'data:text/html,webview check autosize' ) ; document . body . appendChild ( webview ) ; }
This test verifies that autosize works when some of the parameters are unset.
This test verifies that autosize works when some of the parameters are unset .
// Expect 300x200. // Change the min size to cause a relayout. // Tests when minwidth > maxwidth, minwidth = maxwidth. // i.e. minwidth is essentially 700. // Expect 700X?