chromium/chrome/test/data/extensions/api_test/video_capture/camera_pan_tilt_zoom_kiosk_session_only/embedder.js

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

chrome.test.runTests([
  // Test that the videoCapture permission does not grant access to pan, tilt,
  // and zoom settings when the extension running in kiosk mode was not
  // autolaunched.
  async function videoCapturePermissionDoesNotGrantAccessUnlessAutoLaunched() {
    window.focus();
    const stream = await navigator.mediaDevices.getUserMedia({
      video: {pan: true, tilt: true, zoom: true},
    });
    chrome.test.assertTrue(!!stream);

    const [videoTrack] = stream.getVideoTracks();
    const settings = videoTrack.getSettings();
    chrome.test.assertFalse('pan' in settings);
    chrome.test.assertFalse('tilt' in settings);
    chrome.test.assertFalse('zoom' in settings);

    chrome.test.succeed();
  },
]);