Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html

Issue 2348333002: Revert of [sensors] Ambient light sensor bindings implementation (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/sensor/idl-AmbientLightSensor.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
diff --git a/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html b/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
deleted file mode 100644
index 340cd572d7dd92bbefffaa5ebe5205e6dec141bf..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
+++ /dev/null
@@ -1,189 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="../resources/mojo-helpers.js"></script>
-<script src="resources/sensor-helpers.js"></script>
-<script>
-
-'use strict';
-
-if (!window.testRunner)
- debug('This test cannot be run without the TestRunner');
-
-const kDefaultReadingValue = 3.1415;
-
-function update_sensor_reading(buffer) {
- buffer[0] = window.performance.now();
- buffer[1] = kDefaultReadingValue;
-}
-
-sensor_test(sensor => {
- let ambientLightSensor = new AmbientLightSensor({frequency: 60});
- ambientLightSensor.start();
- let testPromise = sensor.mockSensorProvider.getCreatedSensor()
- .then((mockSensor) => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onstatechange = event => {
- if (ambientLightSensor.state === 'idle') {
- resolve(mockSensor);
- }
-
- if (ambientLightSensor.state === 'active') {
- ambientLightSensor.stop();
- }
- };
- ambientLightSensor.onerror = reject;
- });
- })
- .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
-
- return testPromise;
-}, 'Test that sensor can be successfully created if sensor is supported.');
-
-sensor_test(sensor => {
- let ambientLightSensor = new AmbientLightSensor();
- ambientLightSensor.start();
- let testPromise = sensor.mockSensorProvider.getCreatedSensor()
- .then((mockSensor) => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onstatechange = event => {
- if (ambientLightSensor.state === 'idle') {
- resolve(mockSensor);
- }
-
- if (ambientLightSensor.state === 'active') {
- ambientLightSensor.stop();
- }
- };
-
- ambientLightSensor.onerror = reject;
- });
- })
- .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
-
- return testPromise;
-}, 'Test that sensor can be constructed with default configuration.');
-
-sensor_test(sensor => {
- let ambientLightSensor = new AmbientLightSensor({frequency: 60});
- ambientLightSensor.start();
-
- let testPromise = sensor.mockSensorProvider.getCreatedSensor()
- .then(mockSensor => { return mockSensor.addConfigurationCalled(); })
- .then(mockSensor => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onstatechange = event => {
- if (ambientLightSensor.state === 'idle') {
- resolve(mockSensor);
- }
-
- if (ambientLightSensor.state === 'active') {
- ambientLightSensor.stop();
- }
- };
- });
- })
- .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
-
- return testPromise;
-}, 'Test that addConfiguration and removeConfiguration is called.');
-
-sensor_test(sensor => {
- let ambientLightSensor = new AmbientLightSensor({frequency: 60});
- ambientLightSensor.start();
- let testPromise = sensor.mockSensorProvider.getCreatedSensor()
- .then(mockSensor => {
- return mockSensor.setUpdateSensorReadingFunction(update_sensor_reading);
- })
- .then((mockSensor) => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onstatechange = event => {
- if (ambientLightSensor.state === 'idle') {
- resolve(mockSensor);
- }
- };
-
- ambientLightSensor.onchange = e => {
- assert_equals(e.reading.illuminance, kDefaultReadingValue);
- ambientLightSensor.stop();
- };
-
- ambientLightSensor.onerror = reject;
- });
- })
- .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
-
- return testPromise;
-}, 'Test that onChange is called and sensor reading is valid.');
-
-sensor_test(sensor => {
- let ambientLightSensor = new AmbientLightSensor({frequency: 60});
- ambientLightSensor.start();
- let testPromise = sensor.mockSensorProvider.getCreatedSensor()
- .then(mockSensor => {
- return mockSensor.setUpdateSensorReadingFunction(update_sensor_reading);
- })
- .then((mockSensor) => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onstatechange = () => {
- if (ambientLightSensor.state === 'idle') {
- assert_equals(ambientLightSensor.reading, null);
- resolve(mockSensor);
- }
- }
-
- ambientLightSensor.onchange = e => {
- assert_equals(e.reading.illuminance, kDefaultReadingValue);
- ambientLightSensor.stop();
- }
- ambientLightSensor.onerror = reject;
- });
- })
- .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
-
- return testPromise;
-}, 'Test that sensor reading is not updated when sensor is stopped.');
-
-sensor_test(sensor => {
- let ambientLightSensor = new AmbientLightSensor();
- ambientLightSensor.start();
- let testPromise = sensor.mockSensorProvider.getCreatedSensor()
- .then(mockSensor => {
- return mockSensor.setUpdateSensorReadingFunction(update_sensor_reading);
- })
- .then((mockSensor) => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onchange = e => {
- if (e.reading.illuminance == kDefaultReadingValue) {
- resolve(mockSensor);
- }
- }
- ambientLightSensor.onerror = reject;
- });
- })
- .then((mockSensor) => {
- testRunner.setPageVisibility("hidden");
- return mockSensor.suspendCalled();
- })
- .then((mockSensor) => {
- testRunner.setPageVisibility("visible");
- return mockSensor.resumeCalled();
- })
- .then((mockSensor) => {
- return new Promise((resolve, reject) => {
- ambientLightSensor.onstatechange = () => {
- if (ambientLightSensor.state === 'idle') {
- resolve(mockSensor);
- }
- }
- ambientLightSensor.stop();
- ambientLightSensor.onerror = reject;
- });
- })
- .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
-
- return testPromise;
-}, 'Test that sensor receives suspend / resume notifications when page'
- +' visibility changes.');
-
-</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/sensor/idl-AmbientLightSensor.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698