diff options
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2Cocoa')
78 files changed, 1926 insertions, 0 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AllAhem.svg b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AllAhem.svg new file mode 100644 index 000000000..135d00999 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AllAhem.svg @@ -0,0 +1,111 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<svg xmlns="http://www.w3.org/2000/svg"> +<metadata></metadata> +<defs> +<font id="Litherum" horiz-adv-x="1024"> +<font-face units-per-em="1024" ascent="1024" descent="-1"/> +<glyph unicode="1" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="2" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="3" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="!" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="$" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="%" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode=":" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode=";" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="?" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="¢" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="£" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="¥" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="°" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="‐" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="–" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="‥" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="…" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="‰" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="′" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="″" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="‼" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="⁇" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="⁈" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="⁉" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="€" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="℃" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="№" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="々" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="〜" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="〻" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ぁ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ぃ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ぅ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ぇ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ぉ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="っ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゃ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゅ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ょ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゎ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゕ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゖ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゝ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゞ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="゠" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ァ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ィ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゥ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ェ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ォ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ッ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ャ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ュ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ョ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ヮ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ヵ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ヶ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="・" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ー" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ヽ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ヾ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇰ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇱ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇲ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇳ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇴ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇵ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇶ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇷ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇸ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇹ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇺ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇻ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇼ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇽ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇾ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ㇿ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="一" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="三" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="二" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="四" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="!" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="$" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="%" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode=":" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode=";" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="?" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="・" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ァ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ィ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ゥ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ェ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ォ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ャ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ュ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ョ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ッ" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="ー" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="¢" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="£" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +<glyph unicode="¥" horiz-adv-x="1024" d="M0 0V1024H1024V0z"/> +</font> +</defs> +</svg> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db Binary files differnew file mode 100644 index 000000000..e7cbb3d7d --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db-shm b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db-shm Binary files differnew file mode 100644 index 000000000..f5a2be9ff --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db-shm diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db-wal b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db-wal Binary files differnew file mode 100644 index 000000000..dfd74404b --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ApplicationCache.db-wal diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h new file mode 100644 index 000000000..528afa0e9 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleEditingDelegateProtocol.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2016 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. + */ + +#import <WebKit/WKFoundation.h> + +#if WK_API_ENABLED + +#import <WebKit/WKWebProcessPlugInEditingDelegate.h> + +@protocol BundleEditingDelegateProtocol <NSObject> + +- (void)shouldInsertText:(NSString *)text replacingRange:(NSString *)rangeAsString givenAction:(WKEditorInsertAction)action; +- (void)willWriteToPasteboard:(NSString *)rangeAsString; +- (void)didWriteToPasteboard; + +@end + +#endif diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h new file mode 100644 index 000000000..2edab241f --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 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. + */ + +#import <WebKit/WKFoundation.h> + +#if WK_API_ENABLED + +@protocol BundleRangeHandleProtocol <NSObject> +- (void)textFromBodyRange:(NSString *)text; +- (void)bodyInnerHTMLAfterDetectingData:(NSString *)text; +@end + +#endif diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.h b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.h new file mode 100644 index 000000000..9d5b5d433 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2016 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. + */ + +@protocol ContentFilteringProtocol <NSObject> +- (void)checkIfPlatformFrameworksAreLoaded:(void (^)(BOOL parentalControlsLoaded, BOOL networkExtensionLoaded))completionHandler; +@end diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.html new file mode 100644 index 000000000..a48eabb65 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ContentFiltering.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<body> +PASS +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/CookieMessage.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/CookieMessage.html new file mode 100644 index 000000000..78553d43d --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/CookieMessage.html @@ -0,0 +1,4 @@ +<script> +document.cookie = "key=value"; +window.webkit.messageHandlers.testHandler.postMessage("COOKIE:" + document.cookie); +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestBlobURL.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestBlobURL.html new file mode 100644 index 000000000..55ff0c066 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestBlobURL.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<body> +<a id="href" href="simple.html">download</a> +<script> + var element = document.getElementById("href"); + var data = { x: 42, s: "hello, world" }; + var json = JSON.stringify(data); + var blob = new Blob([json], {type: "octet/stream"}); + var url = window.URL.createObjectURL(blob); + + element.href = url; + element.click(); +</script> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURL.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURL.html new file mode 100644 index 000000000..61447c2fd --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURL.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> +<body> +<a id="href" href="simple.html">download</a> +<script> + var element = document.getElementById("href"); + element.click(); +</script> +</body> +</html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURL2.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURL2.html new file mode 100644 index 000000000..01f6a7773 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURL2.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<body> +<iframe src="DownloadRequestOriginalURLFrame.html"></iframe> +</body> +</html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURLFrame.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURLFrame.html new file mode 100644 index 000000000..61447c2fd --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DownloadRequestOriginalURLFrame.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html> +<body> +<a id="href" href="simple.html">download</a> +<script> + var element = document.getElementById("href"); + element.click(); +</script> +</body> +</html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.html new file mode 100644 index 000000000..9a9006203 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenDelegate.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <script> + function load() { + window.webkit.messageHandlers.fullscreenChangeHandler.postMessage('load'); + } + document.addEventListener('webkitfullscreenchange', function(event) { + window.webkit.messageHandlers.fullscreenChangeHandler.postMessage('fullscreenchange'); + }); + document.addEventListener('mousedown', function(event) { + // Toggle fullscreen + var target = document.getElementById('target'); + if (document.webkitFullscreenElement == target) + document.webkitExitFullscreen(); + else + target.webkitRequestFullScreen(); + }); + </script> + <style> + #target { + background-color: red; + width: 150px; + height: 150px; + } + </style> +</head> +<body onload="load()"> + <div id="target"></div> +</body> +</html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenLayoutConstraints.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenLayoutConstraints.html new file mode 100644 index 000000000..063d901da --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenLayoutConstraints.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <script> + function load() { + window.webkit.messageHandlers.fullscreenStateChangeHandler.postMessage('load'); + } + document.addEventListener('webkitfullscreenchange', function(event) { + window.webkit.messageHandlers.fullscreenStateChangeHandler.postMessage('fullscreenchange'); + }); + document.addEventListener('mousedown', function(event) { + // Toggle fullscreen + var target = document.getElementById('target'); + if (document.webkitFullscreenElement == target) + document.webkitExitFullscreen(); + else + target.webkitRequestFullScreen(); + }); + </script> + <style> + #target { + background-color: red; + width: 150px; + height: 150px; + } + </style> +</head> +<body onload="load()"> + <div id="target"></div> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html new file mode 100644 index 000000000..9a9006203 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <script> + function load() { + window.webkit.messageHandlers.fullscreenChangeHandler.postMessage('load'); + } + document.addEventListener('webkitfullscreenchange', function(event) { + window.webkit.messageHandlers.fullscreenChangeHandler.postMessage('fullscreenchange'); + }); + document.addEventListener('mousedown', function(event) { + // Toggle fullscreen + var target = document.getElementById('target'); + if (document.webkitFullscreenElement == target) + document.webkitExitFullscreen(); + else + target.webkitRequestFullScreen(); + }); + </script> + <style> + #target { + background-color: red; + width: 150px; + height: 150px; + } + </style> +</head> +<body onload="load()"> + <div id="target"></div> +</body> +</html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.html new file mode 100644 index 000000000..c2bc464ab --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.html @@ -0,0 +1,14 @@ +<script> + +var request = window.indexedDB.deleteDatabase("IDBDeleteRecovery"); + +request.onsuccess = function(e) +{ + window.webkit.messageHandlers.testHandler.postMessage('Deleted database'); +} +request.onerror = function(e) +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error deleting database'); +} +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3 b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3 Binary files differnew file mode 100644 index 000000000..25ef255ee --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3 diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3-shm b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3-shm Binary files differnew file mode 100644 index 000000000..285d37720 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3-shm diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3-wal b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3-wal Binary files differnew file mode 100644 index 000000000..51fe61926 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBDeleteRecovery.sqlite3-wal diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.html new file mode 100644 index 000000000..813bbd852 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IDBIndexUpgradeToV2.html @@ -0,0 +1,21 @@ +<script> + +var databaseName = "index-upgrade-test"; +var openRequest = indexedDB.open(databaseName); +var db; +openRequest.onupgradeneeded = function(event) { + window.webkit.messageHandlers.testHandler.postMessage('Unexpected upgrade needed'); +} + +openRequest.onsuccess = function(event) { + var req = event.target.result.transaction('store').objectStore('store').index('index').get("indexkey!"); + + req.onsuccess = function (event) { + window.webkit.messageHandlers.testHandler.postMessage("Object expected to be a blob: " + event.target.result.test); + } + req.onerror = function (event) { + window.webkit.messageHandlers.testHandler.postMessage("Unexpected get error"); + } +} + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.blob b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.blob new file mode 100644 index 000000000..6c51fb115 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.blob @@ -0,0 +1 @@ +fun times all around!
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.sqlite3 b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.sqlite3 Binary files differnew file mode 100644 index 000000000..bc3b63888 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexUpgrade.sqlite3 diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBDatabaseProcessKill-1.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBDatabaseProcessKill-1.html new file mode 100644 index 000000000..ab4299bd8 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBDatabaseProcessKill-1.html @@ -0,0 +1,33 @@ +<script> + +var database; + +for (var i = 0; i < 100; ++i) { + var request = window.indexedDB.deleteDatabase("IndexedDBDatabaseProcessKill"); + request.onsuccess = function() { + window.webkit.messageHandlers.testHandler.postMessage('DeleteRequestDone'); + } + request.onerror = function() { + window.webkit.messageHandlers.testHandler.postMessage('DeleteRequestError'); + } + + request = window.indexedDB.open("IndexedDBDatabaseProcessKill"); + request.onsuccess = function() { + window.webkit.messageHandlers.testHandler.postMessage('OpenRequestDone'); + } + request.onerror = function() { + window.webkit.messageHandlers.testHandler.postMessage('OpenRequestError'); + } + request.onupgradeneeded = function(e) { + database = e.target.result; + database.onerror = function() { + notifyDatabaseErrorReceived = function() { + window.webkit.messageHandlers.testHandler.postMessage('DatabaseErrorReceived'); + } + setTimeout("setTimeout(notifyDatabaseErrorReceived, 0)", 0); + } + window.webkit.messageHandlers.testHandler.postMessage('OpenRequestUpgradeNeeded'); + } +} + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-1.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-1.html new file mode 100644 index 000000000..51223a1cb --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-1.html @@ -0,0 +1,46 @@ +<script> + +var request = window.indexedDB.deleteDatabase("IndexedDBMultiProcess"); +request.onsuccess = function(e) +{ + continueTest(); +} +request.onerror = function(e) +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error deleting database'); +} + +function continueTest() +{ + var request = window.indexedDB.open("IndexedDBMultiProcess", 2); + + request.onsuccess = function() + { + window.webkit.messageHandlers.testHandler.postMessage('Open success'); + } + + request.onerror = function() + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database'); + } + + request.onupgradeneeded = function(event) + { + window.webkit.messageHandlers.testHandler.postMessage('UpgradeNeeded'); + + var store = event.target.result.createObjectStore("TestObjectStore"); + + event.target.transaction.oncomplete = function() { + window.webkit.messageHandlers.testHandler.postMessage('Transaction complete'); + } + + event.target.transaction.onerror = function() { + window.webkit.messageHandlers.testHandler.postMessage('Transaction errored!'); + } + + store.put("bar", "foo"); + } +} +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html new file mode 100644 index 000000000..31035c993 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html @@ -0,0 +1,92 @@ +<script> + +var request = window.indexedDB.open("IndexedDBMultiProcess", 2); + +request.onsuccess = function(event) +{ + var req = event.target.result.transaction("TestObjectStore").objectStore("TestObjectStore").get("foo"); + + req.onsuccess = function(event) + { + window.webkit.messageHandlers.testHandler.postMessage('Value of foo: ' + req.result); + continueTest1(); + } + + req.onerror = function(event) + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error getting value'); + } +} + +request.onerror = function() +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database'); +} + +request.onupgradeneeded = function(event) +{ + // Unexpected upgrade needed + window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded'); +} + +function continueTest1() +{ + var request = window.indexedDB.deleteDatabase("ProcessCloseIDBCleanup"); + request.onsuccess = function(e) + { + continueTest2(); + } + request.onerror = function(e) + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error deleting ProcessCloseIDBCleanup database'); + } +} + +function startGetLoop() +{ + var request = window.indexedDB.open("ProcessCloseIDBCleanup"); + request.onsuccess = function(e) + { + var req = e.target.result.transaction(["TestObjectStore"]).objectStore("TestObjectStore").get("foo"); + req.onsuccess = startGetLoop; + req.onerror = function(e) + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error with a get loop'); + } + } + + request.onerror = function(e) + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error with a get loop'); + } +} + +function continueTest2() +{ + var request = window.indexedDB.open("ProcessCloseIDBCleanup"); + request.onsuccess = function(e) + { + for (var i = 0; i < 75; ++i) + startGetLoop(); + + setTimeout("window.webkit.messageHandlers.testHandler.postMessage('Get loops started');", 0); + } + + request.onerror = function(e) + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error opening ProcessCloseIDBCleanup database'); + } + + request.onupgradeneeded = function(e) + { + e.target.result.createObjectStore("TestObjectStore").put("bar", "foo"); + } +} + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html new file mode 100644 index 000000000..872885b75 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-3.html @@ -0,0 +1,21 @@ +<script> + +var request = window.indexedDB.deleteDatabase("ProcessCloseIDBCleanup"); + +request.onsuccess = function(event) +{ + window.webkit.messageHandlers.testHandler.postMessage('Deleted!'); +} + +request.onerror = function() +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database'); +} + +request.onblocked = function(event) +{ + window.webkit.messageHandlers.testHandler.postMessage('Blocked!'); +} + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence-1.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence-1.html new file mode 100644 index 000000000..62a1baf6f --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence-1.html @@ -0,0 +1,35 @@ +<script> + +var request = window.indexedDB.deleteDatabase("IndexedDBPersistence"); +request.onsuccess = function(e) +{ + continueTest(); +} +request.onerror = function(e) +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error'); +} + +function continueTest() +{ + var request = window.indexedDB.open("IndexedDBPersistence", 2); + + request.onsuccess = function() + { + window.webkit.messageHandlers.testHandler.postMessage('Success'); + + } + request.onerror = function() + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error'); + } + request.onupgradeneeded = function(event) + { + window.webkit.messageHandlers.testHandler.postMessage('UpgradeNeeded'); + + event.target.result.createObjectStore("TestObjectStore"); + } +} +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence-2.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence-2.html new file mode 100644 index 000000000..d8ab125f2 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence-2.html @@ -0,0 +1,22 @@ +<script> + +var request = window.indexedDB.open("IndexedDBPersistence"); + +request.onsuccess = function(event) +{ + window.webkit.messageHandlers.testHandler.postMessage(event.target.result.version + " " + event.target.result.objectStoreNames[0]); +} + +request.onerror = function() +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected Error'); +} + +request.onupgradeneeded = function() +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded'); +} + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LineBreaking.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LineBreaking.html new file mode 100644 index 000000000..48da6e69a --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LineBreaking.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<style> +@font-face { + font-family: "AllAhem"; + src: url("AllAhem.svg") format("svg"); +} + +#test { + font: 20px "AllAhem"; +} +</style> +<script> +function runTest(testContent, localeString, lineBreakValue) { + var container = document.getElementById("container"); + var test = document.getElementById("test"); + + test.textContent = testContent; + container.lang = localeString; + container.style.webkitLineBreak = lineBreakValue; + + var current = 0; + var breakpoints = []; + var clientRectsLength = 2; + for (var i = 1; clientRectsLength > 1; i += 5) { + container.style.width = "" + i + "px"; + var width = test.getClientRects()[0].width; + if (current != width) { + current = width; + breakpoints.push(width / 20); + } + clientRectsLength = test.getClientRects().length; + } + return breakpoints; +} +</script> +</head> +<body> +<div id="container" style="width: 99999999px;"> + <span id="test">Hello World</span> +</div> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.html new file mode 100644 index 000000000..11bdd6c14 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageClear.html @@ -0,0 +1,6 @@ +<script> + +window.localStorage.foo = "bar"; +window.webkit.messageHandlers.testHandler.postMessage('Go ahead and clear it'); + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.html new file mode 100644 index 000000000..9878f36ac --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.html @@ -0,0 +1,6 @@ +<script> + +window.localStorage.key(0); +window.webkit.messageHandlers.testHandler.postMessage('DONE'); + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.localstorage b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.localstorage Binary files differnew file mode 100644 index 000000000..0b41b25c7 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.localstorage diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.localstorage-shm b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.localstorage-shm Binary files differnew file mode 100644 index 000000000..fe9ac2845 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageNullEntries.localstorage-shm diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageQuirkEnabled.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageQuirkEnabled.html new file mode 100644 index 000000000..c53f1deb4 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/LocalStorageQuirkEnabled.html @@ -0,0 +1,10 @@ +<script> + +try { + if (window.localStorage) + window.webkit.messageHandlers.testHandler.postMessage('PASS'); +} catch(e) { + window.webkit.messageHandlers.testHandler.postMessage('FAIL'); +} + +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RemoteObjectRegistry.h b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RemoteObjectRegistry.h new file mode 100644 index 000000000..3d2654b98 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RemoteObjectRegistry.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2015 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. + */ + +#import <WebKit/WKFoundation.h> + +#if WK_API_ENABLED + +#import <WebKit/_WKRemoteObjectInterface.h> + +@protocol RemoteObjectProtocol <NSObject> + +- (void)sayHello:(NSString *)hello; +- (void)sayHello:(NSString *)hello completionHandler:(void (^)(NSString *))completionHandler; +- (void)selectionAndClickInformationForClickAtPoint:(NSValue *)pointValue completionHandler:(void (^)(NSDictionary *))completionHandler; +- (void)takeRange:(NSRange)range completionHandler:(void (^)(NSUInteger location, NSUInteger length))completionHandler; +- (void)takeSize:(CGSize)size completionHandler:(void (^)(CGFloat width, CGFloat height))completionHandler; +- (void)doNotCallCompletionHandler:(void (^)())completionHandler; + +@end + +static inline _WKRemoteObjectInterface *remoteObjectInterface() +{ + _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(RemoteObjectProtocol)]; + + [interface setClasses:[NSSet setWithObjects:[NSDictionary class], [NSString class], [NSURL class], nil] forSelector:@selector(selectionAndClickInformationForClickAtPoint:completionHandler:) argumentIndex:0 ofReply:YES]; + + return interface; +} +#endif diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/StoreBlobToBeDeleted.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/StoreBlobToBeDeleted.html new file mode 100644 index 000000000..bcaf972ad --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/StoreBlobToBeDeleted.html @@ -0,0 +1,41 @@ +<script> + +var dbName = "StoreBlobToBeDeleted"; +var request = window.indexedDB.deleteDatabase(dbName); +request.onsuccess = function(e) +{ + continueTest(); +} +request.onerror = function(e) +{ + window.webkit.messageHandlers.testHandler.postMessage('Error deleting database'); +} + +var db; + +function continueTest(event) +{ + var request = window.indexedDB.open(dbName); + + request.onupgradeneeded = function(e) { + db = e.target.result; + var objectStore = db.createObjectStore("TestStore"); + + const blobData = ["fun ", "times ", "all ", "around!"]; + let blob = new Blob(blobData, { type: "text/plain" }); + + var addRequest = objectStore.add(blob, "BlobKey"); + addRequest.onerror = function() { + window.webkit.messageHandlers.testHandler.postMessage('Error storing blob in database'); + } + } + + request.onsuccess = function() { + db.close(); + window.webkit.messageHandlers.testHandler.postMessage('Success'); + } + request.onerror = function() { + window.webkit.messageHandlers.testHandler.postMessage('Error storing blob in database'); + } +} +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentWorldProtocol.h b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentWorldProtocol.h new file mode 100644 index 000000000..0b335792e --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentWorldProtocol.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 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. + */ + +#import <WebKit/WKFoundation.h> + +#if WK_API_ENABLED + +@protocol UserContentWorldProtocol <NSObject> + +- (void)didObserveNormalWorld; +- (void)didObserveWorldWithName:(NSString *)name; + +@end + +#endif diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html new file mode 100644 index 000000000..a9a121e49 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-1.html @@ -0,0 +1,67 @@ +<script> + +var request = window.indexedDB.deleteDatabase("WebProcessKillIDBCleanup"); +request.onsuccess = function(e) +{ + continueTest(); +} +request.onerror = function(e) +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Error deleting database'); +} + +var database; + +function continueTest() +{ + var request = window.indexedDB.open("WebProcessKillIDBCleanup"); + + request.onsuccess = function() + { + window.webkit.messageHandlers.testHandler.postMessage('Open success'); + setTimeout(continueTest2, 0); + } + + request.onerror = function() + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database'); + } + + request.onupgradeneeded = function(event) + { + window.webkit.messageHandlers.testHandler.postMessage('UpgradeNeeded'); + + database = event.target.result; + var store = database.createObjectStore("TestObjectStore"); + + event.target.transaction.oncomplete = function() { + window.webkit.messageHandlers.testHandler.postMessage('Transaction complete'); + } + + event.target.transaction.onerror = function() { + window.webkit.messageHandlers.testHandler.postMessage('Transaction errored!'); + } + + store.put("bar", "foo"); + } +} + +function continueTest2() +{ + var objectStore = database.transaction("TestObjectStore", "readonly").objectStore("TestObjectStore"); + + // Start a get-loop to keep this transaction active. + var shouldMessageClose = true; + function success() { + objectStore.get("foo").onsuccess = success; + if (shouldMessageClose) { + window.webkit.messageHandlers.testHandler.postMessage('Infinite Transaction Started'); + shouldMessageClose = false; + } + } + + objectStore.get("foo").onsuccess = success; +} +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html new file mode 100644 index 000000000..3b3047aca --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebProcessKillIDBCleanup-2.html @@ -0,0 +1,25 @@ +<script> + +var request = window.indexedDB.open("WebProcessKillIDBCleanup"); + +request.onsuccess = function(event) +{ + window.webkit.messageHandlers.testHandler.postMessage('Second open success'); + + event.target.result.transaction("TestObjectStore", "readonly").objectStore("TestObjectStore").get("foo").onsuccess = function() { + window.webkit.messageHandlers.testHandler.postMessage('Second WebView Transaction Started'); + } +} + +request.onerror = function() +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error opening database'); +} + +request.onupgradeneeded = function(event) +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded opening database'); +} +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html new file mode 100644 index 000000000..c429b188a --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html @@ -0,0 +1,3 @@ +<body> +<input id="input" type="text" autofocus/> +</body> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autoplaying-video-with-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autoplaying-video-with-audio.html new file mode 100644 index 000000000..53b456388 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autoplaying-video-with-audio.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> + <script> + var timeout; + + function pauseVideo() { + document.getElementsByTagName("video")[0].pause(); + } + + function handlePaused() { + // Wait until the next runloop to allow media controls to update. + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("paused"); + } catch(e) { } + }, 0); + } + + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } + + </script> +</head> +<body onmousedown=pauseVideo()> + <video autoplay controls onplaying=beganAutoplaying() src="video-with-audio.mp4" webkit-playsinline onpause=handlePaused()></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/blinking-div.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/blinking-div.html new file mode 100644 index 000000000..e0f27aab7 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/blinking-div.html @@ -0,0 +1,23 @@ +<html> + <script> +window.onload = function () { + setInterval(blink, 0); +} + +var a = 0; + +function blink() { + document.getElementById("blink").style.backgroundColor = a ? "blue" : "green"; + a = !a; +} + </script> + <style> +#blink { + width: 200px; height: 200px; + display: inline-block; +} + </style> + <body> + <div id="blink"></div> + </body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-click.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-click.html new file mode 100644 index 000000000..560e6850a --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-click.html @@ -0,0 +1,33 @@ +<head> + <style> + video { + width: 800px; + height: 600px; + } + </style> + <script type="text/javascript"> + function changeSource() { + var video = document.querySelector("video"); + video.src = "large-video-with-audio.mp4"; + video.play(); + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("changed"); + } catch(e) { + } + }); + } + + function handlePlaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0); + } + </script> +</head> +<body> + <video autoplay onplaying=handlePlaying() onmousedown=changeSource() src="large-video-with-audio.mp4"></video> +</body> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-end.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-end.html new file mode 100644 index 000000000..f84f7f7ac --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/change-video-source-on-end.html @@ -0,0 +1,35 @@ +<head> + <style> + video { + width: 800px; + height: 600px; + } + </style> + <script type="text/javascript"> + var hasBegunPlayingBefore = false; + + function changeSource() { + var video = document.querySelector("video"); + video.src = "large-video-with-audio.mp4"; + video.play(); + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("changed"); + } catch(e) { + } + }); + } + + function handlePlaying() { + if (hasBegunPlayingBefore) + return; + + hasBegunPlayingBefore = true; + var video = document.querySelector("video"); + video.currentTime = video.duration - 0.5; + } + </script> +</head> +<body> + <video autoplay onplaying=handlePlaying() src="large-video-with-audio.mp4" onended=changeSource()></video> +</body> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/duplicate-completion-handler-calls.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/duplicate-completion-handler-calls.html new file mode 100644 index 000000000..1e7492bed --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/duplicate-completion-handler-calls.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<form action="about:blank"></form> +<script> + alert("alert"); + confirm("confirm"); + prompt("prompt"); + openDatabase("testDatabase", "1", "test database", 1024); + document.forms[0].submit(); +</script> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/editable-body.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/editable-body.html new file mode 100644 index 000000000..0c7baced7 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/editable-body.html @@ -0,0 +1,7 @@ +<html> + <body contenteditable>Lorem Ipsum Et Cetera + <script> + document.body.focus(); + </script> + </body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html new file mode 100644 index 000000000..0934f5ed8 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/enormous-video-with-sound.html @@ -0,0 +1,15 @@ +<html> +<head> +<script> + function handlePlaying() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { + } + } +</script> +</head> +<body> + <video autoplay src="large-video-with-audio.mp4" width=65536 height=65536 onplaying=handlePlaying()></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/focus-inputs.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/focus-inputs.html new file mode 100644 index 000000000..9f292c79d --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/focus-inputs.html @@ -0,0 +1,15 @@ +<html> +<head> +<script> +function focusPasswordField() { + var password = document.getElementById("password"); + password.focus(); +} +</script> +</head> + +<body> +<input type="text" autofocus/> +<input id="password" type="password" /> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html new file mode 100644 index 000000000..48301e630 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/full-size-autoplaying-video-with-audio.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> + <style> + video { + width: 100vw; + height: 100vh; + } + </style> + <script> + function finishTest() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { } + }, 0); + } + </script> +</head> +<body> + <video autoplay src="video-with-audio.mp4" webkit-playsinline onplaying=finishTest()></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/input-field-in-scrollable-document.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/input-field-in-scrollable-document.html new file mode 100644 index 000000000..6eedf375c --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/input-field-in-scrollable-document.html @@ -0,0 +1,36 @@ +<html> + +<head> + <style> + body { + margin: 0; + } + + input { + width: 100%; + height: 400px; + margin-bottom: 5000px; + } + </style> + <script type="text/javascript"> + function loaded() { + var input = document.querySelector("input"); + input.setSelectionRange(0, 0); + input.focus(); + } + + function focused() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("focused"), 0); + } + + function input() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("input"), 0); + } + </script> +</head> + +<body onload=loaded()> + <input onfocus=focused() oninput=input()></input> +</body> + +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html new file mode 100644 index 000000000..0671a12f5 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-input-field-focus-onload.html @@ -0,0 +1,38 @@ +<html> + +<head> + <style> + body { + margin: 0; + } + + input { + width: 100vw; + height: 100vh; + font-size: 50vh; + } + </style> + <script type="text/javascript"> + function loaded() { + document.querySelector("input").focus(); + } + + function focused() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("focused"), 0); + } + + function input() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("input"), 0); + } + + function mousedown() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("mousedown"), 0); + } + </script> +</head> + +<body onload=loaded()> + <input onfocus=focused() oninput=input() onmousedown=mousedown()></input> +</body> + +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-hides-controls-after-seek-to-end.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-hides-controls-after-seek-to-end.html new file mode 100644 index 000000000..0102e9629 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-hides-controls-after-seek-to-end.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> + <script> + + function handleEnded() { + // The media controls should be updated on the next runloop. + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("ended"); + } catch(e) { } + }, 0); + } + + function seekToEnd() { + var video = document.getElementsByTagName("video")[0]; + video.currentTime = video.duration; + } + + function beginTest() { + try { + window.webkit.messageHandlers.onloadHandler.postMessage("loaded"); + } catch(e) { } + } + + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } + + </script> +</head> +<body onmousedown=seekToEnd() onload=beginTest()> + <video autoplay onplaying=beganAutoplaying() onended=handleEnded() src="large-video-with-audio.mp4" webkit-playsinline style="width: 800px; height: 600px;"></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-mutes-onplaying.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-mutes-onplaying.html new file mode 100644 index 000000000..38fb32552 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-mutes-onplaying.html @@ -0,0 +1,16 @@ +<html> +<head> +<script> + function handlePlaying() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { + } + document.querySelector("video").muted = true; + } +</script> +</head> +<body> + <video autoplay src="large-video-with-audio.mp4" width=640 height=480 onplaying=handlePlaying()></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-offscreen.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-offscreen.html new file mode 100644 index 000000000..39cf476ab --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-offscreen.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> + <style> + video { + width: 480px; + height: 320px; + position: absolute; + } + .offscreen { + top: -320px; + } + </style> + <script> + function moveVideoOffscreen() { + document.querySelector("video").classList.add("offscreen"); + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("moved"); + } catch(e) { + } + }, 0); + } + </script> +</head> +<body> + <video autoplay onplaying=moveVideoOffscreen()><source src="large-video-with-audio.mp4"></video> +</body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-playing-scroll-away.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-playing-scroll-away.html new file mode 100644 index 000000000..0b7e09a32 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-playing-scroll-away.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> + <head> + <style> + video { + width: 480px; + height: 320px; + } + div { + margin-top: 5000px; + } + </style> + <script> + function scrollVideoOutOfView() { + document.querySelector("div").scrollIntoView(); + setTimeout(function() { + window.webkit.messageHandlers.testHandler.postMessage("scrolled"); + }, 0); + } + + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } + </script> + </head> + <body> + <video autoplay onplaying=beganAutoplaying() loop id="first" src="large-video-with-audio.mp4"></video> + <br> + <div>hello world!</div> + </body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-after-ending.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-after-ending.html new file mode 100644 index 000000000..0386540a3 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-after-ending.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> +<head> + <script> + function seekToBeginningAndFinishTest() { + document.querySelector("#test-video").currentTime = 0; + // The media controls should be updated on the next runloop. + setTimeout(function() { + window.webkit.messageHandlers.testHandler.postMessage("ended"); + }, 0); + } + + function seekToEnd() { + document.querySelector("#test-video").currentTime = document.querySelector("#test-video").duration - 0.1; + } + </script> +</head> +<body> + <video id="test-video" autoplay onended=seekToBeginningAndFinishTest() onplaying=seekToEnd() style="width: 800px; height: 600px;" src="large-video-with-audio.mp4"></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-to-beginning-and-play-after-ending.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-to-beginning-and-play-after-ending.html new file mode 100644 index 000000000..ada9a2d12 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-seek-to-beginning-and-play-after-ending.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> + <script> + function seekToBeginningAndFinishTest() { + var video = document.querySelector("#test-video"); + video.currentTime = 0; + video.play(); + // The media controls should be updated on the next runloop. + setTimeout(function() { + window.webkit.messageHandlers.testHandler.postMessage("replaying"); + }, 0); + } + + function seekToEnd() { + document.querySelector("#test-video").currentTime = document.querySelector("#test-video").duration - 0.1; + } + </script> +</head> +<body> + <video id="test-video" autoplay onended=seekToBeginningAndFinishTest() onplaying=seekToEnd() style="width: 800px; height: 600px;" src="large-video-with-audio.mp4"></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-test-now-playing.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-test-now-playing.html new file mode 100644 index 000000000..657dbd739 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-test-now-playing.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> + <style> + video { + width: 480px; + height: 320px; + position: absolute; + } + + body { + margin: 0; + } + </style> + <script> + function playing() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { + } + }, 0); + } + + function mousedown() { + document.querySelector("video").muted = true; + } + </script> +</head> +<body> + <video autoplay title="foo" onmousedown=mousedown() onplaying=playing()><source src="large-video-with-audio.mp4"></video> +</body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html new file mode 100644 index 000000000..8c982ae5c --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.html @@ -0,0 +1,12 @@ +<html> +<head> +<script> + function play() { + document.getElementsByTagName('video')[0].play(); + } +</script> +</head> +<body onload="play()"> + <video src="large-video-with-audio.mp4" width=640 height=480></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4 b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4 Binary files differnew file mode 100644 index 000000000..4b4bcff48 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-with-audio.mp4 diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html new file mode 100644 index 000000000..27838eb25 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-video-without-audio.html @@ -0,0 +1,29 @@ +<html> +<head> +<script> + var timeout; + + function go() { + var video = document.getElementsByTagName('video')[0]; + video.play().then(playing).catch(notPlaying); + } + + function playing() { + try { + window.webkit.messageHandlers.testHandler.postMessage('playing'); + } catch(e) { + window.location = 'callback:playing'; + } + } + + function notPlaying() { + try { + window.webkit.messageHandlers.testHandler.postMessage('not playing'); + } catch(e) { } + } +</script> +</head> +<body onload="go()"> + <video id="test-video" src="video-without-audio.mp4" controls width=640 height=480></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html new file mode 100644 index 000000000..22dbebf12 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> + <head> + <style> + video { + width: 480px; + height: 320px; + } + </style> + <script> + var isFirstClick = true; + function handleMouseDown() { + document.querySelector(isFirstClick ? "#first" : "#second").pause(); + isFirstClick = false; + } + + function handleFirstPause() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("paused"); + } catch(e) { } + }, 0); + } + + function handleSecondPause() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("paused"); + } catch(e) { } + }, 0); + } + + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } + </script> + </head> + <body onmousedown=handleMouseDown()> + <video autoplay onplaying=beganAutoplaying() loop id="first" src="large-video-with-audio.mp4" onpause=handleFirstPause()></video> + <video autoplay onplaying=beganAutoplaying() loop id="second" src="large-video-with-audio.mp4" onpause=handleSecondPause()></video> + </body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-scroll-to-video.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-scroll-to-video.html new file mode 100644 index 000000000..d1c1aaea9 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-scroll-to-video.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <style> + video { + width: 480px; + height: 320px; + } + #second { + margin-top: 5000px; + } + </style> + <script> + function scrollToSecondView() { + document.querySelector("#second").scrollIntoView(); + setTimeout(function() { + window.webkit.messageHandlers.testHandler.postMessage("scrolled"); + }, 0); + } + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } + </script> + </head> + <body> + <video autoplay onplaying=beganAutoplaying() loop id="first" src="large-video-with-audio.mp4"></video> + <br> + <video autoplay onplaying=beganAutoplaying() loop id="second" src="large-video-with-audio.mp4"></video> + </body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-paused-video-hides-controls.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-paused-video-hides-controls.html new file mode 100644 index 000000000..31f86cbc9 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-paused-video-hides-controls.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> +<style> + video { + width: 480px; + height: 320px; + } + #bar { + margin-top: 5000px; + } +</style> +<script> + function pauseFirstVideoAndScrollToSecondVideo() { + document.querySelector("#bar").scrollIntoView(); + document.querySelector("#foo").pause(); + } + function handlePaused() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("paused"); + } catch(e) { } + }, 0); + } + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } +</script> +<body> + <video autoplay onplaying=beganAutoplaying() loop id="foo" onpause=handlePaused()><source src="large-video-with-audio.mp4"></video> + <br> + <video id="bar"><source src="large-video-with-audio.mp4"></video> +</body> +<html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-muted-video-hides-controls.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-muted-video-hides-controls.html new file mode 100644 index 000000000..34486e2e3 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-muted-video-hides-controls.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> +<style> + video { + width: 480px; + height: 320px; + } + #bar { + margin-top: 5000px; + } +</style> +<script> + function muteFirstVideoAndScrollToSecondVideo() { + document.querySelector("#foo").muted = true; + document.querySelector("#bar").scrollIntoView(); + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { } + }, 0); + } + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } +</script> +<body> + <video autoplay onplaying=beganAutoplaying() loop id="foo"><source src="large-video-with-audio.mp4"></video> + <br> + <video id="bar"><source src="large-video-with-audio.mp4"></video> +</body> +<html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-video-keeps-controls.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-video-keeps-controls.html new file mode 100644 index 000000000..b6fcf7a05 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-playing-video-keeps-controls.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<style> + video { + width: 480px; + height: 320px; + } + #bar { + margin-top: 5000px; + } +</style> +<script> + function scrollToSecondVideo() { + document.querySelector("#bar").scrollIntoView(); + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("scrolled"); + } catch(e) { } + }, 0); + } + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } +</script> +<body> + <video autoplay onplaying=beganAutoplaying() loop id="foo"><source src="large-video-with-audio.mp4"></video> + <br> + <video id="bar"><source src="large-video-with-audio.mp4"></video> +</body> +<html>
\ No newline at end of file diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html new file mode 100644 index 000000000..3e170ced5 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio-autoplay.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<script> + function beganAutoplaying() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("autoplayed"); + } catch(e) { + } + }, 0) + } +</script> +<body> + <video id="foo" style="width: 480px; height: 320px;"><source src="large-video-with-audio.mp4"></video> + <video autoplay onplaying=beganAutoplaying() id="bar" style="width: 480px; height: 320px;"><source src="large-video-with-audio.mp4"></video> + <video id="baz" style="width: 480px; height: 320px;"><source src="large-video-with-audio.mp4"></video> +</body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio.html new file mode 100644 index 000000000..0fdde2f2a --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-with-audio.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<script> + function handleLoaded() { + // The media controls should be updated on the next runloop. + setTimeout(function() { + try { + window.webkit.messageHandlers.onloadHandler.postMessage("loaded"); + } catch(e) { } + }, 0); + } +</script> +<body onload=handleLoaded()> + <video id="foo" style="width: 480px; height: 320px;"><source src="large-video-with-audio.mp4"></video> + <video id="bar" style="width: 480px; height: 320px;"><source src="large-video-with-audio.mp4"></video> + <video id="baz" style="width: 480px; height: 320px;"><source src="large-video-with-audio.mp4"></video> +</body> +<html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/open-multiple-external-url.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/open-multiple-external-url.html new file mode 100644 index 000000000..9c3df85e2 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/open-multiple-external-url.html @@ -0,0 +1,66 @@ +<style> + iframe { width: 0; height: 0; visibility: hidden; } +</style> + +<body> + +<script> +window.addEventListener("click", function() { + let hash = window.location.hash; + switch (hash) { + case "#normalLoop": + normalLoop(); + break; + case "#loopAfterTimer": + loopAfterTimer(); + break; + case "#loopAfterPostMessage": + loopAfterPostMessage(); + break; + case "#loopAfterLongTimer": + loopAfterLongTimer(); + break; + } +}, false); + +function normalLoop() { + for (var i = 0; i < 3; ++i) { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + iframe.contentWindow.location = "mailto:someone@example.com?Subject=Hello%20again"; + } +} + +function loopAfterTimer() { + setTimeout(function() { + for (var i = 0; i < 3; ++i) { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + iframe.contentWindow.location = "mailto:someone@example.com?Subject=Hello%20again"; + } + }, 500); +} + +function loopAfterPostMessage() { + window.onmessage = function() { + for (var i = 0; i < 3; ++i) { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + iframe.contentWindow.location = "mailto:someone@example.com?Subject=Hello%20again"; + } + } + window.postMessage("foo", "*"); +} + +function loopAfterLongTimer() { + setTimeout(function() { + for (var i = 0; i < 3; ++i) { + var iframe = document.createElement('iframe'); + document.body.appendChild(iframe); + iframe.contentWindow.location = "mailto:someone@example.com?Subject=Hello%20again"; + } + }, 2000); +} + +</script> +</body> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-with-csp-iframe.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-with-csp-iframe.html new file mode 100644 index 000000000..4c2a9dbb6 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-with-csp-iframe.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Security-Policy" content="script-src 'none'"> +</head> +<body> +<script nonce="a"> +window.webkit.messageHandlers.testHandler.postMessage("Subframe: A"); +</script> +<script nonce="b"> +window.webkit.messageHandlers.testHandler.postMessage("Subframe: B"); +</script> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-with-csp.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-with-csp.html new file mode 100644 index 000000000..3fb76fe84 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-with-csp.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> +<meta http-equiv="Content-Security-Policy" content="script-src 'none'"> +</head> +<body> +<script nonce="a"> +window.webkit.messageHandlers.testHandler.postMessage("MainFrame: A"); +</script> +<script nonce="b"> +window.webkit.messageHandlers.testHandler.postMessage("MainFrame: B"); +</script> +<iframe id="iframe" src="page-with-csp-iframe.html"></iframe> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-without-csp-iframe.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-without-csp-iframe.html new file mode 100644 index 000000000..84a23d5f0 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-without-csp-iframe.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html> +<body> +<script nonce="a"> +window.webkit.messageHandlers.testHandler.postMessage("Subframe: A"); +</script> +<script nonce="b"> +window.webkit.messageHandlers.testHandler.postMessage("Subframe: B"); +</script> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-without-csp.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-without-csp.html new file mode 100644 index 000000000..74cecafe8 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/page-without-csp.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<body> +<script nonce="a"> +window.webkit.messageHandlers.testHandler.postMessage("MainFrame: A"); +</script> +<script nonce="b"> +window.webkit.messageHandlers.testHandler.postMessage("MainFrame: B"); +</script> +<iframe id="iframe" src="page-without-csp-iframe.html"></iframe> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/play-audio-on-click.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/play-audio-on-click.html new file mode 100644 index 000000000..d7768a64e --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/play-audio-on-click.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html> +<head> + <style> + div { + width: 400px; + height: 400px; + background-color: red; + } + body { + margin: 0; + } + </style> + <script> + var audio; + + function playFirstTrack() + { + audio = document.createElement("audio"); + audio.src = "video-with-audio.mp4"; + audio.id = "first"; + audio.onplaying = audioPlayingHandler("first"); + audio.onended = playSecondTrack; + audio.play(); + } + + function playSecondTrack() + { + audio = document.createElement("audio"); + audio.src = "large-video-with-audio.mp4"; + audio.id = "second"; + audio.onplaying = audioPlayingHandler("second"); + audio.play(); + } + + function seekToEnd() + { + audio.currentTime = audio.duration - 0.5; + } + + function audioPlayingHandler(id) + { + return function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing-" + id); + } catch(e) {} + } + } + </script> +</head> +<body> + <div onmousedown=playFirstTrack()>Click me to start playing!</div> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html new file mode 100644 index 000000000..26ef53dc2 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/skinny-autoplaying-video-with-audio.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> + <style> + video { + width: 300vw; + height: 40vh; + } + </style> + <script> + function finishTest() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { } + }, 0); + } + </script> +</head> +<body> + <video autoplay src="video-with-audio.mp4" webkit-playsinline onplaying=finishTest()></video> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html new file mode 100644 index 000000000..e7e11db24 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/text-and-password-inputs.html @@ -0,0 +1,39 @@ +<html> +<head> + <script> + function loaded() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("loaded"), 0); + } + + function textFocused() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("text-focused"), 0); + } + + function textInput() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("text-input"), 0); + } + + function passwordFocused() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("password-focused"), 0); + } + + function passwordInput() { + setTimeout(() => window.webkit.messageHandlers.testHandler.postMessage("password-input"), 0); + } + </script> + + <style> + input { + width: 100%; + height: 50%; + font-size: 100px; + } + body { margin: 0; } + </style> +</head> + +<body onload=loaded() onmousedown=mousedown(event)> + <input id="text" type="text" onfocus=textFocused() oninput=textInput()></input> + <input id="password" type="password" onfocus=passwordFocused() oninput=passwordInput()></input> +</body> +</html> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/wide-autoplaying-video-with-audio.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/wide-autoplaying-video-with-audio.html new file mode 100644 index 000000000..ea2cb5063 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/wide-autoplaying-video-with-audio.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> + <style> + video { + width: 800px; + height: 400px; + } + </style> + <script> + function finishTest() { + setTimeout(function() { + try { + window.webkit.messageHandlers.testHandler.postMessage("playing"); + } catch(e) { } + }, 0); + } + </script> +</head> +<body> + <video autoplay src="video-with-audio.mp4" webkit-playsinline onplaying=finishTest()></video> +</body> +</html> |