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

Unified Diff: content/browser/device_sensors/device_inertial_sensor_browsertest.cc

Issue 292693004: [DeviceLight] Browser+java part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add android instrumentation tests for DeviceLight Created 6 years, 5 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/browser/device_sensors/device_inertial_sensor_browsertest.cc
diff --git a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc b/content/browser/device_sensors/device_inertial_sensor_browsertest.cc
index 373907e1347f19806cb213ced85aebe5faad09db..3734177bf8da8744532f40508e642feb6be1094d 100644
--- a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc
+++ b/content/browser/device_sensors/device_inertial_sensor_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/threading/platform_thread.h"
#include "content/browser/device_sensors/data_fetcher_shared_memory.h"
#include "content/browser/device_sensors/device_inertial_sensor_service.h"
+#include "content/common/device_sensors/device_light_hardware_buffer.h"
#include "content/common/device_sensors/device_motion_hardware_buffer.h"
#include "content/common/device_sensors/device_orientation_hardware_buffer.h"
#include "content/public/browser/browser_thread.h"
@@ -28,8 +29,9 @@ class FakeDataFetcher : public DataFetcherSharedMemory {
stopped_orientation_(false, false),
started_motion_(false, false),
stopped_motion_(false, false),
- sensor_data_available_(true) {
- }
+ started_light_(false, false),
+ stopped_light_(false, false),
+ sensor_data_available_(true) {}
virtual ~FakeDataFetcher() { }
virtual bool Start(ConsumerType consumer_type, void* buffer) OVERRIDE {
@@ -56,6 +58,13 @@ class FakeDataFetcher : public DataFetcherSharedMemory {
started_orientation_.Signal();
}
break;
+ case CONSUMER_TYPE_LIGHT: {
timvolodine 2014/07/16 15:39:38 indentation
riju_ 2014/07/18 15:59:17 Done. I ran git cl format, and clang format did th
+ DeviceLightHardwareBuffer* light_buffer =
+ static_cast<DeviceLightHardwareBuffer*>(buffer);
+ if (sensor_data_available_)
+ UpdateLight(light_buffer);
+ started_light_.Signal();
+ } break;
timvolodine 2014/07/16 15:39:38 break on new line
riju_ 2014/07/18 15:59:17 Done.
default:
return false;
}
@@ -70,6 +79,9 @@ class FakeDataFetcher : public DataFetcherSharedMemory {
case CONSUMER_TYPE_ORIENTATION:
stopped_orientation_.Signal();
break;
+ case CONSUMER_TYPE_LIGHT:
+ stopped_light_.Signal();
+ break;
default:
return false;
}
@@ -140,10 +152,18 @@ class FakeDataFetcher : public DataFetcherSharedMemory {
buffer->seqlock.WriteEnd();
}
+ void UpdateLight(DeviceLightHardwareBuffer* buffer) {
+ buffer->seqlock.WriteBegin();
+ buffer->data.value = 100;
+ buffer->seqlock.WriteEnd();
+ }
+
base::WaitableEvent started_orientation_;
base::WaitableEvent stopped_orientation_;
base::WaitableEvent started_motion_;
base::WaitableEvent stopped_motion_;
+ base::WaitableEvent started_light_;
+ base::WaitableEvent stopped_light_;
bool sensor_data_available_;
private:
@@ -195,6 +215,7 @@ class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
base::WaitableEvent io_loop_finished_event_;
};
+// TODO(riju) : Add light test
timvolodine 2014/07/16 15:39:38 I think the browsertest should either be in a sepa
riju_ 2014/07/18 15:59:17 Yes. I agree with you. I am renaming the "device_o
IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, OrientationTest) {
// The test page will register an event handler for orientation events,

Powered by Google App Engine
This is Rietveld 408576698