Commit e563d3ad authored by diegohcg@webkit.org's avatar diegohcg@webkit.org

[Qt] Mock DeviceOrientation client for DRT

https://bugs.webkit.org/show_bug.cgi?id=47490

Reviewed by Kenneth Rohde Christiansen.

WebCore:

* WebCore.pro:

WebKit/qt:

* WebCoreSupport/DeviceOrientationClientMockQt.cpp: Added.
(WebCore::DeviceOrientationClientMockQt::client):
(WebCore::DeviceOrientationClientMockQt::DeviceOrientationClientMockQt):
(WebCore::DeviceOrientationClientMockQt::~DeviceOrientationClientMockQt):
(WebCore::DeviceOrientationClientMockQt::setController):
(WebCore::DeviceOrientationClientMockQt::startUpdating):
(WebCore::DeviceOrientationClientMockQt::stopUpdating):
(WebCore::DeviceOrientationClientMockQt::lastOrientation):
(WebCore::DeviceOrientationClientMockQt::deviceOrientationControllerDestroyed):
(WebCore::DeviceOrientationClientMockQt::setOrientation):
* WebCoreSupport/DeviceOrientationClientMockQt.h: Added.
* WebCoreSupport/DeviceOrientationClientQt.cpp:
* WebCoreSupport/DeviceOrientationProviderQt.cpp:
(WebCore::DeviceOrientationProviderQt::DeviceOrientationProviderQt):
(WebCore::DeviceOrientationProviderQt::~DeviceOrientationProviderQt):
(WebCore::DeviceOrientationProviderQt::changeDeviceOrientation):
* WebCoreSupport/DeviceOrientationProviderQt.h:
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::activeMockDeviceOrientationClient):
(DumpRenderTreeSupportQt::removeMockDeviceOrientation):
(DumpRenderTreeSupportQt::setMockDeviceOrientation):
* WebCoreSupport/DumpRenderTreeSupportQt.h:

WebKitTools:

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::DumpRenderTree):
(WebCore::DumpRenderTree::~DumpRenderTree):
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::setMockDeviceOrientation):

LayoutTests:

