Revision 7792accba7c0f7bb80f50c8ac81da5387227224b authored by Chromium WPT Sync on 24 February 2017, 17:10:11 UTC, committed by GitHub on 24 February 2017, 17:10:11 UTC
Add tests for exiting from nested fullscreen
2 parent s 13aba11 + d4e48e5
Raw File
AmbientLightSensor_start.https.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: start()</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>

let sensor, start_return;

setup(() => {
  sensor = new AmbientLightSensor();
});

test(() => {
  assert_equals(sensor.reading, null);
}, "The default sensor.reading is 'null'");

test(() => {
  assert_equals(sensor.state, "idle");
}, "The default sensor.state is 'idle'");

test(() => {
  start_return = sensor.start();
  assert_equals(sensor.state, "activating");
}, "The sensor.state changes to 'activating' after sensor.start()");

//TODO: The permission is not ready.

test(() => {
  assert_equals(start_return, undefined);
}, "the sensor.start() return undefined");

test(() => {
  assert_throws("InvalidStateError", () => { sensor.start(); }, "start() twice");
  sensor.stop();
}, "throw an InvalidStateError exception when state is neither idle nor errored");



</script>
back to top