Skip to content

Commit ee02f19

Browse files
committed
[GTK] Build and run TestWebKitAPI WebKit2 unit tests
https://bugs.webkit.org/show_bug.cgi?id=84446 Reviewed by Philippe Normand. Source/ThirdParty: * gtest/GNUmakefile.am: Do not build libgtestmain anymmore since all tests use now a custom main to make sure WTF threads are initialized. Source/WebKit2: * UIProcess/API/C/WKNativeEvent.h: Define WKNativeEventPtr as GdkEvent for the GTK+ port. Tools: * Scripts/run-gtk-tests: (TestRunner): Add TestWebKitAPI/WebKit2 to the list of directories containing tests. Unskip FunctionalTest.RefCountedStorage, since we are now using a custom main that initializes WTF threading. (TestRunner._setup_testing_environment): Set environment variables required to run WebKit2 tests. * TestWebKitAPI/GNUmakefile.am: * TestWebKitAPI/JavaScriptTest.cpp: Use JavaScriptCore/JSContextRef.h instead of JavaScriptCore/JavaScriptCore.h since it includes JSStringRefCF.h unconditionally. * TestWebKitAPI/PlatformWebView.h: Define PlatformWKView and PlatformWindow for GTK. * TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp: Remove unneded header that breaks the build of GTK port. * TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp: Use JavaScriptCore/JSContextRef.h instead of JavaScriptCore/JavaScriptCore.h since it includes JSStringRefCF.h unconditionally. * TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp: (TestWebKitAPI::TEST): Add expected values for GTK+ port. * TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp: (TestWebKitAPI): (TestWebKitAPI::InjectedBundleController::platformInitialize): * TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp: Added. (TestWebKitAPI::Util::checkTestFinished): (TestWebKitAPI::Util::run): (TestWebKitAPI::Util::sleep): (TestWebKitAPI::Util::getFilenameFromEnvironmentVariableAsUTF8): (TestWebKitAPI::Util::createInjectedBundlePath): (TestWebKitAPI::Util::createURLForResource): (TestWebKitAPI::Util::URLForNonExistentResource): (TestWebKitAPI::Util::isKeyDown): * TestWebKitAPI/gtk/PlatformWebViewGtk.cpp: Added. (TestWebKitAPI::PlatformWebView::PlatformWebView): (TestWebKitAPI::PlatformWebView::~PlatformWebView): (TestWebKitAPI::PlatformWebView::page): (TestWebKitAPI::PlatformWebView::resizeTo): (TestWebKitAPI::doKeyStroke): (TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress): (TestWebKitAPI::PlatformWebView::simulateAltKeyPress): (TestWebKitAPI::doMouseButtonEvent): (TestWebKitAPI::PlatformWebView::simulateRightClick): (TestWebKitAPI::PlatformWebView::simulateMouseMove): * TestWebKitAPI/gtk/main.cpp: (main): Canonical link: https://commits.webkit.org/102463@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 9025220 commit ee02f19

16 files changed

Lines changed: 756 additions & 28 deletions

Source/ThirdParty/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2012-04-26 Carlos Garcia Campos <[email protected]>
2+
3+
[GTK] Build and run TestWebKitAPI WebKit2 unit tests
4+
https://bugs.webkit.org/show_bug.cgi?id=84446
5+
6+
Reviewed by Philippe Normand.
7+
8+
* gtest/GNUmakefile.am: Do not build libgtestmain anymmore since
9+
all tests use now a custom main to make sure WTF threads are
10+
initialized.
11+
112
2012-04-24 Carlos Garcia Campos <[email protected]>
213

314
[GTK] Build and run TestWebKitAPI unit tests

Source/ThirdParty/gtest/GNUmakefile.am

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
noinst_LTLIBRARIES += \
3-
Libraries/libgtest.la \
4-
Libraries/libgtest_main.la
3+
Libraries/libgtest.la
54

65
Libraries_libgtest_la_SOURCES = \
76
Source/ThirdParty/gtest/include/gtest/gtest.h \
@@ -41,23 +40,6 @@ Libraries_libgtest_la_CXXFLAGS = -DGTEST_HAS_PTHREAD=1
4140
Libraries_libgtest_la_LIBADD = \
4241
-lpthread
4342

