tor-browser

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

browser_sitespecific_image_zoom.js (1646B)


      1 var tabElm, zoomLevel;
      2 function start_test_prefNotSet() {
      3  (async function () {
      4    is(ZoomManager.zoom, 1, "initial zoom level should be 1");
      5    FullZoom.enlarge();
      6 
      7    // capture the zoom level to test later
      8    zoomLevel = ZoomManager.zoom;
      9    isnot(zoomLevel, 1, "zoom level should have changed");
     10 
     11    await FullZoomHelper.load(
     12      gBrowser.selectedTab,
     13      "http://mochi.test:8888/browser/browser/base/content/test/general/moz.png"
     14    );
     15  })().then(continue_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
     16 }
     17 
     18 function continue_test_prefNotSet() {
     19  (async function () {
     20    is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
     21    await FullZoom.reset();
     22 
     23    await FullZoomHelper.load(
     24      gBrowser.selectedTab,
     25      "http://mochi.test:8888/browser/browser/base/content/test/zoom/zoom_test.html"
     26    );
     27  })().then(end_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
     28 }
     29 
     30 function end_test_prefNotSet() {
     31  (async function () {
     32    is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
     33 
     34    // Reset the zoom so that other tests have a fresh zoom level
     35    await FullZoom.reset();
     36    await FullZoomHelper.removeTabAndWaitForLocationChange();
     37    finish();
     38  })();
     39 }
     40 
     41 function test() {
     42  waitForExplicitFinish();
     43 
     44  (async function () {
     45    tabElm = BrowserTestUtils.addTab(gBrowser);
     46    await FullZoomHelper.selectTabAndWaitForLocationChange(tabElm);
     47    await FullZoomHelper.load(
     48      tabElm,
     49      "http://mochi.test:8888/browser/browser/base/content/test/zoom/zoom_test.html"
     50    );
     51  })().then(start_test_prefNotSet, FullZoomHelper.failAndContinue(finish));
     52 }