summaryrefslogtreecommitdiffstats
path: root/WebKitTools/WebKitTestRunner/TestInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/WebKitTestRunner/TestInvocation.cpp')
-rw-r--r--WebKitTools/WebKitTestRunner/TestInvocation.cpp44
1 files changed, 9 insertions, 35 deletions
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index 658911b..9a0f0aa 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -26,47 +26,18 @@
#include "TestInvocation.h"
#include "PlatformWebView.h"
+#include "StringFunctions.h"
#include "TestController.h"
#include <WebKit2/WKContextPrivate.h>
+#include <WebKit2/WKPreferencesPrivate.h>
#include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKStringCF.h>
-#include <WebKit2/WKURLCF.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
using namespace WebKit;
+using namespace std;
namespace WTR {
-static WKURLRef createWKURL(const char* pathOrURL)
-{
- RetainPtr<CFStringRef> pathOrURLCFString(AdoptCF, CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingUTF8));
- RetainPtr<CFURLRef> cfURL;
- if (CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("http://")) || CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("https://")))
- cfURL.adoptCF(CFURLCreateWithString(0, pathOrURLCFString.get(), 0));
- else
-#if defined(WIN32) || defined(_WIN32)
- cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false));
-#else
- cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false));
-#endif
- return WKURLCreateWithCFURL(cfURL.get());
-}
-
-static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
-{
- RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
- CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
- OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
- if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
- buffer->shrink(1);
- (*buffer)[0] = 0;
- } else
- buffer->shrink(strlen(buffer->data()) + 1);
- return buffer.release();
-}
-
TestInvocation::TestInvocation(const char* pathOrURL)
: m_url(AdoptWK, createWKURL(pathOrURL))
, m_pathOrURL(fastStrDup(pathOrURL))
@@ -99,8 +70,8 @@ static void sizeWebViewForCurrentTest(char* pathOrURL)
void TestInvocation::resetPreferencesToConsistentValues()
{
WKPreferencesRef preferences = WKContextGetPreferences(TestController::shared().context());
-
WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
+ WKPreferencesSetFontSmoothingLevel(preferences, kWKFontSmoothingLevelNoSubpixelAntiAliasing);
}
void TestInvocation::invoke()
@@ -165,8 +136,11 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
if (CFEqual(cfMessageName.get(), CFSTR("Done"))) {
ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
- OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(static_cast<WKStringRef>(messageBody));
- dump(utf8Message->data());
+ ostringstream out;
+ out << static_cast<WKStringRef>(messageBody);
+
+ dump(out.str().c_str());
+
m_gotFinalMessage = true;
return;
}