tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_image_zoom_tabswitch.js (1377B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 "use strict";
      5 
      6 function test() {
      7  let tab1, tab2;
      8  const TEST_IMAGE =
      9    // eslint-disable-next-line @microsoft/sdl/no-insecure-url
     10    "http://example.org/browser/browser/base/content/test/general/moz.png";
     11 
     12  waitForExplicitFinish();
     13 
     14  (async function () {
     15    tab1 = BrowserTestUtils.addTab(gBrowser);
     16    tab2 = BrowserTestUtils.addTab(gBrowser);
     17    await FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
     18    await FullZoomHelper.load(tab1, TEST_IMAGE);
     19 
     20    is(ZoomManager.zoom, 1, "initial zoom level for first should be 1");
     21 
     22    FullZoom.enlarge();
     23    let zoom = ZoomManager.zoom;
     24    isnot(zoom, 1, "zoom level should have changed");
     25 
     26    await FullZoomHelper.selectTabAndWaitForLocationChange(tab2);
     27    is(ZoomManager.zoom, 1, "initial zoom level for second tab should be 1");
     28 
     29    await FullZoomHelper.selectTabAndWaitForLocationChange(tab1);
     30    is(
     31      ZoomManager.zoom,
     32      zoom,
     33      "zoom level for first tab should not have changed"
     34    );
     35 
     36    await FullZoomHelper.removeTabAndWaitForLocationChange(tab1);
     37    await FullZoomHelper.removeTabAndWaitForLocationChange(tab2);
     38  })().then(finish, FullZoomHelper.failAndContinue(finish));
     39 }