* platform/qt/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73862 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bb87c75d
2010-10-11 Diego Gonzalez <diegohcg@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Mock DeviceOrientation client for DRT
https://bugs.webkit.org/show_bug.cgi?id=47490
* platform/qt/Skipped:
2010-12-11 Pavel Feldman <pfeldman@chromium.org>
Not reviewed. Update chromium test expectations.
......
......@@ -75,15 +75,6 @@ svg/webarchive
# This test is for clients that choose to make the missing plugin indicator a button
plugins/clicking-missing-plugin-fires-delegate.html
# =========================================================================== #
# Feature not supported... yet
# =========================================================================== #
# This port doesn't support DeviceMotion or DeviceOrientation.
fast/dom/DeviceMotion
fast/dom/DeviceOrientation
fast/dom/Window/window-properties-device-orientation.html
# IndexedDB is not yet enabled.
storage/indexeddb
......@@ -3054,6 +3045,7 @@ fast/dom/row-inner-text.html
fast/dom/setPrimitiveValue.html
fast/dom/stripNullFromTextNodes.html
fast/dom/wrapper-classes.html
fast/dom/Window/window-properties-device-orientation.html
fast/dynamic/002.html
fast/dynamic/004.html
fast/dynamic/006.html
......
2010-10-11 Diego Gonzalez <diegohcg@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Mock DeviceOrientation client for DRT
https://bugs.webkit.org/show_bug.cgi?id=47490
* WebCore.pro:
2010-12-11 Joone Hur <joone@kldp.org>
Reviewed by Alexey Proskuryakov.
......
......@@ -3418,12 +3418,14 @@ contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \
../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.h \
../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h \
bindings/generic/RuntimeEnabledFeatures.h
SOURCES += \
../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp \
bindings/generic/RuntimeEnabledFeatures.cpp
......
2010-10-11 Diego Gonzalez <diegohcg@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Mock DeviceOrientation client for DRT
https://bugs.webkit.org/show_bug.cgi?id=47490
* WebCoreSupport/DeviceOrientationClientMockQt.cpp: Added.
(WebCore::DeviceOrientationClientMockQt::client):
(WebCore::DeviceOrientationClientMockQt::DeviceOrientationClientMockQt):
(WebCore::DeviceOrientationClientMockQt::~DeviceOrientationClientMockQt):
(WebCore::DeviceOrientationClientMockQt::setController):
(WebCore::DeviceOrientationClientMockQt::startUpdating):
(WebCore::DeviceOrientationClientMockQt::stopUpdating):
(WebCore::DeviceOrientationClientMockQt::lastOrientation):
(WebCore::DeviceOrientationClientMockQt::deviceOrientationControllerDestroyed):
(WebCore::DeviceOrientationClientMockQt::setOrientation):
* WebCoreSupport/DeviceOrientationClientMockQt.h: Added.
* WebCoreSupport/DeviceOrientationClientQt.cpp:
* WebCoreSupport/DeviceOrientationProviderQt.cpp:
(WebCore::DeviceOrientationProviderQt::DeviceOrientationProviderQt):
(WebCore::DeviceOrientationProviderQt::~DeviceOrientationProviderQt):
(WebCore::DeviceOrientationProviderQt::changeDeviceOrientation):
* WebCoreSupport/DeviceOrientationProviderQt.h:
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::activeMockDeviceOrientationClient):
(DumpRenderTreeSupportQt::removeMockDeviceOrientation):
(DumpRenderTreeSupportQt::setMockDeviceOrientation):
* WebCoreSupport/DumpRenderTreeSupportQt.h:
2010-12-10 Krithigassree Sambamurthy <krithigassree.sambamurthy@nokia.com>
Reviewed by Joseph Pecoraro.
......
/*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "config.h"
#include "DeviceOrientationClientMockQt.h"
#include "DeviceOrientation.h"
#include "DeviceOrientationClientMock.h"
#include "DeviceOrientationController.h"
namespace WebCore {
bool DeviceOrientationClientMockQt::mockIsActive = false;
DeviceOrientationClientMockQt* DeviceOrientationClientMockQt::client()
{
static DeviceOrientationClientMockQt* client = 0;
if (!client)
client = new DeviceOrientationClientMockQt;
return client;
}
DeviceOrientationClientMockQt::DeviceOrientationClientMockQt()
: m_clientMock(new DeviceOrientationClientMock())
{
m_orientation = DeviceOrientation::create();
}
DeviceOrientationClientMockQt::~DeviceOrientationClientMockQt()
{
delete m_clientMock;
}
void DeviceOrientationClientMockQt::setController(DeviceOrientationController* controller)
{
m_clientMock->setController(m_controller);
}
void DeviceOrientationClientMockQt::startUpdating()
{
m_clientMock->startUpdating();
}
void DeviceOrientationClientMockQt::stopUpdating()
{
m_clientMock->stopUpdating();
}
DeviceOrientation* DeviceOrientationClientMockQt::lastOrientation() const
{
return m_orientation.get();
}
void DeviceOrientationClientMockQt::deviceOrientationControllerDestroyed()
{
delete this;
}
void DeviceOrientationClientMockQt::setOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
{
m_orientation = DeviceOrientation::create(canProvideAlpha, alpha,
canProvideBeta, beta,
canProvideGamma, gamma);
m_clientMock->setOrientation(m_orientation);
emit mockOrientationChanged(m_orientation.get());
}
} // namespace WebCore
#include "moc_DeviceOrientationClientMockQt.cpp"
/*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef DeviceOrientationClientMockQt_h
#define DeviceOrientationClientMockQt_h
#include "DeviceOrientationClient.h"
#include "RefPtr.h"
#include <QObject>
namespace WebCore {
class DeviceOrientation;
class DeviceOrientationClientMock;
class DeviceOrientationController;
class DeviceOrientationClientMockQt : public QObject, public DeviceOrientationClient {
Q_OBJECT
public:
static DeviceOrientationClientMockQt* client();
virtual ~DeviceOrientationClientMockQt();
virtual void setController(DeviceOrientationController*);
virtual void startUpdating();
virtual void stopUpdating();
virtual DeviceOrientation* lastOrientation() const;
virtual void deviceOrientationControllerDestroyed();
void setOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
static bool mockIsActive;
Q_SIGNALS:
void mockOrientationChanged(DeviceOrientation*);
private:
DeviceOrientationClientMockQt();
DeviceOrientationClientMock* m_clientMock;
DeviceOrientationController* m_controller;
RefPtr<DeviceOrientation> m_orientation;
};
} // namespace WebCore
#endif // DeviceOrientationClientMockQt_h
......@@ -20,6 +20,7 @@
#include "config.h"
#include "DeviceOrientationClientQt.h"
#include "DeviceOrientationClientMockQt.h"
#include "DeviceOrientationController.h"
#include "DeviceOrientationProviderQt.h"
#include "qwebpage.h"
......
......@@ -20,16 +20,22 @@
#include "config.h"
#include "DeviceOrientationProviderQt.h"
#include "DeviceOrientationClientMockQt.h"
namespace WebCore {
DeviceOrientationProviderQt::DeviceOrientationProviderQt()
{
m_rotation.addFilter(this);
m_orientation = DeviceOrientation::create();
if (DeviceOrientationClientMockQt::mockIsActive)
activeClientMock();
}
DeviceOrientationProviderQt::~DeviceOrientationProviderQt()
{
disconnect();
}
void DeviceOrientationProviderQt::start()
......@@ -63,6 +69,16 @@ bool DeviceOrientationProviderQt::filter(QRotationReading* reading)
return false;
}
void DeviceOrientationProviderQt::changeDeviceOrientation(DeviceOrientation* orientation)
{
m_orientation = orientation;
}
void DeviceOrientationProviderQt::activeClientMock()
{
connect(DeviceOrientationClientMockQt::client(), SIGNAL(mockOrientationChanged(DeviceOrientation*)), SLOT(changeDeviceOrientation(DeviceOrientation*)));
}
}
#include "moc_DeviceOrientationProviderQt.cpp"
......@@ -48,7 +48,12 @@ public:
Q_SIGNALS:
void deviceOrientationChanged(DeviceOrientation*);
public Q_SLOTS:
void changeDeviceOrientation(DeviceOrientation*);
private:
void activeClientMock();
RefPtr<DeviceOrientation> m_orientation;
QRotationSensor m_rotation;
};
......
......@@ -29,6 +29,8 @@
#include "ContextMenu.h"
#include "ContextMenuClientQt.h"
#include "ContextMenuController.h"
#include "DeviceOrientation.h"
#include "DeviceOrientationClientMockQt.h"
#include "Editor.h"
#include "EditorClientQt.h"
#include "Element.h"
......@@ -693,6 +695,28 @@ QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, const QSize& ava
return res;
}
void DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(bool b)
{
#if ENABLE(DEVICE_ORIENTATION)
DeviceOrientationClientMockQt::mockIsActive = b;
#endif
}
void DumpRenderTreeSupportQt::removeMockDeviceOrientation()
{
#if ENABLE(DEVICE_ORIENTATION)
DeviceOrientationClientMockQt* client = DeviceOrientationClientMockQt::client();
delete client;
#endif
}
void DumpRenderTreeSupportQt::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
{
#if ENABLE(DEVICE_ORIENTATION)
DeviceOrientationClientMockQt::client()->setOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
#endif
}
void DumpRenderTreeSupportQt::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
#if ENABLE(GEOLOCATION)
......
......@@ -94,6 +94,10 @@ public:
static void removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
static void resetOriginAccessWhiteLists();
static void activeMockDeviceOrientationClient(bool b);
static void removeMockDeviceOrientation();
static void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
static void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
static void setMockGeolocationError(int errorCode, const QString& message);
......
2010-10-11 Diego Gonzalez <diegohcg@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Mock DeviceOrientation client for DRT
https://bugs.webkit.org/show_bug.cgi?id=47490
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::DumpRenderTree):
(WebCore::DumpRenderTree::~DumpRenderTree):
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::setMockDeviceOrientation):
2010-12-11 Philippe Normand <pnormand@igalia.com>
Reviewed by Gustavo Noronha Silva.
......
......@@ -420,7 +420,7 @@ DumpRenderTree::DumpRenderTree()
setGraphicsBased(true);
DumpRenderTreeSupportQt::overwritePluginDirectories();
DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(true);
QWebSettings::enablePersistentStorage(m_persistentStoragePath);
m_networkAccessManager = new NetworkAccessManager(this);
......@@ -496,6 +496,7 @@ DumpRenderTree::~DumpRenderTree()
{
delete m_mainView;
delete m_stdin;
DumpRenderTreeSupportQt::removeMockDeviceOrientation();
}
static void clearHistory(QWebPage* page)
......
......@@ -750,8 +750,7 @@ void LayoutTestController::setEditingBehavior(const QString& editingBehavior)
void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
{
// FIXME: Implement for DeviceOrientation layout tests.
// See https://bugs.webkit.org/show_bug.cgi?id=30335.
DumpRenderTreeSupportQt::setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
}
void LayoutTestController::setGeolocationPermission(bool allow)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment