| Differences between
and this patch
- a/Tools/ChangeLog +38 lines
Lines 1-5 a/Tools/ChangeLog_sec1
1
2012-07-18  Thiago Marcos P. Santos  <thiago.santos@intel.com>
1
2012-07-18  Thiago Marcos P. Santos  <thiago.santos@intel.com>
2
2
3
        [CMake][EFL] Build and run TestWebKitAPI unit tests
4
        https://bugs.webkit.org/show_bug.cgi?id=90671
5
6
        Reviewed by Daniel Bates.
7
8
        This patch enables almost for free a significant amount of test for the
9
        WebKit C API, WTF and KURL. It makes easy for CMake based ports to
10
        enable TestWebKitAPI since the missing bits to implement are
11
        relatively simple.
12
13
        * CMakeLists.txt:
14
        * TestWebKitAPI/CMakeLists.txt: Added.
15
        * TestWebKitAPI/PlatformEfl.cmake: Added.
16
        * TestWebKitAPI/PlatformWebView.h:
17
        * TestWebKitAPI/config.h:
18
        * TestWebKitAPI/efl/InjectedBundleController.cpp: Added.
19
        (TestWebKitAPI):
20
        (TestWebKitAPI::InjectedBundleController::platformInitialize):
21
        * TestWebKitAPI/efl/PlatformUtilities.cpp: Added.
22
        (TestWebKitAPI):
23
        (Util):
24
        (TestWebKitAPI::Util::run):
25
        (TestWebKitAPI::Util::sleep):
26
        (TestWebKitAPI::Util::createURLForResource):
27
        (TestWebKitAPI::Util::createInjectedBundlePath):
28
        (TestWebKitAPI::Util::URLForNonExistentResource):
29
        * TestWebKitAPI/efl/PlatformWebView.cpp: Added.
30
        (TestWebKitAPI):
31
        (TestWebKitAPI::initEcoreEvas):
32
        (TestWebKitAPI::PlatformWebView::PlatformWebView):
33
        (TestWebKitAPI::PlatformWebView::~PlatformWebView):
34
        (TestWebKitAPI::PlatformWebView::page):
35
        * TestWebKitAPI/efl/main.cpp: Added.
36
        (checkForUseX11WindowArgument):
37
        (main):
38
39
2012-07-18  Thiago Marcos P. Santos  <thiago.santos@intel.com>
40
3
        [CMake][EFL] Building jsc causes reconfiguration
41
        [CMake][EFL] Building jsc causes reconfiguration
4
        https://bugs.webkit.org/show_bug.cgi?id=91387
42
        https://bugs.webkit.org/show_bug.cgi?id=91387
5
43
- a/Tools/CMakeLists.txt +4 lines
Lines 14-16 IF ("${PORT}" STREQUAL "Efl") a/Tools/CMakeLists.txt_sec1
14
ELSEIF ("${PORT}" STREQUAL "WinCE")
14
ELSEIF ("${PORT}" STREQUAL "WinCE")
15
    ADD_SUBDIRECTORY(WinCELauncher)
15
    ADD_SUBDIRECTORY(WinCELauncher)
16
ENDIF()
16
ENDIF()
17
18
IF (ENABLE_WEBKIT2 AND ENABLE_API_TESTS)
19
    ADD_SUBDIRECTORY(TestWebKitAPI)
20
ENDIF()
- a/Tools/TestWebKitAPI/CMakeLists.txt +135 lines
Line 0 a/Tools/TestWebKitAPI/CMakeLists.txt_sec1
1
SET(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
2
3
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}
4
    ${TESTWEBKITAPI_DIR}
5
    ${CMAKE_SOURCE_DIR}/Source
6
    ${DERIVED_SOURCES_WEBKIT2_DIR}/include
7
    ${JAVASCRIPTCORE_DIR}
8
    ${JAVASCRIPTCORE_DIR}/API
9
    ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
10
    ${THIRDPARTY_DIR}/gtest/include
11
    ${WEBCORE_DIR}/editing
12
    ${WEBCORE_DIR}/platform
13
    ${WEBCORE_DIR}/platform/graphics
14
    ${WEBCORE_DIR}/platform/text
15
    ${WEBCORE_DIR}/platform/network
16
    ${WEBKIT2_DIR}/Shared
17
    ${WEBKIT2_DIR}/Shared/API/c
18
    ${WEBKIT2_DIR}/UIProcess
19
    ${WTF_DIR}
