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

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

Issue 2384273004: [Sensors] 'onerror' event implementation (Closed)
Patch Set: updated global-interface-listing-expected.txt Created 4 years, 2 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/webexposed/global-interface-listing-expected.txt » ('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
index 453a5ad136b5ebe85650d966565dbb902e984bf5..4774218cc38b5d28525514211d41d0024b900df9 100644
--- a/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
+++ b/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
@@ -36,6 +36,42 @@ sensor_test(sensor => {
}, 'Test that sensor state changes to "errored" when sensor is not supported.');
sensor_test(sensor => {
+ sensor.mockSensorProvider.setGetSensorShouldFail(true);
+ let ambientLightSensor = new AmbientLightSensor();
+ ambientLightSensor.start();
+ return new Promise((resolve, reject) => {
+ ambientLightSensor.onerror = event => {
+ assert_equals(ambientLightSensor.state, 'errored');
+ console.log(event.error.message);
+ assert_equals(event.error.name, 'NotFoundError');
+ resolve();
+ };
+
+ });
+}, 'Test that "onerror" is send when sensor is not supported.');
+
+
+sensor_test(sensor => {
+ let ambientLightSensor = new AmbientLightSensor({frequency: 560});
+ ambientLightSensor.start();
+
+ let testPromise = sensor.mockSensorProvider.getCreatedSensor()
+ .then(mockSensor => {
+ mockSensor.setStartShouldFail(true);
+ return mockSensor.addConfigurationCalled(); })
+ .then(mockSensor => {
+ return new Promise((resolve, reject) => {
+ ambientLightSensor.onerror = event => {
+ assert_equals(ambientLightSensor.state, 'errored');
+ assert_equals(event.error.name, 'OperationError');
+ resolve();
+ };
+ });
+ });
+ return testPromise;
+}, 'Test that "onerror" is send when start() call has failed.');
+
+sensor_test(sensor => {
let ambientLightSensor = new AmbientLightSensor({frequency: 560});
ambientLightSensor.start();
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698