function testSetOpenerOutsideOfWindowWithWindowIdSet() {
  var url1 = getUrl('title1.html');
  var url2 = getUrl('title2.html');

  // Create a new window with a single tab (url1).
  chrome.windows.create({url: url1}, (win) => {
    chrome.test.assertNoLastError();
    chrome.test.assertTrue(!!win);
    chrome.test.assertTrue(!!win.tabs);
    chrome.test.assertEq(1, win.tabs.length);

    // Create a second window with a single tab (url2).
    chrome.windows.create({url: url2}, (secondWin) => {
      chrome.test.assertNoLastError();
      chrome.test.assertTrue(!!secondWin);
      chrome.test.assertTrue(!!secondWin.tabs);
      chrome.test.assertEq(1, secondWin.tabs.length);

      // Try to create a tab in the second window from a tab opener in the first
      // window. This *should* fail.
      chrome.tabs.create({windowId: secondWin.id, openerTabId: win.tabs[0].id},
          () => {
        chrome.test.assertLastError(
            'Tab opener must be in the same window as the updated tab.');
        chrome.test.succeed();
      });
    });
  });
}
// be in the same window as the updated tab.
be in the same window as the updated tab.
be in the same window as the updated tab .
function testSetOpenerOutsideOfWindowWithWindowIdSet() {
  var url1 = getUrl('title1.html');
  var url2 = getUrl('title2.html');
  chrome.windows.create({url: url1}, (win) => {
    chrome.test.assertNoLastError();
    chrome.test.assertTrue(!!win);
    chrome.test.assertTrue(!!win.tabs);
    chrome.test.assertEq(1, win.tabs.length);
    chrome.windows.create({url: url2}, (secondWin) => {
      chrome.test.assertNoLastError();
      chrome.test.assertTrue(!!secondWin);
      chrome.test.assertTrue(!!secondWin.tabs);
      chrome.test.assertEq(1, secondWin.tabs.length);
      chrome.tabs.create({windowId: secondWin.id, openerTabId: win.tabs[0].id},
          () => {
        chrome.test.assertLastError(
            'Tab opener must be in the same window as the updated tab.');
        chrome.test.succeed();
      });
    });
  });
}
function testSetOpenerOutsideOfWindowWithWindowIdSet ( ) { var url1 = getUrl ( 'title1.html' ) ; var url2 = getUrl ( 'title2.html' ) ; chrome . windows . create ( { url : url1 } , ( win ) => { chrome . test . assertNoLastError ( ) ; chrome . test . assertTrue ( ! ! win ) ; chrome . test . assertTrue ( ! ! win . tabs ) ; chrome . test . assertEq ( 1 , win . tabs . length ) ; chrome . windows . create ( { url : url2 } , ( secondWin ) => { chrome . test . assertNoLastError ( ) ; chrome . test . assertTrue ( ! ! secondWin ) ; chrome . test . assertTrue ( ! ! secondWin . tabs ) ; chrome . test . assertEq ( 1 , secondWin . tabs . length ) ; chrome . tabs . create ( { windowId : secondWin . id , openerTabId : win . tabs [ 0 ] . id } , ( ) => { chrome . test . assertLastError ( 'Tab opener must be in the same window as the updated tab.' ) ; chrome . test . succeed ( ) ; } ) ; } ) ; } ) ; }
be in the same window as the updated tab.
be in the same window as the updated tab .
// Create a new window with a single tab (url1). // Create a second window with a single tab (url2). // Try to create a tab in the second window from a tab opener in the first // window. This *should* fail.