Changeset 116299 in webkit


Ignore:
Timestamp:
May 7, 2012 4:49:00 AM (12 years ago)
Author:
kbalazs@webkit.org
Message:

[Qt] Add test specific platform plugin to achieve unified layout test results
https://bugs.webkit.org/show_bug.cgi?id=80996

Reviewed by Simon Hausmann.

Source/WebKit2:

Initialize the test platform plugin before initializing
the web process if we are in a WTR run.
It is necessary to place this initialization here as we
cannot control wich platform plugin will be used after
the instantiation of the QApplication.

  • qt/MainQt.cpp:

(initializeTestPlatformPluginForWTRIfRequired):
(main):

Tools:

Added QtTestPlatformPlugin as a new project under Tools.
This is a Qt5-ish platform plugin that can be used to tweak the
platform support interfaces in order to unify layout test results.
For now it only overrides the font database on Mac and redirects
everything else to the real platform plugin. The font database it
provides mimics the way how we set up test fonts with fontconfig on Linux.
Make DumpRenderTree and WebKitTestRunner use this platform plugin.

  • DumpRenderTree/qt/DumpRenderTree.pro:
  • DumpRenderTree/qt/main.cpp:

(initializeTestPlatformPlugin):
(main):

  • QtTestPlatformPlugin/QtTestPlatformPlugin.pro: Added.
  • QtTestPlatformPlugin/TestIntegration.cpp: Added.

(TestIntegration::TestIntegration):
(TestIntegration::fontDatabase):

  • QtTestPlatformPlugin/TestIntegration.h: Added.

(TestIntegration):
(TestIntegration::hasCapability):
(TestIntegration::createPlatformPixmap):
(TestIntegration::createPlatformWindow):
(TestIntegration::createPlatformBackingStore):
(TestIntegration::createPlatformOpenGLContext):
(TestIntegration::createPlatformSharedGraphicsCache):
(TestIntegration::guiThreadEventDispatcher):
(TestIntegration::clipboard):
(TestIntegration::drag):
(TestIntegration::inputContext):
(TestIntegration::accessibility):
(TestIntegration::nativeInterface):
(TestIntegration::services):
(TestIntegration::styleHint):
(TestIntegration::platformTheme):

  • QtTestPlatformPlugin/mac/TestFontDatabase.h: Added.

(TestFontDatabase):

  • QtTestPlatformPlugin/mac/TestFontDatabase.mm: Added.

(TestFontDatabase::populateFontDatabase):

  • QtTestPlatformPlugin/mac/TestIntegrationMac.mm: Added.

(TestIntegration::fontDatabase):

  • QtTestPlatformPlugin/main.cpp: Added.

(TestIntegrationPlugin::keys):
(TestIntegrationPlugin::create):
(TestIntegrationPlugin::initialize):

  • QtTestPlatformPlugin/testplatform.json: Added.
  • Tools.pro:
  • WebKitTestRunner/Target.pri:
  • WebKitTestRunner/qt/main.cpp:

(main):

