| Index: third_party/WebKit/Source/modules/sensor/SensorReading.cpp
|
| diff --git a/third_party/WebKit/Source/modules/sensor/SensorReading.cpp b/third_party/WebKit/Source/modules/sensor/SensorReading.cpp
|
| index 12c14881bc9af7be3a74f93e364ea500abd8c641..061711983e3da38fbe6c470411a3aa26362b08e7 100644
|
| --- a/third_party/WebKit/Source/modules/sensor/SensorReading.cpp
|
| +++ b/third_party/WebKit/Source/modules/sensor/SensorReading.cpp
|
| @@ -14,7 +14,6 @@ namespace blink {
|
| SensorReading::SensorReading(SensorProxy* sensorProxy)
|
| : m_sensorProxy(sensorProxy)
|
| {
|
| - DCHECK(m_sensorProxy);
|
| }
|
|
|
| DEFINE_TRACE(SensorReading)
|
| @@ -31,6 +30,15 @@ DOMHighResTimeStamp SensorReading::timeStamp(ScriptState* scriptState) const
|
| Performance* performance = DOMWindowPerformance::performance(*window);
|
| DCHECK(performance);
|
|
|
| + if (!m_sensorProxy) {
|
| + // In cases when SensorReading derived classes are constructed from JS
|
| + // side, e.g. to create syntetic SensorReadingEvent for testing
|
| + // purposes, |m_sensorProxy| will be null and SensorReading.timeStamp
|
| + // would return current DOMHighResTimeStamp, while reading value should
|
| + // be provided by derived classes.
|
| + return performance->now();
|
| + }
|
| +
|
| return performance->monotonicTimeToDOMHighResTimeStamp(m_sensorProxy->reading().timestamp);
|
| }
|
|
|
|
|