Title: [169992] trunk/Tools
Revision
169992
Author
[email protected]
Date
2014-06-15 12:12:31 -0700 (Sun, 15 Jun 2014)

Log Message

Fix build.

* TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm:
(callRunJavaScriptBlockAndRelease):
(runJavaScriptInMainFrame):
(TEST_F):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (169991 => 169992)


--- trunk/Tools/ChangeLog	2014-06-15 18:23:50 UTC (rev 169991)
+++ trunk/Tools/ChangeLog	2014-06-15 19:12:31 UTC (rev 169992)
@@ -1,3 +1,12 @@
+2014-06-15  Anders Carlsson  <[email protected]>
+
+        Fix build.
+
+        * TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm:
+        (callRunJavaScriptBlockAndRelease):
+        (runJavaScriptInMainFrame):
+        (TEST_F):
+
 2014-06-13  Xabier Rodriguez Calvar  <[email protected]>
 
         Create MSE and EME watchlist

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm (169991 => 169992)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm	2014-06-15 18:23:50 UTC (rev 169991)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2ObjC/UserContentTest.mm	2014-06-15 19:12:31 UTC (rev 169992)
@@ -104,6 +104,20 @@
     JSGlobalContextRelease(scriptContext);
 }
 
+typedef void (^RunJavaScriptBlock)(WKSerializedScriptValueRef, WKErrorRef);
+
+static void callRunJavaScriptBlockAndRelease(WKSerializedScriptValueRef resultValue, WKErrorRef error, void* context)
+{
+    auto block = (RunJavaScriptBlock)context;
+    block(resultValue, error);
+    Block_release(block);
+}
+
+static void runJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, RunJavaScriptBlock block)
+{
+    WKPageRunJavaScriptInMainFrame(pageRef, scriptRef, Block_copy(block), callRunJavaScriptBlockAndRelease);
+}
+
 TEST_F(WebKit2UserContentTest, AddUserStyleSheetBeforeCreatingView)
 {
     testFinished = false;
@@ -112,7 +126,7 @@
     WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup];
     WKStringRef backgroundColorQuery = WKStringCreateWithUTF8CString(backgroundColorScript);
     wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
-        WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
+        runJavaScriptInMainFrame(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
             expectScriptValueIsString(serializedScriptValue, greenInRGB);
             testFinished = true;
             WKRelease(backgroundColorQuery);
@@ -131,7 +145,7 @@
     WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup];
     WKStringRef backgroundColorQuery = WKStringCreateWithUTF8CString(backgroundColorScript);
     wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
-        WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
+        runJavaScriptInMainFrame(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
             expectScriptValueIsString(serializedScriptValue, greenInRGB);
             testFinished = true;
             WKRelease(backgroundColorQuery);
@@ -153,7 +167,7 @@
     WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup];
     WKStringRef backgroundColorQuery = WKStringCreateWithUTF8CString(backgroundColorScript);
     wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
-        WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
+        runJavaScriptInMainFrame(wkView.pageRef, backgroundColorQuery, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
             expectScriptValueIsString(serializedScriptValue, redInRGB);
             testFinished = true;
             WKRelease(backgroundColorQuery);
@@ -175,7 +189,7 @@
     WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup];
     WKStringRef userScriptTestPropertyString = WKStringCreateWithUTF8CString(userScriptTestProperty);
     wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
-        WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
+        runJavaScriptInMainFrame(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
             expectScriptValueIsBoolean(serializedScriptValue, true);
             testFinished = true;
             WKRelease(userScriptTestPropertyString);
@@ -194,7 +208,7 @@
     WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup];
     WKStringRef userScriptTestPropertyString = WKStringCreateWithUTF8CString(userScriptTestProperty);
     wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
-        WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
+        runJavaScriptInMainFrame(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
             expectScriptValueIsBoolean(serializedScriptValue, true);
             testFinished = true;
             WKRelease(userScriptTestPropertyString);
@@ -216,7 +230,7 @@
     WKView *wkView = [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup browsingContextGroup:browsingContextGroup];
     WKStringRef userScriptTestPropertyString = WKStringCreateWithUTF8CString(userScriptTestProperty);
     wkView.browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
-        WKPageRunJavaScriptInMainFrame_b(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
+        runJavaScriptInMainFrame(wkView.pageRef, userScriptTestPropertyString, ^(WKSerializedScriptValueRef serializedScriptValue, WKErrorRef error) {
             expectScriptValueIsUndefined(serializedScriptValue);
             testFinished = true;
             WKRelease(userScriptTestPropertyString);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to