Changeset 87760 in webkit


Ignore:
Timestamp:
May 31, 2011 4:35:34 PM (13 years ago)
Author:
Martin Robinson
Message:

2011-03-30 Martin Robinson <mrobinson@igalia.com>

Reviewed by Adam Roben.

[GTK] [WebKit2] Implement a basic WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=57068

  • GNUmakefile.am: Added reference to WebKitTestRunner GNUmakefile.

2011-03-30 Martin Robinson <mrobinson@igalia.com>

Reviewed by Adam Roben.

[GTK] [WebKit2] Implement a basic WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=57068

Added InjectedBundle support for GTK+.

  • WebProcess/InjectedBundle/InjectedBundle.h: Added typedef for GTK+.
  • WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp: Added implementation. (WebKit::InjectedBundle::load): (WebKit::InjectedBundle::activateMacFontAscentHack):
  • WebProcess/WebPage/gtk/WebPageGtk.cpp: Remove unnecessary method definition.

2011-03-30 Martin Robinson <mrobinson@igalia.com>

Reviewed by Adam Roben.

[GTK] [WebKit2] Implement a basic WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=57068

Add an implementation of WebKitTestRunner for GTK+.

  • Scripts/build-webkittestrunner: Added knowledge of GTK+ TestRunner.
  • Scripts/old-run-webkit-tests: Ditto.
  • Scripts/run-launcher: Ditto.
  • Scripts/webkitdirs.pm: Ditto.
  • WebKitTestRunner/GNUmakefile.am: Added.
  • WebKitTestRunner/InjectedBundle/LayoutTestController.h:
  • WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp: Added.
  • WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp.
  • WebKitTestRunner/InjectedBundle/gtk/LayoutTestControllerGtk.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp.
  • WebKitTestRunner/PlatformWebView.h:
  • WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: Added.
  • WebKitTestRunner/gtk/TestControllerGtk.cpp: Added.
  • WebKitTestRunner/gtk/TestInvocationGtk.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp. (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
  • WebKitTestRunner/gtk/main.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp. (main): Added.
Location:
trunk
Files:
6 added
11 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r87742 r87760  
     12011-03-30  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        [GTK] [WebKit2] Implement a basic WebKitTestRunner
     6        https://bugs.webkit.org/show_bug.cgi?id=57068
     7
     8        * GNUmakefile.am: Added reference to WebKitTestRunner GNUmakefile.
     9
    1102011-05-31  Xan Lopez  <xlopez@igalia.com>
    211
  • trunk/GNUmakefile.am

    r85595 r87760  
    199199include Source/WebKit2/GNUmakefile.am
    200200include Tools/MiniBrowser/gtk/GNUmakefile.am
     201include Tools/WebKitTestRunner/GNUmakefile.am
    201202# [GTK] Refactor the translations now that we have webkit2
    202203# https://bugs.webkit.org/show_bug.cgi?id=55153
  • trunk/Source/WebKit2/ChangeLog

    r87755 r87760  
     12011-03-30  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        [GTK] [WebKit2] Implement a basic WebKitTestRunner
     6        https://bugs.webkit.org/show_bug.cgi?id=57068
     7
     8        Added InjectedBundle support for GTK+.
     9
     10        * WebProcess/InjectedBundle/InjectedBundle.h: Added typedef for GTK+.
     11        * WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp: Added implementation.
     12        (WebKit::InjectedBundle::load):
     13        (WebKit::InjectedBundle::activateMacFontAscentHack):
     14        * WebProcess/WebPage/gtk/WebPageGtk.cpp: Remove unnecessary method definition.
     15
    1162011-05-31  Dan Bernstein  <mitz@apple.com>
    217
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h

    r87452 r87760  
    4040#endif
    4141
     42#if PLATFORM(GTK)
     43typedef struct _GModule GModule;
     44#endif
     45
    4246namespace CoreIPC {
    4347    class ArgumentDecoder;
     
    5559typedef QLibrary PlatformBundle;
    5660#elif PLATFORM(GTK)
    57 typedef void* PlatformBundle;
     61typedef ::GModule* PlatformBundle;
    5862#endif
    5963
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp

    r82370 r87760  
    3030#include "WKBundleAPICast.h"
    3131#include "WKBundleInitialize.h"
    32 #include <WebCore/NotImplemented.h>
     32#include <WebCore/FileSystem.h>
     33#include <wtf/text/CString.h>
    3334
    3435using namespace WebCore;
     
    3637namespace WebKit {
    3738
    38 bool InjectedBundle::load(APIObject*)
     39bool InjectedBundle::load(APIObject* initializationUserData)
    3940{
    40     return false;
     41    m_platformBundle = g_module_open(fileSystemRepresentation(m_path).data(), G_MODULE_BIND_LOCAL);
     42    if (!m_platformBundle) {
     43        g_warning("Error loading the injected bundle (%s): %s", m_path.utf8().data(), g_module_error());
     44        return false;
     45    }
     46
     47    WKBundleInitializeFunctionPtr initializeFunction = 0;
     48    if (!g_module_symbol(m_platformBundle, "WKBundleInitialize", reinterpret_cast<void**>(&initializeFunction)) || !initializeFunction) {
     49        g_warning("Error loading WKBundleInitialize symbol from injected bundle.");
     50        return false;
     51    }
     52
     53    initializeFunction(toAPI(this), toAPI(initializationUserData));
     54    return true;
    4155}
    4256
    4357void InjectedBundle::activateMacFontAscentHack()
    4458{
    45     notImplemented();
    4659}
    4760
  • trunk/Tools/ChangeLog

    r87757 r87760  
     12011-03-30  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        [GTK] [WebKit2] Implement a basic WebKitTestRunner
     6        https://bugs.webkit.org/show_bug.cgi?id=57068
     7
     8        Add an implementation of WebKitTestRunner for GTK+.
     9
     10        * Scripts/build-webkittestrunner: Added knowledge of GTK+ TestRunner.
     11        * Scripts/old-run-webkit-tests: Ditto.
     12        * Scripts/run-launcher: Ditto.
     13        * Scripts/webkitdirs.pm: Ditto.
     14        * WebKitTestRunner/GNUmakefile.am: Added.
     15        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
     16        * WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp: Added.
     17        * WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp.
     18        * WebKitTestRunner/InjectedBundle/gtk/LayoutTestControllerGtk.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp.
     19        * WebKitTestRunner/PlatformWebView.h:
     20        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp: Added.
     21        * WebKitTestRunner/gtk/TestControllerGtk.cpp: Added.
     22        * WebKitTestRunner/gtk/TestInvocationGtk.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp.
     23        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
     24        * WebKitTestRunner/gtk/main.cpp: Copied from Source/WebKit2/WebProcess/InjectedBundle/gtk/InjectedBundleGtk.cpp.
     25        (main): Added.
     26
    1272011-05-31  Dirk Pranke  <dpranke@chromium.org>
    228
  • trunk/Tools/Scripts/build-webkittestrunner

    r74301 r87760  
    6464} elsif (isAppleWinWebKit()) {
    6565    $result = buildVisualStudioProject("WebKitTestRunner.sln", $clean);
    66 } elsif (isQt()) {
    67     # Qt builds everything in one shot. No need to build anything here.
     66} elsif (isQt() || isGtk()) {
     67    # Qt and GTK+ build everything in one shot. No need to build anything here.
    6868    $result = 0;
    6969} else {
  • trunk/Tools/Scripts/old-run-webkit-tests

    r87189 r87760  
    389389        $realPlatform = $platform;
    390390        $platform = "qt-wk2";
     391    } elsif (isGtk()) {
     392        $realPlatform = $platform;
     393        $platform = "gtk-wk2";
    391394    }
    392395}
     
    11751178
    11761179if (isGtk()) {
     1180  push(@configurationArgs, '-2') if $useWebKitTestRunner;
    11771181  system "Tools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;
    11781182} elsif (isQt()) {
     
    14771481        $CLEAN_ENV{GTK_MODULES} = "gail";
    14781482        $CLEAN_ENV{WEBKIT_INSPECTOR_PATH} = "$productDir/resources/inspector";
     1483
     1484        if ($useWebKitTestRunner) {
     1485            my $injectedBundlePath = productDir() . "/Libraries/.libs/libTestRunnerInjectedBundle";
     1486            $CLEAN_ENV{TEST_RUNNER_INJECTED_BUNDLE_FILENAME} = $injectedBundlePath;
     1487        }
    14791488    }
    14801489
     
    21352144        push @platforms, $platform;
    21362145        push @platforms, "qt";
     2146    } elsif ($platform =~ /^gtk-/) {
     2147        push @platforms, $platform;
     2148        push @platforms, "gtk";
    21372149    } else {
    21382150        @platforms = $platform;
  • trunk/Tools/Scripts/webkitdirs.pm

    r86141 r87760  
    629629    }
    630630    if (isGtk()) {
    631         my $libraryDir = "$configurationProductDir/.libs/";
    632         my $extension = isDarwin() ? "dylib" : "so";
    633         if (-e $libraryDir . "libwebkitgtk-3.0.$extension") {
    634             return $libraryDir . "libwebkitgtk-3.0.$extension";
    635         }
    636         return $libraryDir . "libwebkitgtk-1.0.$extension";
     631        # WebKitGTK+ for GTK2, WebKitGTK+ for GTK3, and WebKit2 respectively.
     632        my @libraries = ("libwebkitgtk-1.0", "libwebkitgtk-3.0", "libwebkit2gtk-1.0");
     633        my $extension = isDarwin() ? ".dylib" : ".so";
     634
     635        foreach $libraryName (@libraries) {
     636            my $libraryPath = "$configurationProductDir/.libs/" . $libraryName . $extension;
     637            return $libraryPath if -e $libraryPath;
     638        }
     639        return "NotFound";
    637640    }
    638641    if (isEfl()) {
     
    19911994            return system $webKitTestRunnerPath, @ARGV;
    19921995        }
     1996    } elsif (isGtk()) {
     1997        my $productDir = productDir();
     1998        my $injectedBundlePath = "$productDir/Libraries/.libs/libTestRunnerInjectedBundle";
     1999        print "Starting WebKitTestRunner with TEST_RUNNER_INJECTED_BUNDLE_FILENAME set to point to $injectedBundlePath.\n";
     2000        $ENV{TEST_RUNNER_INJECTED_BUNDLE_FILENAME} = $injectedBundlePath;
     2001        my @args = ("$productDir/Programs/WebKitTestRunner", @ARGV);
     2002        return system {$args[0] } @args;
    19932003    }
    19942004
  • trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h

    r87452 r87760  
    4242#include <QTimer>
    4343typedef QTimer PlatformTimerRef;
     44#elif PLATFORM(GTK)
     45typedef unsigned int PlatformTimerRef;
    4446#endif
    4547
  • trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleGtk.cpp

    r87758 r87760  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
    3  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
     2 * Copyright (C) 2011 Apple Inc. All rights reserved.
     3 * Copyright (C) 2011 Igalia S.L.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    2828#include "InjectedBundle.h"
    2929
    30 #include "WKBundleAPICast.h"
    31 #include "WKBundleInitialize.h"
    32 #include <WebCore/NotImplemented.h>
     30#include <cstdio>
     31#include <glib.h>
    3332
    34 using namespace WebCore;
     33namespace WTR {
    3534
    36 namespace WebKit {
    37 
    38 bool InjectedBundle::load(APIObject*)
     35static void logHandler(const gchar* domain, GLogLevelFlags level, const gchar* message, gpointer data)
    3936{
    40     return false;
     37    if (level < G_LOG_LEVEL_DEBUG)
     38        fprintf(stderr, "%s\n", message);
    4139}
    4240
    43 void InjectedBundle::activateMacFontAscentHack()
     41void InjectedBundle::platformInitialize(WKTypeRef)
    4442{
    45     notImplemented();
     43    // Some plugins might try to use the GLib logger for printing debug messages. This
     44    // will cause tests to fail because of unexpected output. We squelch all debug
     45    // messages sent to the logger.
     46    g_log_set_default_handler(logHandler, 0);
    4647}
    4748
    48 } // namespace WebKit
     49} // namespace WTR
  • trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/LayoutTestControllerGtk.cpp

    r87758 r87760  
    11/*
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
    3  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
     3 * Copyright (C) 2011 Igalia S.L.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    2626
    2727#include "config.h"
     28#include "LayoutTestController.h"
     29
    2830#include "InjectedBundle.h"
     31#include <glib.h>
    2932
    30 #include "WKBundleAPICast.h"
    31 #include "WKBundleInitialize.h"
    32 #include <WebCore/NotImplemented.h>
     33namespace WTR {
    3334
    34 using namespace WebCore;
    35 
    36 namespace WebKit {
    37 
    38 bool InjectedBundle::load(APIObject*)
     35static gboolean waitToDumpWatchdogTimerCallback(gpointer)
    3936{
    40     return false;
     37    InjectedBundle::shared().layoutTestController()->waitToDumpWatchdogTimerFired();
     38    return FALSE;
    4139}
    4240
    43 void InjectedBundle::activateMacFontAscentHack()
     41void LayoutTestController::platformInitialize()
    4442{
    45     notImplemented();
     43    m_waitToDumpWatchdogTimer = 0;
    4644}
    4745
    48 } // namespace WebKit
     46void LayoutTestController::invalidateWaitToDumpWatchdogTimer()
     47{
     48    if (!m_waitToDumpWatchdogTimer)
     49        return;
     50    g_source_remove(m_waitToDumpWatchdogTimer);
     51    m_waitToDumpWatchdogTimer = 0;
     52}
     53
     54void LayoutTestController::initializeWaitToDumpWatchdogTimerIfNeeded()
     55{
     56    if (m_waitToDumpWatchdogTimer)
     57        return;
     58
     59    m_waitToDumpWatchdogTimer = g_timeout_add(waitToDumpWatchdogTimerInterval * 1000,
     60                                              waitToDumpWatchdogTimerCallback, 0);
     61}
     62
     63JSRetainPtr<JSStringRef> LayoutTestController::pathToLocalResource(JSStringRef url)
     64{
     65    return url;
     66}
     67
     68} // namespace WTR
  • trunk/Tools/WebKitTestRunner/PlatformWebView.h

    r73976 r87760  
    4747typedef WKViewRef PlatformWKView;
    4848typedef HWND PlatformWindow;
     49#elif defined(BUILDING_GTK__)
     50typedef struct _GtkWidget GtkWidget;
     51typedef WKViewRef PlatformWKView;
     52typedef GtkWidget* PlatformWindow;
    4953#endif
    5054
  • trunk/Tools/WebKitTestRunner/gtk/TestInvocationGtk.cpp

    r87758 r87760  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
    3  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
     2 * Copyright (C) 2011 Apple Inc. All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    2625
    2726#include "config.h"
    28 #include "InjectedBundle.h"
     27#include "TestInvocation.h"
    2928
    30 #include "WKBundleAPICast.h"
    31 #include "WKBundleInitialize.h"
    32 #include <WebCore/NotImplemented.h>
     29namespace WTR {
    3330
    34 using namespace WebCore;
    35 
    36 namespace WebKit {
    37 
    38 bool InjectedBundle::load(APIObject*)
     31void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image)
    3932{
    40     return false;
    4133}
    4234
    43 void InjectedBundle::activateMacFontAscentHack()
    44 {
    45     notImplemented();
    46 }
    47 
    48 } // namespace WebKit
     35} // namespace WTR
  • trunk/Tools/WebKitTestRunner/gtk/main.cpp

    r87758 r87760  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
    3  * Portions Copyright (c) 2010 Motorola Mobility, Inc.  All rights reserved.
     2 * Copyright (C) 2011 Igalia S.L.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    2625
    2726#include "config.h"
    28 #include "InjectedBundle.h"
    2927
    30 #include "WKBundleAPICast.h"
    31 #include "WKBundleInitialize.h"
    32 #include <WebCore/NotImplemented.h>
     28#include "TestController.h"
     29#include <gtk/gtk.h>
    3330
    34 using namespace WebCore;
    35 
    36 namespace WebKit {
    37 
    38 bool InjectedBundle::load(APIObject*)
     31int main(int argc, char** argv)
    3932{
    40     return false;
     33    gtk_init(&argc, &argv);
     34    WTR::TestController controller(argc, const_cast<const char**>(argv));
     35    return 0;
    4136}
    42 
    43 void InjectedBundle::activateMacFontAscentHack()
    44 {
    45     notImplemented();
    46 }
    47 
    48 } // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.