diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
commit | 3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch) | |
tree | 73dc228333948738bbe02976cacca8cd382bc978 /Tools/TestWebKitAPI | |
parent | b32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff) | |
download | qtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz |
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Tools/TestWebKitAPI')
-rw-r--r-- | Tools/TestWebKitAPI/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/GNUmakefile.am | 2 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp | 12 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj | 16 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp | 59 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp | 71 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp | 49 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp | 1 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm | 105 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp | 1 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/config.h | 2 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/efl/InjectedBundleController.cpp | 3 | ||||
-rw-r--r-- | Tools/TestWebKitAPI/efl/main.cpp | 3 |
13 files changed, 316 insertions, 11 deletions
diff --git a/Tools/TestWebKitAPI/CMakeLists.txt b/Tools/TestWebKitAPI/CMakeLists.txt index 6c3a59d5c..d116b5c0e 100644 --- a/Tools/TestWebKitAPI/CMakeLists.txt +++ b/Tools/TestWebKitAPI/CMakeLists.txt @@ -48,6 +48,7 @@ ADD_LIBRARY(TestWebKitAPIInjectedBundle SHARED ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp ) +TARGET_LINK_LIBRARIES(TestWebKitAPIInjectedBundle ${WTF_LIBRARY_NAME}) ADD_DEPENDENCIES(TestWebKitAPIInjectedBundle ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME}) GET_PROPERTY(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION) @@ -65,12 +66,14 @@ SET(test_wtf_LIBRARIES ADD_EXECUTABLE(test_wtf ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp + ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp + ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp diff --git a/Tools/TestWebKitAPI/GNUmakefile.am b/Tools/TestWebKitAPI/GNUmakefile.am index 815c43baf..255a83856 100644 --- a/Tools/TestWebKitAPI/GNUmakefile.am +++ b/Tools/TestWebKitAPI/GNUmakefile.am @@ -50,12 +50,14 @@ Programs_TestWebKitAPI_TestWTF_LDFLAGS = \ -no-fast-install Programs_TestWebKitAPI_TestWTF_SOURCES = \ + Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp \ Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp \ Tools/TestWebKitAPI/Tests/WTF/Functional.cpp \ Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp \ Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp \ Tools/TestWebKitAPI/Tests/WTF/RedBlackTree.cpp \ Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp \ + Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp \ Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp \ Tools/TestWebKitAPI/Tests/WTF/TemporaryChange.cpp \ Tools/TestWebKitAPI/Tests/WTF/VectorBasic.cpp \ diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp index ff064a02d..e84386f18 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp +++ b/Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp @@ -132,8 +132,18 @@ '--output', '<(PRODUCT_DIR)/TestWebKitAPI_apk', '--ant-args', + '-DANDROID_SDK=<(android_sdk)', + '--ant-args', + '-DANDROID_SDK_ROOT=<(android_sdk_root)', + '--ant-args', + '-DANDROID_SDK_TOOLS=<(android_sdk_tools)', + '--ant-args', + '-DANDROID_SDK_VERSION=<(android_sdk_version)', + '--ant-args', + '-DANDROID_TOOLCHAIN=<(android_toolchain)', + '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', - '--ant-compile', + '--sdk-build=<(sdk_build)', '--app_abi', '<(android_app_abi)', ], diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj index d3664a129..e98410d31 100644 --- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj +++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj @@ -22,9 +22,12 @@ 1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; }; 1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; }; 261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */; }; + 265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */; }; 26B2DFF915BDE599004F691D /* HashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26B2DFF815BDE599004F691D /* HashSet.cpp */; }; 26DF5A5E15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */; }; 26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; }; + 26F1B44415CA434F00D1E4BF /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F1B44215CA434F00D1E4BF /* AtomicString.cpp */; }; + 26F1B44515CA434F00D1E4BF /* StringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F1B44315CA434F00D1E4BF /* StringImpl.cpp */; }; 333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */; }; 33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */; }; 33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; }; @@ -156,9 +159,9 @@ C507E8A714C6545B005D6B3B /* InspectorBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = C507E8A614C6545B005D6B3B /* InspectorBar.mm */; }; C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */ = {isa = PBXBuildFile; fileRef = C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */; }; C540F784152E5A9A00A40C8C /* verboseMarkup.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C540F783152E5A7800A40C8C /* verboseMarkup.html */; }; + CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497B315857F0C00B5BC30 /* MediaTime.cpp */; }; E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */; }; E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; }; - CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497B315857F0C00B5BC30 /* MediaTime.cpp */; }; E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */; }; F3FC3EE313678B7300126A65 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3FC3EE213678B7300126A65 /* libgtest.a */; }; F660AA0D15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */; }; @@ -249,9 +252,12 @@ 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; sourceTree = "<group>"; }; 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; }; 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetAndUpdateCacheModel.mm; sourceTree = "<group>"; }; + 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WTFString.cpp; path = WTF/WTFString.cpp; sourceTree = "<group>"; }; 26B2DFF815BDE599004F691D /* HashSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HashSet.cpp; path = WTF/HashSet.cpp; sourceTree = "<group>"; }; 26DF5A5D15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CancelLoadFromResourceLoadDelegate.mm; sourceTree = "<group>"; }; 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = CancelLoadFromResourceLoadDelegate.html; sourceTree = "<group>"; }; + 26F1B44215CA434F00D1E4BF /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicString.cpp; path = WTF/AtomicString.cpp; sourceTree = "<group>"; }; + 26F1B44315CA434F00D1E4BF /* StringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImpl.cpp; path = WTF/StringImpl.cpp; sourceTree = "<group>"; }; 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; }; 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; }; 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash_Bundle.cpp; sourceTree = "<group>"; }; @@ -399,9 +405,9 @@ C507E8A614C6545B005D6B3B /* InspectorBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InspectorBar.mm; sourceTree = "<group>"; }; C540F775152E4DA000A40C8C /* SimplifyMarkup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimplifyMarkup.mm; sourceTree = "<group>"; }; C540F783152E5A7800A40C8C /* verboseMarkup.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = verboseMarkup.html; sourceTree = "<group>"; }; + CD5497B315857F0C00B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaTime.cpp; path = WTF/MediaTime.cpp; sourceTree = "<group>"; }; E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = "<group>"; }; E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = "<group>"; }; - CD5497B315857F0C00B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaTime.cpp; path = WTF/MediaTime.cpp; sourceTree = "<group>"; }; E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; }; F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; }; F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = "<group>"; }; @@ -621,6 +627,7 @@ children = ( BC029B1A1486B23800817DA9 /* ns */, C0991C4F143C7D68007998F2 /* cf */, + 26F1B44215CA434F00D1E4BF /* AtomicString.cpp */, CD5497B315857F0C00B5BC30 /* MediaTime.cpp */, 0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */, 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */, @@ -629,11 +636,13 @@ 0BCD833414857CE400EA2003 /* HashMap.cpp */, 26B2DFF815BDE599004F691D /* HashSet.cpp */, 81B50192140F232300D9EB58 /* StringBuilder.cpp */, + 26F1B44315CA434F00D1E4BF /* StringImpl.cpp */, C01363C713C3997300EF3964 /* StringOperators.cpp */, 0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */, BC55F5F814AD78EE00484BE1 /* Vector.cpp */, BC90964B125561BF00083756 /* VectorBasic.cpp */, 37200B9113A16230007A4FAD /* VectorReverse.cpp */, + 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */, ); name = WTF; sourceTree = "<group>"; @@ -861,6 +870,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 26F1B44415CA434F00D1E4BF /* AtomicString.cpp in Sources */, BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */, BC131A9B1171316900B69727 /* main.mm in Sources */, BC131AA9117131FC00B69727 /* TestsController.cpp in Sources */, @@ -901,6 +911,7 @@ C085880013FEC3A6001EF4E5 /* InstanceMethodSwizzler.mm in Sources */, 37DC678D140D7C5000ABCCDB /* DOMRangeOfString.mm in Sources */, 81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */, + 26F1B44515CA434F00D1E4BF /* StringImpl.cpp in Sources */, 0FC6C4CC141027E0005B7F0C /* RedBlackTree.cpp in Sources */, 0FC6C4CF141034AD005B7F0C /* MetaAllocator.cpp in Sources */, A7A966DB140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp in Sources */, @@ -957,6 +968,7 @@ 26B2DFF915BDE599004F691D /* HashSet.cpp in Sources */, 00CD9F6315BE312C002DA2CE /* BackForwardList.mm in Sources */, CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */, + 265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp b/Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp new file mode 100644 index 000000000..bddf22c23 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WTF/AtomicString.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <wtf/text/AtomicString.h> + +namespace TestWebKitAPI { + +TEST(WTF, AtomicStringCreationFromLiteral) +{ + AtomicString stringWithTemplate("Template Literal", AtomicString::ConstructFromLiteral); + ASSERT_EQ(strlen("Template Literal"), stringWithTemplate.length()); + ASSERT_TRUE(stringWithTemplate == "Template Literal"); + ASSERT_TRUE(stringWithTemplate.string().is8Bit()); + ASSERT_TRUE(stringWithTemplate.impl()->hasTerminatingNullCharacter()); + + const char* programmaticStringData = "Explicit Size Literal"; + AtomicString programmaticString(programmaticStringData, strlen(programmaticStringData), AtomicString::ConstructFromLiteral); + ASSERT_EQ(strlen(programmaticStringData), programmaticString.length()); + ASSERT_TRUE(programmaticStringData == programmaticStringData); + ASSERT_TRUE(programmaticString.string().is8Bit()); + ASSERT_TRUE(programmaticString.impl()->hasTerminatingNullCharacter()); + ASSERT_EQ(programmaticStringData, reinterpret_cast<const char*>(programmaticString.string().characters8())); +} + +TEST(WTF, AtomicStringCreationFromLiteralUniqueness) +{ + AtomicString string1("Template Literal", AtomicString::ConstructFromLiteral); + AtomicString string2("Template Literal", AtomicString::ConstructFromLiteral); + ASSERT_EQ(string1.impl(), string2.impl()); + + AtomicString string3("Template Literal"); + ASSERT_EQ(string1.impl(), string3.impl()); +} + +} // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp b/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp new file mode 100644 index 000000000..213a655aa --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <wtf/text/StringImpl.h> + +namespace TestWebKitAPI { + +TEST(WTF, StringImplCreationFromLiteral) +{ + // Constructor using the template to determine the size. + RefPtr<StringImpl> stringWithTemplate = StringImpl::createFromLiteral("Template Literal"); + ASSERT_EQ(strlen("Template Literal"), stringWithTemplate->length()); + ASSERT_TRUE(equal(stringWithTemplate.get(), "Template Literal")); + ASSERT_TRUE(stringWithTemplate->is8Bit()); + ASSERT_TRUE(stringWithTemplate->hasTerminatingNullCharacter()); + + // Constructor taking the size explicitely. + const char* programmaticStringData = "Explicit Size Literal"; + RefPtr<StringImpl> programmaticString = StringImpl::createFromLiteral(programmaticStringData, strlen(programmaticStringData)); + ASSERT_EQ(strlen(programmaticStringData), programmaticString->length()); + ASSERT_TRUE(equal(programmaticString.get(), programmaticStringData)); + ASSERT_EQ(programmaticStringData, reinterpret_cast<const char*>(programmaticString->characters8())); + ASSERT_TRUE(programmaticString->is8Bit()); + ASSERT_TRUE(programmaticString->hasTerminatingNullCharacter()); + + // Constructor without explicit size. + const char* stringWithoutLengthLiteral = "No Size Literal"; + RefPtr<StringImpl> programmaticStringNoLength = StringImpl::createFromLiteral(stringWithoutLengthLiteral); + ASSERT_EQ(strlen(stringWithoutLengthLiteral), programmaticStringNoLength->length()); + ASSERT_TRUE(equal(programmaticStringNoLength.get(), stringWithoutLengthLiteral)); + ASSERT_EQ(stringWithoutLengthLiteral, reinterpret_cast<const char*>(programmaticStringNoLength->characters8())); + ASSERT_TRUE(programmaticStringNoLength->is8Bit()); + ASSERT_TRUE(programmaticStringNoLength->hasTerminatingNullCharacter()); +} + +TEST(WTF, StringImplFromLiteralLoop16BitConversion) +{ + RefPtr<StringImpl> controlString = StringImpl::create("Template Literal"); + for (size_t i = 0; i < 10; ++i) { + RefPtr<StringImpl> string = StringImpl::createFromLiteral("Template Literal"); + + ASSERT_EQ(0, memcmp(controlString->characters(), string->characters(), controlString->length() * sizeof(UChar))); + ASSERT_TRUE(string->has16BitShadow()); + } +} + +} // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp b/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp new file mode 100644 index 000000000..accf452cf --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <wtf/text/WTFString.h> + +namespace TestWebKitAPI { + +TEST(WTF, StringCreationFromLiteral) +{ + String stringFromLiteral(ASCIILiteral("Explicit construction syntax")); + ASSERT_EQ(strlen("Explicit construction syntax"), stringFromLiteral.length()); + ASSERT_TRUE(stringFromLiteral == "Explicit construction syntax"); + ASSERT_TRUE(stringFromLiteral.is8Bit()); + ASSERT_TRUE(stringFromLiteral.impl()->hasTerminatingNullCharacter()); + ASSERT_TRUE(String("Explicit construction syntax") == stringFromLiteral); + + String stringWithTemplate("Template Literal", String::ConstructFromLiteral); + ASSERT_EQ(strlen("Template Literal"), stringWithTemplate.length()); + ASSERT_TRUE(stringWithTemplate == "Template Literal"); + ASSERT_TRUE(stringWithTemplate.is8Bit()); + ASSERT_TRUE(stringWithTemplate.impl()->hasTerminatingNullCharacter()); + ASSERT_TRUE(String("Template Literal") == stringWithTemplate); +} + +} // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp index 5af01ebb4..bdfa55fcb 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp @@ -101,6 +101,7 @@ TEST(WebKit2, WKPreferencesDefaults) EXPECT_FALSE(WKPreferencesGetCompositingBordersVisible(preference)); EXPECT_FALSE(WKPreferencesGetCompositingRepaintCountersVisible(preference)); EXPECT_FALSE(WKPreferencesGetNeedsSiteSpecificQuirks(preference)); + EXPECT_FALSE(WKPreferencesGetThirdPartyStorageBlockingEnabled(preference)); WKRelease(preference); } diff --git a/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm b/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm index f7f175d2e..6cadf0b14 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm +++ b/Tools/TestWebKitAPI/Tests/WebKit2ObjC/WKBrowsingContextLoadDelegateTest.mm @@ -35,6 +35,8 @@ #import "PlatformUtilities.h" +namespace { + class WKBrowsingContextLoadDelegateTest : public ::testing::Test { public: WKProcessGroup *processGroup; @@ -63,17 +65,32 @@ public: } }; - -static bool simpleLoadDone; +} // namespace @interface SimpleLoadDelegate : NSObject <WKBrowsingContextLoadDelegate> +{ + bool* _simpleLoadDone; +} + +- (id)initWithFlag:(bool*)flag; + @end @implementation SimpleLoadDelegate +- (id)initWithFlag:(bool*)flag +{ + self = [super init]; + if (!self) + return nil; + + _simpleLoadDone = flag; + return self; +} + - (void)browsingContextControllerDidFinishLoad:(WKBrowsingContextController *)sender { - simpleLoadDone = true; + *_simpleLoadDone = true; } @end @@ -85,8 +102,10 @@ TEST_F(WKBrowsingContextLoadDelegateTest, Empty) TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoad) { + bool simpleLoadDone = false; + // Add the load delegate. - SimpleLoadDelegate *loadDelegate = [[SimpleLoadDelegate alloc] init]; + SimpleLoadDelegate *loadDelegate = [[SimpleLoadDelegate alloc] initWithFlag:&simpleLoadDone]; view.browsingContextController.loadDelegate = loadDelegate; // Load the file. @@ -101,28 +120,100 @@ TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoad) [loadDelegate release]; } +TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadOfHTMLString) +{ + bool simpleLoadDone = false; + + // Add the load delegate. + SimpleLoadDelegate *loadDelegate = [[SimpleLoadDelegate alloc] initWithFlag:&simpleLoadDone]; + view.browsingContextController.loadDelegate = loadDelegate; + + // Load the HTML string. + [view.browsingContextController loadHTMLString:@"<html><body>Simple HTML String</body></html>" baseURL:[NSURL URLWithString:@"about:blank"]]; + + // Wait for the load to finish. + TestWebKitAPI::Util::run(&simpleLoadDone); + + // Tear down the delegate. + view.browsingContextController.loadDelegate = nil; + [loadDelegate release]; +} + +TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadOfHTMLString_NilBaseURL) +{ + bool simpleLoadDone = false; + + // Add the load delegate. + SimpleLoadDelegate *loadDelegate = [[SimpleLoadDelegate alloc] initWithFlag:&simpleLoadDone]; + view.browsingContextController.loadDelegate = loadDelegate; + + // Load the HTML string, pass nil as the baseURL. + [view.browsingContextController loadHTMLString:@"<html><body>Simple HTML String</body></html>" baseURL:nil]; + + // Wait for the load to finish. + TestWebKitAPI::Util::run(&simpleLoadDone); + + // Tear down the delegate. + view.browsingContextController.loadDelegate = nil; + [loadDelegate release]; +} + +TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadOfHTMLString_NilHTMLStringAndBaseURL) +{ + bool simpleLoadDone = false; + + // Add the load delegate. + SimpleLoadDelegate *loadDelegate = [[SimpleLoadDelegate alloc] initWithFlag:&simpleLoadDone]; + view.browsingContextController.loadDelegate = loadDelegate; + + // Load the HTML string (as nil). + [view.browsingContextController loadHTMLString:nil baseURL:nil]; + + // Wait for the load to finish. + TestWebKitAPI::Util::run(&simpleLoadDone); -static bool simpleLoadFailDone; + // Tear down the delegate. + view.browsingContextController.loadDelegate = nil; + [loadDelegate release]; +} @interface SimpleLoadFailDelegate : NSObject <WKBrowsingContextLoadDelegate> +{ + bool* _simpleLoadFailDone; +} + +- (id)initWithFlag:(bool*)flag; + @end @implementation SimpleLoadFailDelegate +- (id)initWithFlag:(bool*)flag +{ + self = [super init]; + if (!self) + return nil; + + _simpleLoadFailDone = flag; + return self; +} + - (void)browsingContextControllerDidFailProvisionalLoad:(WKBrowsingContextController *)sender withError:(NSError *)error { EXPECT_EQ(-1100, error.code); EXPECT_WK_STREQ(NSURLErrorDomain, error.domain); - simpleLoadFailDone = true; + *_simpleLoadFailDone = true; } @end TEST_F(WKBrowsingContextLoadDelegateTest, SimpleLoadFail) { + bool simpleLoadFailDone = false; + // Add the load delegate. - SimpleLoadFailDelegate *loadDelegate = [[SimpleLoadFailDelegate alloc] init]; + SimpleLoadFailDelegate *loadDelegate = [[SimpleLoadFailDelegate alloc] initWithFlag:&simpleLoadFailDone]; view.browsingContextController.loadDelegate = loadDelegate; // Load a non-existent file. diff --git a/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp b/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp index c2bdcce4b..de408831f 100644 --- a/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp +++ b/Tools/TestWebKitAPI/Tests/gtk/InputMethodFilter.cpp @@ -27,6 +27,7 @@ #include "GtkInputMethodFilter.h" #include "WTFStringUtilities.h" +#include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include <wtf/gobject/GOwnPtr.h> #include <wtf/gobject/GRefPtr.h> diff --git a/Tools/TestWebKitAPI/config.h b/Tools/TestWebKitAPI/config.h index e3c2eb02d..97bb958ef 100644 --- a/Tools/TestWebKitAPI/config.h +++ b/Tools/TestWebKitAPI/config.h @@ -50,7 +50,7 @@ #include <stdint.h> #if !PLATFORM(CHROMIUM) || (PLATFORM(GTK) && defined(BUILDING_WEBKIT2__)) -#include <WebKit2/WebKit2.h> +#include <WebKit2/WebKit2_C.h> #endif #ifdef __clang__ diff --git a/Tools/TestWebKitAPI/efl/InjectedBundleController.cpp b/Tools/TestWebKitAPI/efl/InjectedBundleController.cpp index 5d55002cc..c2442bd15 100644 --- a/Tools/TestWebKitAPI/efl/InjectedBundleController.cpp +++ b/Tools/TestWebKitAPI/efl/InjectedBundleController.cpp @@ -26,10 +26,13 @@ #include "config.h" #include "InjectedBundleController.h" +#include <wtf/Assertions.h> + namespace TestWebKitAPI { void InjectedBundleController::platformInitialize() { + WTFInstallReportBacktraceOnCrashHook(); } } // namespace TestWebKitAPI diff --git a/Tools/TestWebKitAPI/efl/main.cpp b/Tools/TestWebKitAPI/efl/main.cpp index 7c77dbfb2..c69ec450c 100644 --- a/Tools/TestWebKitAPI/efl/main.cpp +++ b/Tools/TestWebKitAPI/efl/main.cpp @@ -29,6 +29,7 @@ #include <Ecore.h> #include <Eina.h> #include <getopt.h> +#include <wtf/Assertions.h> bool useX11Window = false; @@ -48,6 +49,8 @@ static bool checkForUseX11WindowArgument(int argc, char** argv) int main(int argc, char** argv) { + WTFInstallReportBacktraceOnCrashHook(); + if (!eina_init()) return EXIT_FAILURE; |