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

Unified Diff: device/device_sensors/device_inertial_sensor_browsertest.cc

Issue 1164563003: Extract device_sensors to /device via Mojofication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: device/device_sensors/device_inertial_sensor_browsertest.cc
diff --git a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc b/device/device_sensors/device_inertial_sensor_browsertest.cc
similarity index 78%
rename from content/browser/device_sensors/device_inertial_sensor_browsertest.cc
rename to device/device_sensors/device_inertial_sensor_browsertest.cc
index 665b01227080cf44ee2f216d069ae4a580c173c7..670b03d5c3498a4f67aa522c3f552c513a1a7d2a 100644
--- a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc
+++ b/device/device_sensors/device_inertial_sensor_browsertest.cc
@@ -5,20 +5,20 @@
#include "base/command_line.h"
#include "base/synchronization/waitable_event.h"
#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"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/content_switches.h"
-#include "content/public/test/content_browser_test.h"
-#include "content/public/test/content_browser_test_utils.h"
-#include "content/public/test/test_navigation_observer.h"
-#include "content/public/test/test_utils.h"
-#include "content/shell/browser/shell.h"
-#include "content/shell/browser/shell_javascript_dialog_manager.h"
+#include "device/device_sensors/data_fetcher_shared_memory.h"
+#include "device/device_sensors/device_inertial_sensor_service.h"
+#include "device/device_sensors/device_light_hardware_buffer.h"
+#include "device/device_sensors/device_motion_hardware_buffer.h"
+#include "device/device_sensors/device_orientation_hardware_buffer.h"
+//#include "content/public/browser/browser_thread.h"
+//#include "content/public/browser/web_contents.h"
+//#include "content/public/common/content_switches.h"
+//#include "content/public/test/content_browser_test.h"
+//#include "content/public/test/content_browser_test_utils.h"
+//#include "content/public/test/test_navigation_observer.h"
+//#include "content/public/test/test_utils.h"
+//#include "content/shell/browser/shell.h"
+//#include "content/shell/browser/shell_javascript_dialog_manager.h"
namespace content {
@@ -40,37 +40,31 @@ class FakeDataFetcher : public DataFetcherSharedMemory {
EXPECT_TRUE(buffer);
switch (consumer_type) {
- case CONSUMER_TYPE_MOTION:
- {
- DeviceMotionHardwareBuffer* motion_buffer =
- static_cast<DeviceMotionHardwareBuffer*>(buffer);
- if (sensor_data_available_)
- UpdateMotion(motion_buffer);
- SetMotionBufferReady(motion_buffer);
- started_motion_.Signal();
- }
- break;
- case CONSUMER_TYPE_ORIENTATION:
- {
- DeviceOrientationHardwareBuffer* orientation_buffer =
- static_cast<DeviceOrientationHardwareBuffer*>(buffer);
- if (sensor_data_available_)
- UpdateOrientation(orientation_buffer);
- SetOrientationBufferReady(orientation_buffer);
- started_orientation_.Signal();
- }
- break;
- case CONSUMER_TYPE_LIGHT:
- {
- DeviceLightHardwareBuffer* light_buffer =
- static_cast<DeviceLightHardwareBuffer*>(buffer);
- UpdateLight(light_buffer,
- sensor_data_available_
- ? 100
- : std::numeric_limits<double>::infinity());
- started_light_.Signal();
- }
- break;
+ case CONSUMER_TYPE_MOTION: {
+ DeviceMotionHardwareBuffer* motion_buffer =
+ static_cast<DeviceMotionHardwareBuffer*>(buffer);
+ if (sensor_data_available_)
+ UpdateMotion(motion_buffer);
+ SetMotionBufferReady(motion_buffer);
+ started_motion_.Signal();
+ } break;
+ case CONSUMER_TYPE_ORIENTATION: {
+ DeviceOrientationHardwareBuffer* orientation_buffer =
+ static_cast<DeviceOrientationHardwareBuffer*>(buffer);
+ if (sensor_data_available_)
+ UpdateOrientation(orientation_buffer);
+ SetOrientationBufferReady(orientation_buffer);
+ started_orientation_.Signal();
+ } break;
+ case CONSUMER_TYPE_LIGHT: {
+ DeviceLightHardwareBuffer* light_buffer =
+ static_cast<DeviceLightHardwareBuffer*>(buffer);
+ UpdateLight(light_buffer,
+ sensor_data_available_
+ ? 100
+ : std::numeric_limits<double>::infinity());
+ started_light_.Signal();
+ } break;
default:
return false;
}
@@ -174,8 +168,7 @@ class FakeDataFetcher : public DataFetcherSharedMemory {
DISALLOW_COPY_AND_ASSIGN(FakeDataFetcher);
};
-
-class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
+class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
public:
DeviceInertialSensorBrowserTest()
: fetcher_(nullptr), io_loop_finished_event_(false, false) {}
@@ -189,8 +182,8 @@ class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
void SetUpOnIOThread() {
fetcher_ = new FakeDataFetcher();
- DeviceInertialSensorService::GetInstance()->
- SetDataFetcherForTesting(fetcher_);
+ DeviceInertialSensorService::GetInstance()->SetDataFetcherForTesting(
+ fetcher_);
io_loop_finished_event_.Signal();
}
@@ -205,9 +198,8 @@ class DeviceInertialSensorBrowserTest : public ContentBrowserTest {
shell()->GetJavaScriptDialogManager(shell()->web_contents()));
scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner();
- dialog_manager->set_dialog_request_callback(
- base::Bind(&DeviceInertialSensorBrowserTest::DelayAndQuit, this,
- delay));
+ dialog_manager->set_dialog_request_callback(base::Bind(
+ &DeviceInertialSensorBrowserTest::DelayAndQuit, this, delay));
runner->Run();
}
@@ -262,14 +254,14 @@ IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, MotionTest) {
}
IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest,
- LightOneOffInfintyTest) {
+ LightOneOffInfintyTest) {
// The test page registers an event handler for light events and expects
// to get an event with value equal to infinity, because no sensor data can
// be provided.
EnableExperimentalFeatures();
fetcher_->SetSensorDataAvailable(false);
- GURL test_url = GetTestUrl("device_sensors",
- "device_light_infinity_test.html");
+ GURL test_url =
+ GetTestUrl("device_sensors", "device_light_infinity_test.html");
NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2);
EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
@@ -282,8 +274,8 @@ IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, OrientationNullTest) {
// expects to get an event with null values, because no sensor data can be
// provided.
fetcher_->SetSensorDataAvailable(false);
- GURL test_url = GetTestUrl("device_sensors",
- "device_orientation_null_test.html");
+ GURL test_url =
+ GetTestUrl("device_sensors", "device_orientation_null_test.html");
NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2);
EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
@@ -296,8 +288,7 @@ IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest, MotionNullTest) {
// expects to get an event with null values, because no sensor data can be
// provided.
fetcher_->SetSensorDataAvailable(false);
- GURL test_url = GetTestUrl("device_sensors",
- "device_motion_null_test.html");
+ GURL test_url = GetTestUrl("device_sensors", "device_motion_null_test.html");
NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2);
EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
@@ -315,8 +306,8 @@ IN_PROC_BROWSER_TEST_F(DeviceInertialSensorBrowserTest,
fetcher_->SetSensorDataAvailable(false);
TestNavigationObserver same_tab_observer(shell()->web_contents(), 2);
- GURL test_url = GetTestUrl("device_sensors",
- "device_sensors_null_test_with_alert.html");
+ GURL test_url =
+ GetTestUrl("device_sensors", "device_sensors_null_test_with_alert.html");
shell()->LoadURL(test_url);
// TODO(timvolodine): investigate if it is possible to test this without
« no previous file with comments | « device/device_sensors/data_fetcher_shared_memory_win.cc ('k') | device/device_sensors/device_inertial_sensor_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698