tor-browser

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

helper_zoom_after_gpu_process_restart.html (2022B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <meta name="viewport" content="width=device-width">
      6  <title>Sanity check for pinch zooming after GPU process restart</title>
      7  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
      8  <script type="application/javascript" src="apz_test_utils.js"></script>
      9  <script src="/tests/SimpleTest/paint_listener.js"></script>
     10  <script type="application/javascript">
     11 
     12 async function test() {
     13  let initial_resolution = await getResolution();
     14  ok(initial_resolution > 0,
     15      "The initial_resolution is " + initial_resolution + ", which is some sane value");
     16 
     17  // Kill the GPU process
     18  await SpecialPowers.spawnChrome([], async () => {
     19    const gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
     20 
     21    if (gfxInfo.usingGPUProcess) {
     22      const { TestUtils } = ChromeUtils.importESModule(
     23        "resource://testing-common/TestUtils.sys.mjs"
     24      );
     25      let promise = TestUtils.topicObserved("compositor-reinitialized");
     26 
     27      gfxInfo.killGPUProcessForTests();
     28      await promise;
     29    }
     30  });
     31 
     32  // Ensure resolution is unchanged by GPU process restart
     33  await waitUntilApzStable();
     34  let resolution = await getResolution();
     35  ok(
     36    resolution == initial_resolution,
     37    "The resolution (" + resolution + ") is the same after GPU process restart"
     38  );
     39 
     40  // Perform the zoom
     41  await pinchZoomInWithTouch(150, 300);
     42 
     43  // Flush state and get the resolution we're at now
     44  await promiseApzFlushedRepaints();
     45  let final_resolution = await getResolution();
     46  ok(
     47    final_resolution > initial_resolution,
     48    "The final resolution (" + final_resolution + ") is greater after zooming in"
     49  );
     50 }
     51 
     52 waitUntilApzStable()
     53  .then(test)
     54  .then(subtestDone, subtestFailed);
     55 
     56  </script>
     57 </head>
     58 <body>
     59  Here is some text to stare at as the test runs. It serves no functional
     60  purpose, but gives you an idea of the zoom level. It's harder to tell what
     61  the zoom level is when the page is just solid white.
     62 </body>
     63 </html>