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

Unified Diff: content/test/data/device_sensors/device_inertial_sensor_diagnostics.html

Issue 292693004: [DeviceLight] Browser+java part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change frequency in sensor_consts Created 6 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
Index: content/test/data/device_sensors/device_inertial_sensor_diagnostics.html
diff --git a/content/test/data/device_orientation/device_inertial_sensor_diagnostics.html b/content/test/data/device_sensors/device_inertial_sensor_diagnostics.html
similarity index 80%
rename from content/test/data/device_orientation/device_inertial_sensor_diagnostics.html
rename to content/test/data/device_sensors/device_inertial_sensor_diagnostics.html
index 796357d2bb269595861aed3f9d5650a257fddb94..38f69af6245ac193c5084e391b21a68c5b1945fe 100644
--- a/content/test/data/device_orientation/device_inertial_sensor_diagnostics.html
+++ b/content/test/data/device_sensors/device_inertial_sensor_diagnostics.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>Device Motion/Orientation diagnostic measurements</title>
+ <title>Device Motion/Orientation/Light diagnostic measurements</title>
timvolodine 2014/09/04 17:16:58 could you please separate this into a separate fil
riju_ 2014/09/08 09:26:18 Done. I will add similar thing for Light in the ne
</head>
<body>
<table>
@@ -63,13 +63,28 @@
<td>orientation max frequency (Hz)</td>
<td id="orientationMaxFreq"></td>
</tr>
+ <tr>
+ <td colspan="2">
+ <hr>
+ </td>
+ </tr>
+ <tr>
+ <td>DeviceLight Supported</td>
+ <td id="lightSupported"></td>
+ </tr>
+ <tr>
+ <td>Light value (Lux value)</td>
+ <td id="lightValue"></td>
+ </tr>
</table>
<script type="text/javascript">
var numberMotionEvents = 0;
var numberOrientationEvents = 0;
+ var numberLightEvents = 0;
var motionMaxFreq = 0;
var orientationMaxFreq = 0;
+ var lightMaxFreq = 0;
var updateIntervalDelaySec = 2;
function onMotion(event) {
@@ -109,23 +124,34 @@
++numberOrientationEvents;
}
+ function onLight(event) {
+ document.getElementById("lightValues").innerHTML = event.value;
+ ++numberLightEvents;
+ }
+
function updateMeasurements() {
var motionFreq = numberMotionEvents/updateIntervalDelaySec;
var orientationFreq = numberOrientationEvents/updateIntervalDelaySec;
+ var lightFreq = numberLightEvents/updateIntervalDelaySec;
motionMaxFreq = Math.max(motionMaxFreq, motionFreq);
orientationMaxFreq = Math.max(orientationMaxFreq, orientationFreq);
+ lightMaxFreq = Math.max(lightMaxFreq, lightFreq);
document.getElementById("motionFreq").innerHTML = motionFreq;
document.getElementById("motionMaxFreq").innerHTML = motionMaxFreq;
document.getElementById("orientationFreq").innerHTML = orientationFreq;
document.getElementById("orientationMaxFreq").innerHTML = orientationMaxFreq;
+ document.getElementById("lightFreq").innerHTML = lightFreq;
+ document.getElementById("lightMaxFreq").innerHTML = lightMaxFreq;
numberMotionEvents = 0;
numberOrientationEvents = 0;
+ numberLightEvents = 0;
}
var motionSupported="not supported";
var orientationSupported="not supported";
+ var lightSupported="not supported";
if (window.DeviceMotionEvent) {
window.addEventListener('devicemotion', onMotion)
@@ -139,6 +165,12 @@
}
document.getElementById("orientationSupported").innerHTML = orientationSupported;
+ if (window.DeviceLightEvent) {
+ window.addEventListener('devicelight', onLight);
+ lightSupported = "supported";
+ }
+ document.getElementById("lightSupported").innerHTML = lightSupported;
+
setInterval(function(){updateMeasurements()}, updateIntervalDelaySec*1000);
</script>

Powered by Google App Engine
This is Rietveld 408576698