Index: content/browser/device_orientation/device_inertial_sensor_browsertest.cc |
diff --git a/content/browser/device_orientation/device_inertial_sensor_browsertest.cc b/content/browser/device_orientation/device_inertial_sensor_browsertest.cc |
index 0dadba347df0878d8b25d4907b77d0e64cc8bd1f..47efd87d473a567886981542f4409e8dbc4d69c5 100644 |
--- a/content/browser/device_orientation/device_inertial_sensor_browsertest.cc |
+++ b/content/browser/device_orientation/device_inertial_sensor_browsertest.cc |
@@ -6,6 +6,7 @@ |
#include "base/synchronization/waitable_event.h" |
#include "content/browser/device_orientation/data_fetcher_shared_memory.h" |
#include "content/browser/device_orientation/device_inertial_sensor_service.h" |
+#include "content/common/device_light/device_light_hardware_buffer.h" |
#include "content/common/device_orientation/device_motion_hardware_buffer.h" |
#include "content/common/device_orientation/device_orientation_hardware_buffer.h" |
#include "content/public/browser/browser_thread.h" |
@@ -25,7 +26,9 @@ class FakeDataFetcher : public DataFetcherSharedMemory { |
: started_orientation_(false, false), |
stopped_orientation_(false, false), |
started_motion_(false, false), |
- stopped_motion_(false, false) { |
+ stopped_motion_(false, false), |
+ started_light_(false, false), |
+ stopped_light_(false, false) { |
} |
virtual ~FakeDataFetcher() { } |
@@ -33,6 +36,10 @@ class FakeDataFetcher : public DataFetcherSharedMemory { |
EXPECT_TRUE(buffer); |
switch (consumer_type) { |
+ case CONSUMER_TYPE_LIGHT: |
+ UpdateLight(static_cast<DeviceLightHardwareBuffer*>(buffer)); |
+ started_light_.Signal(); |
+ break; |
case CONSUMER_TYPE_MOTION: |
UpdateMotion(static_cast<DeviceMotionHardwareBuffer*>(buffer)); |
started_motion_.Signal(); |
@@ -50,6 +57,9 @@ class FakeDataFetcher : public DataFetcherSharedMemory { |
virtual bool Stop(ConsumerType consumer_type) OVERRIDE { |
switch (consumer_type) { |
+ case CONSUMER_TYPE_LIGHT: |
+ stopped_light_.Signal(); |
+ break; |
case CONSUMER_TYPE_MOTION: |
stopped_motion_.Signal(); |
break; |
@@ -70,6 +80,12 @@ class FakeDataFetcher : public DataFetcherSharedMemory { |
return FETCHER_TYPE_DEFAULT; |
} |
+ void UpdateLight(DeviceLightHardwareBuffer* buffer) { |
+ buffer->seqlock.WriteBegin(); |
+ buffer->data = 100; |
+ buffer->seqlock.WriteEnd(); |
+ } |
+ |
void UpdateMotion(DeviceMotionHardwareBuffer* buffer) { |
buffer->seqlock.WriteBegin(); |
buffer->data.accelerationX = 1; |
@@ -114,9 +130,10 @@ class FakeDataFetcher : public DataFetcherSharedMemory { |
base::WaitableEvent stopped_orientation_; |
base::WaitableEvent started_motion_; |
base::WaitableEvent stopped_motion_; |
+ base::WaitableEvent started_light_; |
+ base::WaitableEvent stopped_light_; |
private: |
- |
DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher); |
}; |
@@ -175,6 +192,6 @@ IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, MotionTest) { |
fetcher_->stopped_motion_.Wait(); |
} |
-} // namespace |
+} // namespace |
-} // namespace content |
+} // namespace content |