20
)
21
22
WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
23
24
ADD_LIBRARY(TestWebKitAPIInjectedBundle SHARED
25
    ${bundle_harness_SOURCES}
26
    ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
27
    ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
28
    ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
29
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
30
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
31
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
32
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
33
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
34
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
35
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
36
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
37
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
38
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
39
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
40
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
41
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
42
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
43
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
44
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
45
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
46
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
47
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKConnection_Bundle.cpp
48
    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
49
)
50
51
ADD_DEPENDENCIES(TestWebKitAPIInjectedBundle ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
52
53
GET_PROPERTY(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
54
55
ADD_DEFINITIONS(-DGTEST_LINKED_AS_SHARED_LIBRARY=1
56
    -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
57
    -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
58
)
59
60
SET(test_wtf_LIBRARIES
61
    ${WTF_LIBRARY_NAME}
62
    gtest
63
)
64
65
ADD_EXECUTABLE(test_wtf
66
    ${test_main_SOURCES}
67
    ${TESTWEBKITAPI_DIR}/TestsController.cpp
68
    ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
69
    ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
70
    ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
71
    ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
72
    ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
73
    ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
74
    ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
75
    ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
76
    ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
77
    ${TESTWEBKITAPI_DIR}/Tests/WTF/VectorBasic.cpp
78
    ${TESTWEBKITAPI_DIR}/Tests/WTF/VectorReverse.cpp
79
)
80
81
TARGET_LINK_LIBRARIES(test_wtf ${test_wtf_LIBRARIES})
82
ADD_DEPENDENCIES(test_wtf ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
83
ADD_TEST(test_wtf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_wtf)
84
SET_TESTS_PROPERTIES(test_wtf PROPERTIES TIMEOUT 60)
85
86
SET(test_webcore_LIBRARIES
87
    ${WTF_LIBRARY_NAME}
88
    ${WebCore_LIBRARY_NAME}
89
    gtest
90
)
91
92
ADD_EXECUTABLE(test_webcore
93
    ${test_main_SOURCES}
94
    ${TESTWEBKITAPI_DIR}/TestsController.cpp
95
    ${TESTWEBKITAPI_DIR}/Tests/WebCore/KURL.cpp
96
)
97
98
TARGET_LINK_LIBRARIES(test_webcore ${test_webcore_LIBRARIES})
99
ADD_DEPENDENCIES(test_webcore ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
100
ADD_TEST(test_webcore ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webcore)
101
SET_TESTS_PROPERTIES(test_webcore PROPERTIES TIMEOUT 60)
102
103
ADD_LIBRARY(TestWebKitAPIBase
104
    ${test_main_SOURCES}
105
    ${webkit2_api_harness_SOURCES}
106
    ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
107
    ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
108
    ${TESTWEBKITAPI_DIR}/TestsController.cpp
109
)
110
111
ADD_DEPENDENCIES(TestWebKitAPIBase ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
112
113
SET(test_webkit2_api_LIBRARIES
114
    TestWebKitAPIBase
115
    ${WTF_LIBRARY_NAME}
116
    ${JavaScriptCore_LIBRARY_NAME}
117
    ${WebKit2_LIBRARY_NAME}
118
    gtest
119
)
120
121
FOREACH(testName ${test_webkit2_api_BINARIES})
122
    ADD_EXECUTABLE(test_webkit2_api_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
123
    ADD_TEST(test_webkit2_api_${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webkit2_api_${testName})
124
    SET_TESTS_PROPERTIES(test_webkit2_api_${testName} PROPERTIES TIMEOUT 60)
125
    TARGET_LINK_LIBRARIES(test_webkit2_api_${testName} ${test_webkit2_api_LIBRARIES})
126
ENDFOREACH()
127
128
# We don't run tests that are expected to fail. We could use the WILL_FAIL
129
# property, but it reports failure when the test crashes or timeouts and would
130
# make the bot red.
131
132
FOREACH(testName ${test_webkit2_api_fail_BINARIES})
133
    ADD_EXECUTABLE(test_webkit2_api_fail_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
134
    TARGET_LINK_LIBRARIES(test_webkit2_api_fail_${testName} ${test_webkit2_api_LIBRARIES})
135
ENDFOREACH()
- a/Tools/TestWebKitAPI/PlatformEfl.cmake +91 lines
Line 0 a/Tools/TestWebKitAPI/PlatformEfl.cmake_sec1
1
ADD_CUSTOM_TARGET(forwarding-headersEflForTestWebKitAPI
2
    COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${TESTWEBKITAPI_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include efl
3
)
4
SET(ForwardingHeadersForTestWebKitAPI_NAME forwarding-headersEflForTestWebKitAPI)
5
6
ADD_CUSTOM_TARGET(forwarding-headersSoupForTestWebKitAPI
7
    COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${TESTWEBKITAPI_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include soup
8
)
9
SET(ForwardingNetworkHeadersForTestWebKitAPI_NAME forwarding-headersSoupForTestWebKitAPI)
10
11
INCLUDE_DIRECTORIES(${LIBSOUP24_INCLUDE_DIRS}
12
    ${WEBKIT2_DIR}/UIProcess/API/C/soup
13
    ${WEBKIT2_DIR}/UIProcess/API/C/efl
14
    ${ECORE_INCLUDE_DIRS}
15
    ${EINA_INCLUDE_DIRS}
16
    ${EVAS_INCLUDE_DIRS}
17
)
18
19
SET(test_main_SOURCES
20
    ${TESTWEBKITAPI_DIR}/efl/main.cpp
21
)
22
23
SET(bundle_harness_SOURCES
24
    ${TESTWEBKITAPI_DIR}/efl/InjectedBundleController.cpp
25
    ${TESTWEBKITAPI_DIR}/efl/PlatformUtilities.cpp
26
)
27
28
SET(webkit2_api_harness_SOURCES
29
    ${TESTWEBKITAPI_DIR}/efl/PlatformUtilities.cpp
30
    ${TESTWEBKITAPI_DIR}/efl/PlatformWebView.cpp
31
)
32
33
# The list below works like a test expectation. Tests in the
34
# test_webkit2_api_BINARIES list are added to the test runner and
35
# tried on the bots on every build. Tests in test_webkit2_api_fail_BINARIES
36
# are compiled and suffixed with fail and skipped from the test runner.
37
#
38
# Make sure that the tests are passing on both Debug and
39
# Release builds before adding it to test_webkit2_api_BINARIES.
40
41
SET(test_webkit2_api_BINARIES
42
    CookieManager
43
    DOMWindowExtensionNoCache
44
    DocumentStartUserScriptAlertCrash
45
    EvaluateJavaScript
46
    FailedLoad
47
    Find
48
    ForceRepaint
49
    FrameMIMETypeHTML
50
    FrameMIMETypePNG
51
    GetInjectedBundleInitializationUserDataCallback
52
    InjectedBundleBasic
53
    InjectedBundleInitializationUserDataCallbackWins
54
    LoadAlternateHTMLStringWithNonDirectoryURL
55
    LoadCanceledNoServerRedirectCallback
56
    NewFirstVisuallyNonEmptyLayout
57
    NewFirstVisuallyNonEmptyLayoutFails
58
    PageLoadBasic
59
    PageLoadDidChangeLocationWithinPageForFrame
60
    ParentFrame
61
    PreventEmptyUserAgent
62
    PrivateBrowsingPushStateNoHistoryCallback
63
    WKConnection
64
    WKString
65
    WKStringJSString
66
    WillSendSubmitEvent
67
)
68
69
SET(test_webkit2_api_fail_BINARIES
70
    CanHandleRequest
71
    DOMWindowExtensionBasic
72
    DownloadDecideDestinationCrash
73
    NewFirstVisuallyNonEmptyLayoutForImages
74
    NewFirstVisuallyNonEmptyLayoutFrames
75
    RestoreSessionStateContainingFormData
76
    ShouldGoToBackForwardListItem
77
    WKPageGetScaleFactorNotZero
78
)
79
80
# Tests disabled because of missing features on the test harness:
81
#
82
#   AboutBlankLoad
83
#   HitTestResultNodeHandle
84
#   MouseMoveAfterCrash
85
#   ResponsivenessTimerDoesntFireEarly
86
#   SpacebarScrolling
87
#   WKPreferences
88
#
89
# Flaky test, fails on Release but passes on Debug:
90
#
91
#   UserMessage
- a/Tools/TestWebKitAPI/PlatformWebView.h +5 lines
Lines 46-51 typedef HWND PlatformWindow; a/Tools/TestWebKitAPI/PlatformWebView.h_sec1
46
#elif PLATFORM(GTK)
46
#elif PLATFORM(GTK)
47
typedef WKViewRef PlatformWKView;
47
typedef WKViewRef PlatformWKView;
48
typedef GtkWidget *PlatformWindow;
48
typedef GtkWidget *PlatformWindow;
49
#elif PLATFORM(EFL)
50
typedef struct _Evas_Object Evas_Object;
51
typedef struct _Ecore_Evas Ecore_Evas;
52
typedef Evas_Object* PlatformWKView;
53
typedef Ecore_Evas* PlatformWindow;
49
#endif
54
#endif
50
55
51
namespace TestWebKitAPI {
56
namespace TestWebKitAPI {
- a/Tools/TestWebKitAPI/config.h +6 lines
Lines 23-28 a/Tools/TestWebKitAPI/config.h_sec1
23
 * THE POSSIBILITY OF SUCH DAMAGE.
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
24
 */
25
25
26
#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
27
#ifdef BUILDING_WITH_CMAKE
28
#include "cmakeconfig.h"
29
#endif
30
#endif
31
26
#include <wtf/Platform.h>
32
#include <wtf/Platform.h>
27
#include <wtf/ExportMacros.h>
33
#include <wtf/ExportMacros.h>
28
#if USE(JSC)
34
#if USE(JSC)
- a/Tools/TestWebKitAPI/efl/InjectedBundleController.cpp +35 lines
Line 0 a/Tools/TestWebKitAPI/efl/InjectedBundleController.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Igalia S.L.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "InjectedBundleController.h"
28
29
namespace TestWebKitAPI {
30
31
void InjectedBundleController::platformInitialize()
32
{
33
}
34
35
} // namespace TestWebKitAPI
- a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp +69 lines
Line 0 a/Tools/TestWebKitAPI/efl/PlatformUtilities.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
 * THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
#include "config.h"
27
#include "PlatformUtilities.h"
28
29
#include <Ecore.h>
30
#include <stdio.h>
31
#include <unistd.h>
32
33
namespace TestWebKitAPI {
34
35
namespace Util {
36
37
void run(bool* done)
38
{
39
    while (!*done)
40
        ecore_main_loop_iterate();
41
}
42
43
void sleep(double seconds)
44
{
45
    sleep(seconds);
46
}
47
48
WKURLRef createURLForResource(const char* resource, const char* extension)
49
{
50
    char url[PATH_MAX];
51
52
    snprintf(url, sizeof(url), "file://%s/%s.%s", TEST_WEBKIT2_RESOURCES_DIR, resource, extension);
53
54
    return WKURLCreateWithUTF8CString(url);
55
}
56
57
WKStringRef createInjectedBundlePath()
58
{
59
    return WKStringCreateWithUTF8CString(TEST_INJECTED_BUNDLE_PATH);
60
}
61
62
WKURLRef URLForNonExistentResource()
63
{
64
    return WKURLCreateWithUTF8CString("file:///does-not-exist.html");
65
}
66
67
} // namespace Util
68
69
} // namespace TestWebKitAPI
- a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp +76 lines
Line 0 a/Tools/TestWebKitAPI/efl/PlatformWebView.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics
3
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "config.h"
28
#include "PlatformWebView.h"
29
30
#include "WebKit2/WKAPICast.h"
31
#include <Ecore_Evas.h>
32
33
extern bool useX11Window;
34
35
using namespace WebKit;
36
37
namespace TestWebKitAPI {
38
39
static Ecore_Evas* initEcoreEvas()
40
{
41
    ASSERT(ecore_evas_init());
42
43
    Ecore_Evas* ecoreEvas;
44
45
    if (useX11Window)
46
        ecoreEvas = ecore_evas_new(0, 0, 0, 800, 600, 0);
47
    else
48
        ecoreEvas = ecore_evas_buffer_new(800, 600);
49
50
    ASSERT(ecoreEvas);
51
52
    ecore_evas_show(ecoreEvas);
53
54
    return ecoreEvas;
55
}
56
57
PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
58
{
59
    m_window = initEcoreEvas();
60
    Evas* evas = ecore_evas_get(m_window);
61
    m_view = toImpl(WKViewCreate(evas, contextRef, pageGroupRef));
62
}
63
64
PlatformWebView::~PlatformWebView()
65
{
66
    evas_object_del(m_view);
67
    ecore_evas_free(m_window);
68
    ecore_evas_shutdown();
69
}
70
71
WKPageRef PlatformWebView::page() const
72
{
73
    return WKViewGetPage(toAPI(m_view));
74
}
75
76
} // namespace TestWebKitAPI
- a/Tools/TestWebKitAPI/efl/main.cpp +65 lines
Line 0 a/Tools/TestWebKitAPI/efl/main.cpp_sec1
1
/*
2
 * Copyright (C) 2012 Samsung Electronics
3
 * Copyright (C) 2012 Intel Corporation. All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
15
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
18
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
24
 * THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include "config.h"
28
#include "TestsController.h"
29
#include <Ecore.h>
30
#include <Eina.h>
31
#include <getopt.h>
32
33
bool useX11Window = false;
34
35
static bool checkForUseX11WindowArgument(int argc, char** argv)
36
{
37
    int hasUseX11Window = 0;
38
39
    static const option options[] = {
40
        {"useX11Window", no_argument, &hasUseX11Window, 1},
41
        {0, 0, 0, 0}
42
    };
43
44
    while (getopt_long(argc, argv, "", options, 0) != -1) { }
45
46
    return hasUseX11Window;
47
}
48
49
int main(int argc, char** argv)
50
{
51
    if (!eina_init())
52
        return EXIT_FAILURE;
53
54
    if (!ecore_init())
55
        return EXIT_FAILURE;
56
57
    useX11Window = checkForUseX11WindowArgument(argc, argv);
58
59
    int returnCode = TestWebKitAPI::TestsController::shared().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
60
61
    ecore_shutdown();
62
    eina_shutdown();
63
64
    return returnCode;
65
}

Return to Bug 90671