function createTestForWebviewOnDifferentParition() {
  var agent = new Messaging.Agent('third_test');
  var messageHandler = Messaging.GetHandler();

  // Handles the test start message.
  agent.addTask(START_TEST, function(message, portFrom) {
    console.log('Asking the webview on a different partition to send us' +
        ' its cookies.');
    // Ask |webviews[2]| to report its cookies.
    messageHandler.sendMessage(
        new Messaging.Message(
            agent.getName(), 'agent_cookie', {type: GET_COOKIES}),
        webviews[2].contentWindow);
  });

  // Handles the response from |webviews[2]| regarding the value of its cookies.
  agent.addTask(GET_COOKIES_COMPLETE,  function(message, portFrom) {
    console.log('The webview on a different partition sent us its' +
        ' cookies.');
    var count = Object.keys(message.content.cookies).length;
    var result = (count === 0);
    // Test succeeds only if no cookies are reported.
    announceTestEnd(agent.getName(), result);
  });
  // End of the third test.

  messageHandler.addAgent(agent);
}
// Tests if the third webview which is on a separate partition has empty cookie.
Tests if the third webview which is on a separate partition has empty cookie.
Tests if the third webview which is on a separate partition has empty cookie .
function createTestForWebviewOnDifferentParition() {
  var agent = new Messaging.Agent('third_test');
  var messageHandler = Messaging.GetHandler();
  agent.addTask(START_TEST, function(message, portFrom) {
    console.log('Asking the webview on a different partition to send us' +
        ' its cookies.');
    messageHandler.sendMessage(
        new Messaging.Message(
            agent.getName(), 'agent_cookie', {type: GET_COOKIES}),
        webviews[2].contentWindow);
  });
  agent.addTask(GET_COOKIES_COMPLETE,  function(message, portFrom) {
    console.log('The webview on a different partition sent us its' +
        ' cookies.');
    var count = Object.keys(message.content.cookies).length;
    var result = (count === 0);
    announceTestEnd(agent.getName(), result);
  });
  messageHandler.addAgent(agent);
}
function createTestForWebviewOnDifferentParition ( ) { var agent = new Messaging . Agent ( 'third_test' ) ; var messageHandler = Messaging . GetHandler ( ) ; agent . addTask ( START_TEST , function ( message , portFrom ) { console . log ( 'Asking the webview on a different partition to send us' + ' its cookies.' ) ; messageHandler . sendMessage ( new Messaging . Message ( agent . getName ( ) , 'agent_cookie' , { type : GET_COOKIES } ) , webviews [ 2 ] . contentWindow ) ; } ) ; agent . addTask ( GET_COOKIES_COMPLETE , function ( message , portFrom ) { console . log ( 'The webview on a different partition sent us its' + ' cookies.' ) ; var count = Object . keys ( message . content . cookies ) . length ; var result = ( count === 0 ) ; announceTestEnd ( agent . getName ( ) , result ) ; } ) ; messageHandler . addAgent ( agent ) ; }
Tests if the third webview which is on a separate partition has empty cookie.
Tests if the third webview which is on a separate partition has empty cookie .
// Handles the test start message. // Ask |webviews[2]| to report its cookies. // Handles the response from |webviews[2]| regarding the value of its cookies. // Test succeeds only if no cookies are reported. // End of the third test.