Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
| 5 <script src="resources/sensor-helpers.js"></script> | 5 <script src="resources/sensor-helpers.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 if (!window.testRunner) | 10 if (!window.testRunner) |
| 11 debug('This test cannot be run without the TestRunner'); | 11 debug('This test cannot be run without the TestRunner'); |
| 12 | 12 |
| 13 const kDefaultReadingValue = 3.1415; | 13 const kDefaultReadingValue = 3.1415; |
| 14 | 14 |
| 15 function update_sensor_reading(buffer) { | 15 function update_sensor_reading(buffer) { |
| 16 buffer[0] = window.performance.now(); | 16 buffer[0] = 0.0; // Placeholder for seqlock. |
|
shalamov
2016/10/06 12:46:09
Maybe better to make resetBuffer() function in sen
Mikhail
2016/10/07 10:07:02
Done.
| |
| 17 buffer[1] = kDefaultReadingValue; | 17 buffer[1] = window.performance.now(); |
| 18 buffer[2] = kDefaultReadingValue; | |
| 18 } | 19 } |
| 19 | 20 |
| 20 test(() => assert_throws( | 21 test(() => assert_throws( |
| 21 new RangeError(), | 22 new RangeError(), |
| 22 () => new AmbientLightSensor({frequency: -60})), | 23 () => new AmbientLightSensor({frequency: -60})), |
| 23 'Test that negative frequency causes exception from constructor.'); | 24 'Test that negative frequency causes exception from constructor.'); |
| 24 | 25 |
| 25 sensor_test(sensor => { | 26 sensor_test(sensor => { |
| 26 sensor.mockSensorProvider.setGetSensorShouldFail(true); | 27 sensor.mockSensorProvider.setGetSensorShouldFail(true); |
| 27 let ambientLightSensor = new AmbientLightSensor(); | 28 let ambientLightSensor = new AmbientLightSensor(); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 ambientLightSensor.onerror = reject; | 225 ambientLightSensor.onerror = reject; |
| 225 }); | 226 }); |
| 226 }) | 227 }) |
| 227 .then(mockSensor => { return mockSensor.removeConfigurationCalled(); }); | 228 .then(mockSensor => { return mockSensor.removeConfigurationCalled(); }); |
| 228 | 229 |
| 229 return testPromise; | 230 return testPromise; |
| 230 }, 'Test that sensor receives suspend / resume notifications when page' | 231 }, 'Test that sensor receives suspend / resume notifications when page' |
| 231 +' visibility changes.'); | 232 +' visibility changes.'); |
| 232 | 233 |
| 233 </script> | 234 </script> |
| OLD | NEW |