function doNavigationUrlTests(originalUrl, url, expectedResultUrl) {
  var mockWindow = new MockWindow(100, 100);
  var mockSizer = new MockSizer();
  var mockViewportChangedCallback = new MockViewportChangedCallback();
  var viewport = new Viewport(mockWindow, mockSizer,
                              mockViewportChangedCallback.callback,
                              function() {}, function() {}, function() {},
                              0, 1, 0);

  var paramsParser = new OpenPDFParamsParser(function(name) {
    paramsParser.onNamedDestinationReceived(-1);
  });

  var navigatorDelegate = new MockNavigatorDelegate();
  var navigator = new Navigator(originalUrl, viewport, paramsParser,
                                navigatorDelegate);

  doNavigationUrlTest(navigator, url,
      Navigator.WindowOpenDisposition.CURRENT_TAB, expectedResultUrl,
      mockViewportChangedCallback, navigatorDelegate);
  doNavigationUrlTest(navigator, url,
      Navigator.WindowOpenDisposition.NEW_BACKGROUND_TAB, expectedResultUrl,
      mockViewportChangedCallback, navigatorDelegate);
  doNavigationUrlTest(navigator, url,
      Navigator.WindowOpenDisposition.NEW_WINDOW, expectedResultUrl,
      mockViewportChangedCallback, navigatorDelegate);
}
/**
 * Helper function to run doNavigationUrlTest() for the current tab, a new
 * tab, and a new window.
 */
Helper function to run doNavigationUrlTest() for the current tab, a new
tab, and a new window.
Helper function to run doNavigationUrlTest () for the current tab a new tab and a new window .
function doNavigationUrlTests(originalUrl, url, expectedResultUrl) {
  var mockWindow = new MockWindow(100, 100);
  var mockSizer = new MockSizer();
  var mockViewportChangedCallback = new MockViewportChangedCallback();
  var viewport = new Viewport(mockWindow, mockSizer,
                              mockViewportChangedCallback.callback,
                              function() {}, function() {}, function() {},
                              0, 1, 0);
  var paramsParser = new OpenPDFParamsParser(function(name) {
    paramsParser.onNamedDestinationReceived(-1);
  });
  var navigatorDelegate = new MockNavigatorDelegate();
  var navigator = new Navigator(originalUrl, viewport, paramsParser,
                                navigatorDelegate);
  doNavigationUrlTest(navigator, url,
      Navigator.WindowOpenDisposition.CURRENT_TAB, expectedResultUrl,
      mockViewportChangedCallback, navigatorDelegate);
  doNavigationUrlTest(navigator, url,
      Navigator.WindowOpenDisposition.NEW_BACKGROUND_TAB, expectedResultUrl,
      mockViewportChangedCallback, navigatorDelegate);
  doNavigationUrlTest(navigator, url,
      Navigator.WindowOpenDisposition.NEW_WINDOW, expectedResultUrl,
      mockViewportChangedCallback, navigatorDelegate);
}
function doNavigationUrlTests ( originalUrl , url , expectedResultUrl ) { var mockWindow = new MockWindow ( 100 , 100 ) ; var mockSizer = new MockSizer ( ) ; var mockViewportChangedCallback = new MockViewportChangedCallback ( ) ; var viewport = new Viewport ( mockWindow , mockSizer , mockViewportChangedCallback . callback , function ( ) { } , function ( ) { } , function ( ) { } , 0 , 1 , 0 ) ; var paramsParser = new OpenPDFParamsParser ( function ( name ) { paramsParser . onNamedDestinationReceived ( - 1 ) ; } ) ; var navigatorDelegate = new MockNavigatorDelegate ( ) ; var navigator = new Navigator ( originalUrl , viewport , paramsParser , navigatorDelegate ) ; doNavigationUrlTest ( navigator , url , Navigator . WindowOpenDisposition . CURRENT_TAB , expectedResultUrl , mockViewportChangedCallback , navigatorDelegate ) ; doNavigationUrlTest ( navigator , url , Navigator . WindowOpenDisposition . NEW_BACKGROUND_TAB , expectedResultUrl , mockViewportChangedCallback , navigatorDelegate ) ; doNavigationUrlTest ( navigator , url , Navigator . WindowOpenDisposition . NEW_WINDOW , expectedResultUrl , mockViewportChangedCallback , navigatorDelegate ) ; }
Helper function to run doNavigationUrlTest() for the current tab, a new
 tab, and a new window.
Helper function to run doNavigationUrlTest () for the current tab a new tab and a new window .