blob: 2ac29be2168405499dc55ca50c97870dce3f6f33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<!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>
|