https://github.com/web-platform-tests/wpt
Revision b7b803ba171367071f288c5ab8a3fa09c62339bd authored by Hiroshige Hayashizaki on 25 December 2018, 02:04:03 UTC, committed by Chromium WPT Sync on 25 December 2018, 02:04:03 UTC
Manual changes: spec.src.json. All others are generated.

This caused two test files with the same contents with names
- same-origin-downgrade.http.html
- same-origin-upgrade.http.html
in directories under origin-when-cross-origin/.
This CL thus removes same-origin-downgrade.http.html without
affecting test coverage.

(same-origin-downgrade is currently supressed by
source-https-unsupported-by-web-platform-tests-runners and thus
this CL doesn't add new files)

Bug: 906850
Change-Id: I1fcc150c4b2b643b3186cbef9432d343f8b4a1dd
1 parent a357943
Raw File
Tip revision: b7b803ba171367071f288c5ab8a3fa09c62339bd authored by Hiroshige Hayashizaki on 25 December 2018, 02:04:03 UTC
[wpt/referrer-policy] Fix same-origin-downgrade in spec.src.json
Tip revision: b7b803b
MediaStream-default-feature-policy.https.html
<!DOCTYPE html>
<body>
  <script src=/resources/testharness.js></script>
  <script src=/resources/testharnessreport.js></script>
  <script src=/common/get-host-info.sub.js></script>
  <script src=/feature-policy/resources/featurepolicy.js></script>
  <script>
  'use strict';

  // The promise_factory must return a promise that runs the feature and
  // resolves if feature usage is successful, otherwise rejects. Using
  // getUserMedia is successful if at least one mic/camera is returned when
  // mic/camera has been explicitly allowed by feature policy.
  function promise_factory(allowed_features) {
    return new Promise((resolve, reject) => {
      navigator.mediaDevices.getUserMedia({video: true, audio: true}).then(
          function(stream) {
            // If microphone is allowed, there should be at least one microphone
            // in the result. If camera is allowed, there should be at least one
            // camera in the result.
            if ((allowed_features.includes('microphone') &&
                 stream.getAudioTracks().length == 0) ||
                (allowed_features.includes('camera') &&
                 stream.getVideoTracks().length == 0)) {
                reject('Feature policy allowed feature but devices not ' +
                    'present.');
            } else {
              // Otherwise the result is expected.
              resolve();
            }
          },
          function(error) { reject(error); });
    });
  };

  var cross_domain = get_host_info().HTTPS_REMOTE_ORIGIN;
  run_all_fp_tests_allow_self(
      cross_domain,
      'microphone',
      'NotAllowedError',
      function() {
        return promise_factory('microphone');
      });

  run_all_fp_tests_allow_self(
      cross_domain,
      'camera',
      'NotAllowedError',
      function() {
        return promise_factory('camera');
      });

  run_all_fp_tests_allow_self(
    cross_domain,
    'camera; microphone',
    'NotAllowedError',
    function() {
      return promise_factory('camera; microphone');
    });
  </script>
</body>

back to top