diff options
| author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-05-24 08:28:08 +0000 |
|---|---|---|
| committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-05-24 08:28:08 +0000 |
| commit | a4e969f4965059196ca948db781e52f7cfebf19e (patch) | |
| tree | 6ca352808c8fdc52006a0f33f6ae3c593b23867d /Tools/TestWebKitAPI/Tests/WebKit2Cocoa | |
| parent | 41386e9cb918eed93b3f13648cbef387e371e451 (diff) | |
| download | WebKitGtk-tarball-a4e969f4965059196ca948db781e52f7cfebf19e.tar.gz | |
webkitgtk-2.12.3webkitgtk-2.12.3
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2Cocoa')
7 files changed, 217 insertions, 0 deletions
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/IndexedDBMultiProcess-1.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-1.html new file mode 100644 index 000000000..e3e8552a5 --- /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 opening database'); +} + +function continueTest() +{ + var request = window.indexedDB.open("IndexedDBMultiProcess", 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'); + + 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..3e4e2d7da --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBMultiProcess-2.html @@ -0,0 +1,32 @@ +<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); + } + + req.onerror = function(event) + { + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error'); + } +} + +request.onerror = function() +{ + // Unexpected error + window.webkit.messageHandlers.testHandler.postMessage('Unexpected error'); +} + +request.onupgradeneeded = function(event) +{ + // Unexpected upgrade needed + window.webkit.messageHandlers.testHandler.postMessage('Unexpected UpgradeNeeded'); +} +</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/RemoteObjectRegistry.h b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RemoteObjectRegistry.h new file mode 100644 index 000000000..b72826817 --- /dev/null +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RemoteObjectRegistry.h @@ -0,0 +1,48 @@ +/* + * 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; + +@end + +static inline _WKRemoteObjectInterface *remoteObjectInterface() +{ + _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(RemoteObjectProtocol)]; + + [interface setClasses:[NSSet setWithObjects:[NSDictionary class], [NSURL class], nil] forSelector:@selector(selectionAndClickInformationForClickAtPoint:completionHandler:) argumentIndex:0 ofReply:YES]; + + return interface; +} +#endif |