44-
Libraries_libgtest_main_la_SOURCES = \
45-
Source/ThirdParty/gtest/src/gtest_main.cc
46-
47-
Libraries_libgtest_main_la_CPPFLAGS = \
48-
$(global_cppflags) \
49-
$(javascriptcore_cppflags) \
50-
-isystem $(srcdir)/Source/ThirdParty/gtest \
51-
-isystem $(srcdir)/Source/ThirdParty/gtest/include \
52-
-I$(srcdir)/Source/WTF \
53-
-I$(srcdir)/Source/ThirdParty/gtest \
54-
-I$(srcdir)/Source/ThirdParty/gtest/include
55-
56-
Libraries_libgtest_main_la_LIBADD = \
57-
-lpthread
58-
59-
Libraries_libgtest_main_la_CXXFLAGS = -DGTEST_HAS_PTHREAD=1
60-
6143
# gtest source files that we don't compile directly. They are
6244
# #included by gtest-all.cc.
6345
GTEST_SRC = \

Source/WebKit2/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2012-04-26 Carlos Garcia Campos <[email protected]>
2+
3+
[GTK] Build and run TestWebKitAPI WebKit2 unit tests
4+
https://bugs.webkit.org/show_bug.cgi?id=84446
5+
6+
Reviewed by Philippe Normand.
7+
8+
* UIProcess/API/C/WKNativeEvent.h: Define WKNativeEventPtr as
9+
GdkEvent for the GTK+ port.
10+
111
2012-04-26 Andras Becsi <[email protected]>
212

313
[Qt][WK2] Tap highlight should have a delay not to interfere with panning

Source/WebKit2/UIProcess/API/C/WKNativeEvent.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ struct NSEvent;
4141
typedef NSEvent *WKNativeEventPtr;
4242
#elif defined(WIN32) || defined(_WIN32)
4343
typedef const struct tagMSG* WKNativeEventPtr;
44+
#elif defined(BUILDING_GTK__)
45+
typedef union _GdkEvent GdkEvent;
46+
typedef const GdkEvent* WKNativeEventPtr;
4447
#else
4548
typedef const void* WKNativeEventPtr;
4649
#endif

Tools/ChangeLog

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
2012-04-26 Carlos Garcia Campos <[email protected]>
2+
3+
[GTK] Build and run TestWebKitAPI WebKit2 unit tests
4+
https://bugs.webkit.org/show_bug.cgi?id=84446
5+
6+
Reviewed by Philippe Normand.
7+
8+
* Scripts/run-gtk-tests:
9+
(TestRunner): Add TestWebKitAPI/WebKit2 to the list of directories
10+
containing tests. Unskip FunctionalTest.RefCountedStorage, since
11+
we are now using a custom main that initializes WTF threading.
12+
(TestRunner._setup_testing_environment): Set environment variables
13+
required to run WebKit2 tests.
14+
* TestWebKitAPI/GNUmakefile.am:
15+
* TestWebKitAPI/JavaScriptTest.cpp: Use
16+
JavaScriptCore/JSContextRef.h instead of
17+
JavaScriptCore/JavaScriptCore.h since it includes JSStringRefCF.h
18+
unconditionally.
19+
* TestWebKitAPI/PlatformWebView.h: Define PlatformWKView and
20+
PlatformWindow for GTK.
21+
* TestWebKitAPI/Tests/WebKit2/EvaluateJavaScript.cpp: Remove
22+
unneded header that breaks the build of GTK port.
23+
* TestWebKitAPI/Tests/WebKit2/PreventEmptyUserAgent.cpp: Use
24+
JavaScriptCore/JSContextRef.h instead of
25+
JavaScriptCore/JavaScriptCore.h since it includes JSStringRefCF.h
26+
unconditionally.
27+
* TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp:
28+
(TestWebKitAPI::TEST): Add expected values for GTK+ port.
29+
* TestWebKitAPI/gtk/InjectedBundleControllerGtk.cpp:
30+
(TestWebKitAPI):
31+
(TestWebKitAPI::InjectedBundleController::platformInitialize):
32+
* TestWebKitAPI/gtk/PlatformUtilitiesGtk.cpp: Added.
33+
(TestWebKitAPI::Util::checkTestFinished):
34+
(TestWebKitAPI::Util::run):
35+
(TestWebKitAPI::Util::sleep):
36+
(TestWebKitAPI::Util::getFilenameFromEnvironmentVariableAsUTF8):
37+
(TestWebKitAPI::Util::createInjectedBundlePath):
38+
(TestWebKitAPI::Util::createURLForResource):
39+
(TestWebKitAPI::Util::URLForNonExistentResource):
40+
(TestWebKitAPI::Util::isKeyDown):
41+
* TestWebKitAPI/gtk/PlatformWebViewGtk.cpp: Added.
42+
(TestWebKitAPI::PlatformWebView::PlatformWebView):
43+
(TestWebKitAPI::PlatformWebView::~PlatformWebView):
44+
(TestWebKitAPI::PlatformWebView::page):
45+
(TestWebKitAPI::PlatformWebView::resizeTo):
46+
(TestWebKitAPI::doKeyStroke):
47+
(TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
48+
(TestWebKitAPI::PlatformWebView::simulateAltKeyPress):
49+
(TestWebKitAPI::doMouseButtonEvent):
50+
(TestWebKitAPI::PlatformWebView::simulateRightClick):
51+
(TestWebKitAPI::PlatformWebView::simulateMouseMove):
52+
* TestWebKitAPI/gtk/main.cpp:
53+
(main):
54+
155
2012-04-26 Carlos Garcia Campos <[email protected]>
256

357
[GTK] run-gtk-tests: Use a timeout per test instead of a global timeout

Tools/Scripts/run-gtk-tests

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TestTimeout(Exception):
4646

4747
class TestRunner:
4848

49-
TEST_DIRS = [ "unittests", "WebKit2APITests", "TestWebKitAPI/WTF" ]
49+
TEST_DIRS = [ "unittests", "WebKit2APITests", "TestWebKitAPI/WTF", "TestWebKitAPI/WebKit2" ]
5050

5151
SKIPPED = [
5252
SkippedTest("unittests/testdownload",
@@ -73,10 +73,16 @@ class TestRunner:
7373
"Test is flaky in GTK Linux 32-bit Release bot",
7474
82868,
7575
["/webkit2/WebKitWebView/resources"]),
76-
SkippedTest("TestWebKitAPI/WTF/TestFunctional",
77-
"Asserts in Debug bot",
78-
84868,
79-
["FunctionalTest.RefCountedStorage"]),
76+
SkippedTest("TestWebKitAPI/WebKit2/TestNewFirstVisuallyNonEmptyLayout",
77+
"Test times out"),
78+
SkippedTest("TestWebKitAPI/WebKit2/TestNewFirstVisuallyNonEmptyLayoutForImages",
79+
"Test times out"),
80+
SkippedTest("TestWebKitAPI/WebKit2/TestWKConnectionTest",
81+
"Test times out"),
82+
SkippedTest("TestWebKitAPI/WebKit2/TestRestoreSessionStateContainingFormData",
83+
"Session State is not implemented in GTK+ port"),
84+
SkippedTest("TestWebKitAPI/WebKit2/TestSpacebarScrolling",
85+
"Test fails")
8086
]
8187

8288
def __init__(self, options, tests=[]):
@@ -193,6 +199,9 @@ class TestRunner:
193199
self._test_env["DISPLAY"] = self._options.display
194200
self._test_env["WEBKIT_INSPECTOR_PATH"] = os.path.abspath(os.path.join(self._programs_path, 'resources', 'inspector'))
195201
self._test_env['GSETTINGS_BACKEND'] = 'memory'
202+
self._test_env["TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"] = os.path.join(self._get_top_level_directory(), "Tools", "TestWebKitAPI", "Tests", "WebKit2")
203+
self._test_env["TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"] = os.path.abspath(os.path.join(self._get_build_directory(), "Libraries"))
204+
self._test_env["WEBKIT_EXEC_PATH"] = self._programs_path
196205

197206
try:
198207
self._xvfb = self._create_process(["Xvfb", self._options.display, "-screen", "0", "800x600x24", "-nolisten", "tcp"],

0 commit comments

Comments
 (0)