Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / renderer / device_sensors / device_orientation_event_pump_unittest.cc
index 95a54df..35792f9 100644 (file)
@@ -22,7 +22,7 @@ class MockDeviceOrientationListener
   virtual ~MockDeviceOrientationListener() { }
 
   virtual void didChangeDeviceOrientation(
-      const blink::WebDeviceOrientationData& data) OVERRIDE {
+      const blink::WebDeviceOrientationData& data) override {
     memcpy(&data_, &data, sizeof(data));
     did_change_device_orientation_ = true;
   }
@@ -46,15 +46,16 @@ class MockDeviceOrientationListener
 
 class DeviceOrientationEventPumpForTesting : public DeviceOrientationEventPump {
  public:
-  DeviceOrientationEventPumpForTesting() { }
-  virtual ~DeviceOrientationEventPumpForTesting() { }
+  DeviceOrientationEventPumpForTesting()
+      : DeviceOrientationEventPump(0) { }
+  ~DeviceOrientationEventPumpForTesting() override {}
 
   void OnDidStart(base::SharedMemoryHandle renderer_handle) {
     DeviceOrientationEventPump::OnDidStart(renderer_handle);
   }
-  virtual bool SendStartMessage() OVERRIDE { return true; }
-  virtual bool SendStopMessage() OVERRIDE { return true; }
-  virtual void FireEvent() OVERRIDE {
+  void SendStartMessage() override {}
+  void SendStopMessage() override {}
+  void FireEvent() override {
     DeviceOrientationEventPump::FireEvent();
     Stop();
     base::MessageLoop::current()->QuitWhenIdle();
@@ -72,7 +73,7 @@ class DeviceOrientationEventPumpTest : public testing::Test {
   }
 
  protected:
-  virtual void SetUp() OVERRIDE {
+  void SetUp() override {
     const DeviceOrientationHardwareBuffer* null_buffer = NULL;
     listener_.reset(new MockDeviceOrientationListener);
     orientation_pump_.reset(new DeviceOrientationEventPumpForTesting);
@@ -121,7 +122,7 @@ TEST_F(DeviceOrientationEventPumpTest, DidStartPolling) {
   base::MessageLoop loop;
 
   InitBuffer();
-  orientation_pump()->SetListener(listener());
+  orientation_pump()->Start(listener());
   orientation_pump()->OnDidStart(handle());
 
   base::MessageLoop::current()->Run();
@@ -141,7 +142,7 @@ TEST_F(DeviceOrientationEventPumpTest, FireAllNullEvent) {
   base::MessageLoop loop;
 
   InitBufferNoData();
-  orientation_pump()->SetListener(listener());
+  orientation_pump()->Start(listener());
   orientation_pump()->OnDidStart(handle());
 
   base::MessageLoop::current()->Run();
@@ -158,7 +159,7 @@ TEST_F(DeviceOrientationEventPumpTest, UpdateRespectsOrientationThreshold) {
   base::MessageLoop loop;
 
   InitBuffer();
-  orientation_pump()->SetListener(listener());
+  orientation_pump()->Start(listener());
   orientation_pump()->OnDidStart(handle());
 
   base::MessageLoop::current()->Run();
@@ -177,6 +178,9 @@ TEST_F(DeviceOrientationEventPumpTest, UpdateRespectsOrientationThreshold) {
       1 + DeviceOrientationEventPump::kOrientationThreshold / 2.0;
   listener()->set_did_change_device_orientation(false);
 
+  // Reset the pump's listener.
+  orientation_pump()->Start(listener());
+
   base::MessageLoop::current()->PostTask(FROM_HERE,
       base::Bind(&DeviceOrientationEventPumpForTesting::FireEvent,
                  base::Unretained(orientation_pump())));
@@ -195,6 +199,9 @@ TEST_F(DeviceOrientationEventPumpTest, UpdateRespectsOrientationThreshold) {
       1 + DeviceOrientationEventPump::kOrientationThreshold;
   listener()->set_did_change_device_orientation(false);
 
+  // Reset the pump's listener.
+  orientation_pump()->Start(listener());
+
   base::MessageLoop::current()->PostTask(FROM_HERE,
       base::Bind(&DeviceOrientationEventPumpForTesting::FireEvent,
                  base::Unretained(orientation_pump())));