mirror of
https://github.com/servo/servo.git
synced 2025-10-08 20:49:24 +01:00
31 lines
993 B
HTML
31 lines
993 B
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>
|
|
var sensor, start_return;
|
|
|
|
setup(function() {
|
|
sensor = new AmbientLightSensor();
|
|
start_return = sensor.start();
|
|
});
|
|
|
|
test(function() {
|
|
assert_equals(String(sensor.reading), "[object AmbientLightSensorReading]");
|
|
}, "the sensor.reading is AmbientLightSensorReading after executing start() method");
|
|
|
|
test(function() {
|
|
assert_throws("InvalidStateError", function() { sensor.start(); }, "start() twice");
|
|
}, "throw an InvalidStateError exception when state is neither idle nor errored");
|
|
|
|
//TODO: The permission is not ready.
|
|
|
|
test(function() {
|
|
assert_equals(start_return, undefined);
|
|
}, "the sensor.start() return undefined");
|
|
|
|
</script>
|