| Index: Source/modules/battery/BatteryManager.cpp
|
| diff --git a/Source/modules/battery/BatteryManager.cpp b/Source/modules/battery/BatteryManager.cpp
|
| index aae81bcf1448b25da6e871ea668cfcd90650432e..3eb3b219f749f2ac41339bd71b4e5cc65bc9c20b 100644
|
| --- a/Source/modules/battery/BatteryManager.cpp
|
| +++ b/Source/modules/battery/BatteryManager.cpp
|
| @@ -34,9 +34,16 @@ bool BatteryManager::charging()
|
|
|
| double BatteryManager::chargingTime()
|
| {
|
| - if (!m_batteryStatus || !m_batteryStatus->charging())
|
| + if (!m_batteryStatus)
|
| + return 0;
|
| +
|
| + if (!m_batteryStatus->charging())
|
| return std::numeric_limits<double>::infinity();
|
|
|
| + // The spec requires that if level == 1.0, chargingTime == 0 but this has to
|
| + // be implement by the backend. Adding this assert will help enforcing it.
|
| + ASSERT(level() != 1.0 && m_batteryStatus->chargingTime() == 0.0);
|
| +
|
| return m_batteryStatus->chargingTime();
|
| }
|
|
|
|
|