Location:
trunk
Files:
10 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r116277 r116299  
     12012-05-07  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        [Qt] Add test specific platform plugin to achieve unified layout test results
     4        https://bugs.webkit.org/show_bug.cgi?id=80996
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Initialize the test platform plugin before initializing
     9        the web process if we are in a WTR run.
     10        It is necessary to place this initialization here as we
     11        cannot control wich platform plugin will be used after
     12        the instantiation of the QApplication.
     13
     14        * qt/MainQt.cpp:
     15        (initializeTestPlatformPluginForWTRIfRequired):
     16        (main):
     17
    1182012-05-06  MORITA Hajime  <morrita@google.com>
    219
  • trunk/Source/WebKit2/qt/MainQt.cpp

    r115958 r116299  
    2626
    2727#include <QApplication>
    28 
     28#include <QByteArray>
     29#include <QFile>
     30#include <QPlatformIntegration>
     31#include <QPlatformIntegrationPlugin>
     32#include <QPluginLoader>
    2933#include <stdio.h>
    3034
     
    4448}
    4549
     50static void initializeTestPlatformPluginForWTRIfRequired()
     51{
     52    QByteArray pluginPath = qgetenv("QT_WEBKIT2_TEST_PLATFORM_PLUGIN_PATH");
     53    if (pluginPath.isEmpty())
     54        return;
     55
     56    QPluginLoader loader(QFile::decodeName(pluginPath.data()));
     57    QPlatformIntegrationPlugin* plugin = qobject_cast<QPlatformIntegrationPlugin*>(loader.instance());
     58    if (!plugin)
     59        qFatal("cannot initialize test platform plugin\n");
     60
     61    qputenv("QT_QPA_PLATFORM_PLUGIN_PATH", pluginPath);
     62    qputenv("QT_QPA_PLATFORM", "testplatform");
     63}
     64
    4665// The framework entry point.
    4766// We call our platform specific entry point directly rather than WebKitMain because it makes little sense
     
    5776#endif
    5877
     78    initializeTestPlatformPluginForWTRIfRequired();
    5979    WebKit::initializeWebKit2Theme();
    6080
  • trunk/Tools/ChangeLog

    r116296 r116299  
     12012-05-07  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        [Qt] Add test specific platform plugin to achieve unified layout test results
     4        https://bugs.webkit.org/show_bug.cgi?id=80996
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Added QtTestPlatformPlugin as a new project under Tools.
     9        This is a Qt5-ish platform plugin that can be used to tweak the
     10        platform support interfaces in order to unify layout test results.
     11        For now it only overrides the font database on Mac and redirects
     12        everything else to the real platform plugin. The font database it
     13        provides mimics the way how we set up test fonts with fontconfig on Linux.
     14        Make DumpRenderTree and WebKitTestRunner use this platform plugin.
     15
     16        * DumpRenderTree/qt/DumpRenderTree.pro:
     17        * DumpRenderTree/qt/main.cpp:
     18        (initializeTestPlatformPlugin):
     19        (main):
     20        * QtTestPlatformPlugin/QtTestPlatformPlugin.pro: Added.
     21        * QtTestPlatformPlugin/TestIntegration.cpp: Added.
     22        (TestIntegration::TestIntegration):
     23        (TestIntegration::fontDatabase):
     24        * QtTestPlatformPlugin/TestIntegration.h: Added.
     25        (TestIntegration):
     26        (TestIntegration::hasCapability):
     27        (TestIntegration::createPlatformPixmap):
     28        (TestIntegration::createPlatformWindow):
     29        (TestIntegration::createPlatformBackingStore):
     30        (TestIntegration::createPlatformOpenGLContext):
     31        (TestIntegration::createPlatformSharedGraphicsCache):
     32        (TestIntegration::guiThreadEventDispatcher):
     33        (TestIntegration::clipboard):
     34        (TestIntegration::drag):
     35        (TestIntegration::inputContext):
     36        (TestIntegration::accessibility):
     37        (TestIntegration::nativeInterface):
     38        (TestIntegration::services):
     39        (TestIntegration::styleHint):
     40        (TestIntegration::platformTheme):
     41        * QtTestPlatformPlugin/mac/TestFontDatabase.h: Added.
     42        (TestFontDatabase):
     43        * QtTestPlatformPlugin/mac/TestFontDatabase.mm: Added.
     44        (TestFontDatabase::populateFontDatabase):
     45        * QtTestPlatformPlugin/mac/TestIntegrationMac.mm: Added.
     46        (TestIntegration::fontDatabase):
     47        * QtTestPlatformPlugin/main.cpp: Added.
     48        (TestIntegrationPlugin::keys):
     49        (TestIntegrationPlugin::create):
     50        (TestIntegrationPlugin::initialize):
     51        * QtTestPlatformPlugin/testplatform.json: Added.
     52        * Tools.pro:
     53        * WebKitTestRunner/Target.pri:
     54        * WebKitTestRunner/qt/main.cpp:
     55        (main):
     56
    1572012-05-07  Christophe Dumez  <christophe.dumez@intel.com>
    258
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro

    r114042 r116299  
    5858DEFINES += USE_SYSTEM_MALLOC=1
    5959
     60mac: LIB_SUFFIX=.dylib
     61win: LIB_SUFFIX=.dll
     62unix:!mac: LIB_SUFFIX=.so
     63DEFINES += TEST_PLATFORM_PLUGIN_PATH=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}lib$${QMAKE_DIR_SEP}libtestplatform$${LIB_SUFFIX}\\\"\"
     64
    6065RESOURCES = DumpRenderTree.qrc
  • trunk/Tools/DumpRenderTree/qt/main.cpp

    r108790 r116299  
    3232#include "QtInitializeTestFonts.h"
    3333
     34#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     35#include <QPlatformIntegration>
     36#include <QPlatformIntegrationPlugin>
     37#include <QPluginLoader>
     38#endif
     39
    3440#include <wtf/AlwaysInline.h>
    3541
     
    124130#endif
    125131
     132static void initializeTestPlatformPlugin(int argc, char* argv[] const)
     133{
     134#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
     135    QPluginLoader loader(TEST_PLATFORM_PLUGIN_PATH);
     136    QPlatformIntegrationPlugin* plugin = qobject_cast<QPlatformIntegrationPlugin*>(loader.instance());
     137    if (!plugin)
     138        qFatal("cannot initialize test platform plugin\n");
     139
     140    QByteArray platform = qgetenv("QT_QPA_PLATFORM");
     141    QByteArray platformPluginPath = qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH");
     142    for (int i = 0; i < argc; ++i) {
     143        if (QByteArray(argv[i]) == "-platform" && i + 1 < argc)
     144            platform = argv[i + 1];
     145        else if (QByteArray(argv[i]) == "-platformpluginpath" && i + 1 < argc)
     146            platformPluginPath = argv[i + 1];
     147    }
     148    if (!platform.isEmpty())
     149        qputenv("QT_WEBKIT_ORIGINAL_PLATFORM", platform);
     150    if (!platformPluginPath.isEmpty())
     151        qputenv("QT_WEBKIT_ORIGINAL_PLATFORM_PLUGIN_PATH", platformPluginPath);
     152
     153    qputenv("QT_QPA_PLATFORM_PLUGIN_PATH", TEST_PLATFORM_PLUGIN_PATH);
     154    qputenv("QT_QPA_PLATFORM", "testplatform");
     155#endif
     156}
     157
    126158int main(int argc, char* argv[])
    127159{
     
    146178
    147179    WebKit::initializeTestFonts();
     180
     181    initializeTestPlatformPlugin(argc, argv);
    148182
    149183    QApplication::setGraphicsSystem("raster");
  • trunk/Tools/Tools.pro

    r116107 r116299  
    1313SUBDIRS += DumpRenderTree/qt/DumpRenderTree.pro
    1414SUBDIRS += DumpRenderTree/qt/ImageDiff.pro
     15
     16haveQt(5): SUBDIRS += QtTestPlatformPlugin/QtTestPlatformPlugin.pro
    1517
    1618!no_webkit2 {
  • trunk/Tools/WebKitTestRunner/Target.pri

    r113172 r116299  
    3838*-clang*:QMAKE_CXXFLAGS += "-include $$PREFIX_HEADER"
    3939
     40mac: LIB_SUFFIX=.dylib
     41win: LIB_SUFFIX=.dll
     42unix:!mac: LIB_SUFFIX=.so
     43DEFINES += TEST_PLATFORM_PLUGIN_PATH=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}lib$${QMAKE_DIR_SEP}libtestplatform$${LIB_SUFFIX}\\\"\"
     44
    4045RESOURCES = qt/WebKitTestRunner.qrc
  • trunk/Tools/WebKitTestRunner/qt/main.cpp

    r115958 r116299  
    103103    qputenv("QT_WEBKIT_THEME_NAME", "qstyle");
    104104
     105    QByteArray platform = qgetenv("QT_QPA_PLATFORM");
     106    QByteArray platformPluginPath = qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH");
     107    for (int i = 0; i < argc; ++i) {
     108        if (QByteArray(argv[i]) == "-platform" && i + 1 < argc)
     109            platform = argv[i + 1];
     110        else if (QByteArray(argv[i]) == "-platformpluginpath" && i + 1 < argc)
     111            platformPluginPath = argv[i + 1];
     112    }
     113    if (!platform.isEmpty())
     114        qputenv("QT_WEBKIT_ORIGINAL_PLATFORM", platform);
     115    if (!platformPluginPath.isEmpty())
     116        qputenv("QT_WEBKIT_ORIGINAL_PLATFORM_PLUGIN_PATH", platformPluginPath);
     117
     118    // Tell the web process that we want to use the test platform plugin.
     119    qputenv("QT_WEBKIT2_TEST_PLATFORM_PLUGIN_PATH", TEST_PLATFORM_PLUGIN_PATH);
     120
    105121    QQuickWebViewExperimental::setFlickableViewportEnabled(false);
    106122    QApplication app(argc, argv);
Note: See TracChangeset for help on using the changeset viewer.