Commit ae377f68 authored by andersca@apple.com's avatar andersca@apple.com

Remove WKConnectionRef tests

https://bugs.webkit.org/show_bug.cgi?id=126666

Reviewed by Dan Bernstein.

The WKConnectionRef is poorly designed but thankfully not used anywhere.
Remove the API tests as a first step towards killing the entire thing.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/WKConnection.cpp: Removed.
* TestWebKitAPI/Tests/WebKit2/WKConnection_Bundle.cpp: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fe4e2eb6
2014-01-08 Anders Carlsson <andersca@apple.com>
Remove WKConnectionRef tests
https://bugs.webkit.org/show_bug.cgi?id=126666
Reviewed by Dan Bernstein.
The WKConnectionRef is poorly designed but thankfully not used anywhere.
Remove the API tests as a first step towards killing the entire thing.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/WKConnection.cpp: Removed.
* TestWebKitAPI/Tests/WebKit2/WKConnection_Bundle.cpp: Removed.
2014-01-08 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r161512.
......
......@@ -176,8 +176,6 @@
BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; };
BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */; };
BC901E241492ADCE0074A667 /* WKConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC901E221492ADCE0074A667 /* WKConnection.cpp */; };
BC901E331492AF390074A667 /* WKConnection_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC901E311492AF390074A667 /* WKConnection_Bundle.cpp */; };
BC90955D125548AA00083756 /* PlatformWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC90955C125548AA00083756 /* PlatformWebViewMac.mm */; };
BC90977A125571AB00083756 /* PageLoadBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC909779125571AB00083756 /* PageLoadBasic.cpp */; };
BC909784125571CF00083756 /* simple.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = BC909778125571AB00083756 /* simple.html */; };
......@@ -505,8 +503,6 @@
BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = InjectedBundle.xcconfig; sourceTree = "<group>"; };
BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformUtilities.cpp; sourceTree = "<group>"; };
BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPreferences.cpp; sourceTree = "<group>"; };
BC901E221492ADCE0074A667 /* WKConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKConnection.cpp; sourceTree = "<group>"; };
BC901E311492AF390074A667 /* WKConnection_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKConnection_Bundle.cpp; sourceTree = "<group>"; };
BC90951B125533D700083756 /* PlatformWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWebView.h; sourceTree = "<group>"; };
BC90955C125548AA00083756 /* PlatformWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformWebViewMac.mm; sourceTree = "<group>"; };
BC90957E12554CF900083756 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
......@@ -815,8 +811,6 @@
7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */,
76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */,
76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */,
BC901E221492ADCE0074A667 /* WKConnection.cpp */,
BC901E311492AF390074A667 /* WKConnection_Bundle.cpp */,
51E93016156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp */,
BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
BC90995D12567BC100083756 /* WKString.cpp */,
......@@ -1278,7 +1272,6 @@
F6B7BE9417469209008A3445 /* DidAssociateFormControls.cpp in Sources */,
BC3C4C7F14587AA60025FB62 /* WKBrowsingContextGroupTest.mm in Sources */,
BC3C4C7214575B6A0025FB62 /* WKBrowsingContextLoadDelegateTest.mm in Sources */,
BC901E241492ADCE0074A667 /* WKConnection.cpp in Sources */,
51E93017156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp in Sources */,
BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */,
BC90995E12567BC100083756 /* WKString.cpp in Sources */,
......@@ -1325,7 +1318,6 @@
BC22D31914DC68B900FFB1DD /* UserMessage_Bundle.cpp in Sources */,
520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */,
76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */,
BC901E331492AF390074A667 /* WKConnection_Bundle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
#include "Test.h"
namespace TestWebKitAPI {
// State for part 1 - setting up the connection.
static bool connectionEstablished;
static WKConnectionRef connectionToBundle;
// State for part 2 - send/recieving messages.
static bool messageReceived;
// State for part 3 - tearing down the connection.
static bool connectionTornDown;
/* WKContextConnectionClient */
static void didCreateConnection(WKContextRef context, WKConnectionRef connection, const void* clientInfo)
{
connectionEstablished = true;
// Store off the conneciton to use.
connectionToBundle = (WKConnectionRef)WKRetain(connection);
}
/* WKConnectionClient */
static void connectionDidReceiveMessage(WKConnectionRef connection, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
// We only expect to get the "Pong" message.
EXPECT_WK_STREQ(messageName, "PongMessageName");
EXPECT_WK_STREQ((WKStringRef)messageBody, "PongMessageBody");
messageReceived = true;
}
static void connectionDidClose(WKConnectionRef connection, const void* clientInfo)
{
connectionTornDown = true;
}
TEST(WebKit2, WKConnectionTest)
{
WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("WKConnectionTest"));
// Set up the context's connection client so that we can access the connection when
// it is created.
WKContextConnectionClientV0 contextConnectionClient;
memset(&contextConnectionClient, 0, sizeof(contextConnectionClient));
contextConnectionClient.base.version = kWKContextConnectionClientCurrentVersion;
contextConnectionClient.didCreateConnection = didCreateConnection;
WKContextSetConnectionClient(context.get(), &contextConnectionClient.base);
// Load a simple page to start the WebProcess and establish a connection.
PlatformWebView webView(context.get());
WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
WKPageLoadURL(webView.page(), url.get());
// Wait until the connection is established.
Util::run(&connectionEstablished);
ASSERT_NOT_NULL(connectionToBundle);
// Setup a client on the connection so we can listen for messages and
// tear down notifications.
WKConnectionClientV0 connectionClient;
memset(&connectionClient, 0, sizeof(connectionClient));
connectionClient.base.version = 0;
connectionClient.didReceiveMessage = connectionDidReceiveMessage;
connectionClient.didClose = connectionDidClose;
WKConnectionSetConnectionClient(connectionToBundle, &connectionClient.base);
// Post a simple message to the bundle via the connection.
WKConnectionPostMessage(connectionToBundle, Util::toWK("PingMessageName").get(), Util::toWK("PingMessageBody").get());
// Wait for the reply.
Util::run(&messageReceived);
// Terminate the page to force the connection closed.
WKPageTerminate(webView.page());
// Wait for the connection to close.
Util::run(&connectionTornDown);
// This release is to balance the retain in didCreateConnection.
WKRelease(connectionToBundle);
}
} // namespace TestWebKitAPI
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "InjectedBundleTest.h"
#include "PlatformUtilities.h"
#include <WebKit2/WKRetainPtr.h>
namespace TestWebKitAPI {
/* WKConnectionClient */
static void connectionDidReceiveMessage(WKConnectionRef connection, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
// Post a simple message to the back to the application layer.
WKConnectionPostMessage(connection, Util::toWK("PongMessageName").get(), Util::toWK("PongMessageBody").get());
}
class WKConnectionTest : public InjectedBundleTest {
public:
WKConnectionTest(const std::string& identifier)
: InjectedBundleTest(identifier)
{
}
virtual void initialize(WKBundleRef bundle, WKTypeRef)
{
WKConnectionClientV0 connectionClient;
memset(&connectionClient, 0, sizeof(connectionClient));
connectionClient.base.version = WKConnectionClientCurrentVersion;
connectionClient.didReceiveMessage = connectionDidReceiveMessage;
WKConnectionSetConnectionClient(WKBundleGetApplicationConnection(bundle), &connectionClient.base);
}
};
static InjectedBundleTest::Register<WKConnectionTest> registrar("WKConnectionTest");
} // namespace TestWebKitAPI
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment