| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 FetcherType GetType() const override { return FETCHER_TYPE_DEFAULT; } | 147 FetcherType GetType() const override { return FETCHER_TYPE_DEFAULT; } |
| 148 | 148 |
| 149 void SetSensorDataAvailable(bool available) { | 149 void SetSensorDataAvailable(bool available) { |
| 150 sensor_data_available_ = available; | 150 sensor_data_available_ = available; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void SetMotionBufferReady(device::DeviceMotionHardwareBuffer* buffer) { | 153 void SetMotionBufferReady(device::DeviceMotionHardwareBuffer* buffer) { |
| 154 buffer->seqlock.WriteBegin(); | 154 buffer->seqlock.WriteBegin(); |
| 155 buffer->data.allAvailableSensorsAreActive = true; | 155 buffer->data.all_available_sensors_are_active = true; |
| 156 buffer->seqlock.WriteEnd(); | 156 buffer->seqlock.WriteEnd(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void SetOrientationBufferReady( | 159 void SetOrientationBufferReady( |
| 160 device::DeviceOrientationHardwareBuffer* buffer) { | 160 device::DeviceOrientationHardwareBuffer* buffer) { |
| 161 buffer->seqlock.WriteBegin(); | 161 buffer->seqlock.WriteBegin(); |
| 162 buffer->data.allAvailableSensorsAreActive = true; | 162 buffer->data.all_available_sensors_are_active = true; |
| 163 buffer->seqlock.WriteEnd(); | 163 buffer->seqlock.WriteEnd(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void UpdateMotion(device::DeviceMotionHardwareBuffer* buffer) { | 166 void UpdateMotion(device::DeviceMotionHardwareBuffer* buffer) { |
| 167 buffer->seqlock.WriteBegin(); | 167 buffer->seqlock.WriteBegin(); |
| 168 buffer->data.accelerationX = 1; | 168 buffer->data.acceleration_x = 1; |
| 169 buffer->data.hasAccelerationX = true; | 169 buffer->data.has_acceleration_x = true; |
| 170 buffer->data.accelerationY = 2; | 170 buffer->data.acceleration_y = 2; |
| 171 buffer->data.hasAccelerationY = true; | 171 buffer->data.has_acceleration_y = true; |
| 172 buffer->data.accelerationZ = 3; | 172 buffer->data.acceleration_z = 3; |
| 173 buffer->data.hasAccelerationZ = true; | 173 buffer->data.has_acceleration_z = true; |
| 174 | 174 |
| 175 buffer->data.accelerationIncludingGravityX = 4; | 175 buffer->data.acceleration_including_gravity_x = 4; |
| 176 buffer->data.hasAccelerationIncludingGravityX = true; | 176 buffer->data.has_acceleration_including_gravity_x = true; |
| 177 buffer->data.accelerationIncludingGravityY = 5; | 177 buffer->data.acceleration_including_gravity_y = 5; |
| 178 buffer->data.hasAccelerationIncludingGravityY = true; | 178 buffer->data.has_acceleration_including_gravity_y = true; |
| 179 buffer->data.accelerationIncludingGravityZ = 6; | 179 buffer->data.acceleration_including_gravity_z = 6; |
| 180 buffer->data.hasAccelerationIncludingGravityZ = true; | 180 buffer->data.has_acceleration_including_gravity_z = true; |
| 181 | 181 |
| 182 buffer->data.rotationRateAlpha = 7; | 182 buffer->data.rotation_rate_alpha = 7; |
| 183 buffer->data.hasRotationRateAlpha = true; | 183 buffer->data.has_rotation_rate_alpha = true; |
| 184 buffer->data.rotationRateBeta = 8; | 184 buffer->data.rotation_rate_beta = 8; |
| 185 buffer->data.hasRotationRateBeta = true; | 185 buffer->data.has_rotation_rate_beta = true; |
| 186 buffer->data.rotationRateGamma = 9; | 186 buffer->data.rotation_rate_gamma = 9; |
| 187 buffer->data.hasRotationRateGamma = true; | 187 buffer->data.has_rotation_rate_gamma = true; |
| 188 | 188 |
| 189 buffer->data.interval = 100; | 189 buffer->data.interval = 100; |
| 190 buffer->data.allAvailableSensorsAreActive = true; | 190 buffer->data.all_available_sensors_are_active = true; |
| 191 buffer->seqlock.WriteEnd(); | 191 buffer->seqlock.WriteEnd(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void UpdateOrientation(device::DeviceOrientationHardwareBuffer* buffer) { | 194 void UpdateOrientation(device::DeviceOrientationHardwareBuffer* buffer) { |
| 195 buffer->seqlock.WriteBegin(); | 195 buffer->seqlock.WriteBegin(); |
| 196 buffer->data.alpha = 1; | 196 buffer->data.alpha = 1; |
| 197 buffer->data.hasAlpha = true; | 197 buffer->data.has_alpha = true; |
| 198 buffer->data.beta = 2; | 198 buffer->data.beta = 2; |
| 199 buffer->data.hasBeta = true; | 199 buffer->data.has_beta = true; |
| 200 buffer->data.gamma = 3; | 200 buffer->data.gamma = 3; |
| 201 buffer->data.hasGamma = true; | 201 buffer->data.has_gamma = true; |
| 202 buffer->data.allAvailableSensorsAreActive = true; | 202 buffer->data.all_available_sensors_are_active = true; |
| 203 buffer->seqlock.WriteEnd(); | 203 buffer->seqlock.WriteEnd(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void UpdateOrientationAbsolute( | 206 void UpdateOrientationAbsolute( |
| 207 device::DeviceOrientationHardwareBuffer* buffer) { | 207 device::DeviceOrientationHardwareBuffer* buffer) { |
| 208 buffer->seqlock.WriteBegin(); | 208 buffer->seqlock.WriteBegin(); |
| 209 buffer->data.alpha = 4; | 209 buffer->data.alpha = 4; |
| 210 buffer->data.hasAlpha = true; | 210 buffer->data.has_alpha = true; |
| 211 buffer->data.beta = 5; | 211 buffer->data.beta = 5; |
| 212 buffer->data.hasBeta = true; | 212 buffer->data.has_beta = true; |
| 213 buffer->data.gamma = 6; | 213 buffer->data.gamma = 6; |
| 214 buffer->data.hasGamma = true; | 214 buffer->data.has_gamma = true; |
| 215 buffer->data.absolute = true; | 215 buffer->data.absolute = true; |
| 216 buffer->data.allAvailableSensorsAreActive = true; | 216 buffer->data.all_available_sensors_are_active = true; |
| 217 buffer->seqlock.WriteEnd(); | 217 buffer->seqlock.WriteEnd(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void UpdateLight(device::DeviceLightHardwareBuffer* buffer, double lux) { | 220 void UpdateLight(device::DeviceLightHardwareBuffer* buffer, double lux) { |
| 221 buffer->seqlock.WriteBegin(); | 221 buffer->seqlock.WriteBegin(); |
| 222 buffer->data.value = lux; | 222 buffer->data.value = lux; |
| 223 buffer->seqlock.WriteEnd(); | 223 buffer->seqlock.WriteEnd(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // The below callbacks should be run on the UI thread. | 226 // The below callbacks should be run on the UI thread. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 motion_stopped_runloop_->Run(); | 460 motion_stopped_runloop_->Run(); |
| 461 orientation_started_runloop_->Run(); | 461 orientation_started_runloop_->Run(); |
| 462 orientation_stopped_runloop_->Run(); | 462 orientation_stopped_runloop_->Run(); |
| 463 same_tab_observer.Wait(); | 463 same_tab_observer.Wait(); |
| 464 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); | 464 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace | 467 } // namespace |
| 468 | 468 |
| 469 } // namespace content | 469 } // namespace content |
| OLD | NEW |