function testNavigateAfterResize() {
  var webview = new WebView();

  var postMessageHandler = function(e) {
    var data = JSON.parse(e.data);
    LOG('postMessageHandler: ' + data);
    webview.removeEventListener('message', postMessageHandler);
    if (data[0] == 'dimension-response') {
      var actualWidth = data[1];
      var actualHeight = data[2];
      LOG('actualWidth: ' + actualWidth + ', actualHeight: ' + actualHeight);
      embedder.test.assertEq(100, actualWidth);
      embedder.test.assertEq(125, actualHeight);
      embedder.test.succeed();
    }
  };
  window.addEventListener('message', postMessageHandler);

  webview.addEventListener('consolemessage', function(e) {
    LOG('guest log: ' + e.message);
  });

  webview.addEventListener('loadstop', function(e) {
    webview.executeScript(
      {file: 'navigate_after_resize.js'},
      function(results) {
        if (!results || !results.length) {
          LOG('Failed to inject navigate_after_resize.js');
          embedder.test.fail();
          return;
        }
        LOG('Inject success: navigate_after_resize.js');
        var msg = ['dimension-request'];
        webview.contentWindow.postMessage(JSON.stringify(msg), '*');
      });
  });

  // First set size.
  webview.style.width = '100px';
  webview.style.height = '125px';

  // Then navigate.
  webview.src = 'about:blank';
  document.body.appendChild(webview);
}
// it remembers the size correctly.
it remembers the size correctly.
it remembers the size correctly .
function testNavigateAfterResize() {
  var webview = new WebView();
  var postMessageHandler = function(e) {
    var data = JSON.parse(e.data);
    LOG('postMessageHandler: ' + data);
    webview.removeEventListener('message', postMessageHandler);
    if (data[0] == 'dimension-response') {
      var actualWidth = data[1];
      var actualHeight = data[2];
      LOG('actualWidth: ' + actualWidth + ', actualHeight: ' + actualHeight);
      embedder.test.assertEq(100, actualWidth);
      embedder.test.assertEq(125, actualHeight);
      embedder.test.succeed();
    }
  };
  window.addEventListener('message', postMessageHandler);
  webview.addEventListener('consolemessage', function(e) {
    LOG('guest log: ' + e.message);
  });
  webview.addEventListener('loadstop', function(e) {
    webview.executeScript(
      {file: 'navigate_after_resize.js'},
      function(results) {
        if (!results || !results.length) {
          LOG('Failed to inject navigate_after_resize.js');
          embedder.test.fail();
          return;
        }
        LOG('Inject success: navigate_after_resize.js');
        var msg = ['dimension-request'];
        webview.contentWindow.postMessage(JSON.stringify(msg), '*');
      });
  });
  webview.style.width = '100px';
  webview.style.height = '125px';
  webview.src = 'about:blank';
  document.body.appendChild(webview);
}
function testNavigateAfterResize ( ) { var webview = new WebView ( ) ; var postMessageHandler = function ( e ) { var data = JSON . parse ( e . data ) ; LOG ( 'postMessageHandler: ' + data ) ; webview . removeEventListener ( 'message' , postMessageHandler ) ; if ( data [ 0 ] == 'dimension-response' ) { var actualWidth = data [ 1 ] ; var actualHeight = data [ 2 ] ; LOG ( 'actualWidth: ' + actualWidth + ', actualHeight: ' + actualHeight ) ; embedder . test . assertEq ( 100 , actualWidth ) ; embedder . test . assertEq ( 125 , actualHeight ) ; embedder . test . succeed ( ) ; } } ; window . addEventListener ( 'message' , postMessageHandler ) ; webview . addEventListener ( 'consolemessage' , function ( e ) { LOG ( 'guest log: ' + e . message ) ; } ) ; webview . addEventListener ( 'loadstop' , function ( e ) { webview . executeScript ( { file : 'navigate_after_resize.js' } , function ( results ) { if ( ! results || ! results . length ) { LOG ( 'Failed to inject navigate_after_resize.js' ) ; embedder . test . fail ( ) ; return ; } LOG ( 'Inject success: navigate_after_resize.js' ) ; var msg = [ 'dimension-request' ] ; webview . contentWindow . postMessage ( JSON . stringify ( msg ) , '*' ) ; } ) ; } ) ; webview . style . width = '100px' ; webview . style . height = '125px' ; webview . src = 'about:blank' ; document . body . appendChild ( webview ) ; }
it remembers the size correctly.
it remembers the size correctly .
// First set size. // Then navigate.