+2010-10-07 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ WebKitTestRunner should be portable
+ https://bugs.webkit.org/show_bug.cgi?id=45393
+
+ Introducing additional URL API.
+ * Shared/API/c/WKURL.cpp:
+ (WKURLCreateWithUTF8CString):
+ (WKURLIsEqual):
+ * Shared/API/c/WKURL.h:
+
2010-10-06 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
+2010-10-07 Balazs Kelemen <kbalazs@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ WebKitTestRunner should be portable
+ https://bugs.webkit.org/show_bug.cgi?id=45393
+
+ Use only the WebKit API for working with urls.
+ * WebKitTestRunner/StringFunctions.h:
+ (WTR::createWKURL):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::blankURL):
+ (WTR::TestController::resetStateToConsistentValues):
+ (WTR::TestController::didFinishLoadForFrame):
+
2010-10-07 Carlos Garcia Campos <cgarcia@igalia.com>
Reviewed by Xan Lopez.
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 University of Szeged. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include <JavaScriptCore/JSRetainPtr.h>
#include <JavaScriptCore/JavaScript.h>
+#include <sstream>
+#include <string>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKString.h>
-#include <WebKit2/WKStringCF.h>
#include <WebKit2/WKStringPrivate.h>
#include <WebKit2/WKURL.h>
-#include <WebKit2/WKURLCF.h>
-#include <sstream>
-#include <string>
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnArrayPtr.h>
#include <wtf/Platform.h>
-#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
namespace WTR {
return out << stringRef.get();
}
-// URL Functions
+// URL creation
inline 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 PLATFORM(WIN)
- cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false));
-#else
- cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false));
-#endif
- return WKURLCreateWithCFURL(cfURL.get());
-}
-
-inline WKStringRef copyURLString(WKURLRef url)
-{
- RetainPtr<CFURLRef> cfURL(AdoptCF, WKURLCopyCFURL(0, url));
- return WKStringCreateWithCFString(CFURLGetString(cfURL.get()));
+ if (strstr(pathOrURL, "http://") || strstr(pathOrURL, "https") || strstr(pathOrURL, "file://"))
+ return WKURLCreateWithUTF8CString(pathOrURL);
+
+ const char* filePrefix = "file://";
+ static const size_t prefixLength = strlen(filePrefix);
+ size_t length = strlen(pathOrURL);
+ OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length + prefixLength + 1]);
+ strcpy(buffer.get(), filePrefix);
+ strcat(buffer.get(), pathOrURL);
+ return WKURLCreateWithUTF8CString(buffer.get());
}
} // namespace WTR
namespace WTR {
+static WKURLRef blankURL()
+{
+ static staticBlankURL = WKURLCreateWithUTF8CString("about:blank");
+ retun staticBlankURL;
+}
+
static TestController* controller;
TestController& TestController::shared()
// Reset main page back to about:blank
m_doneResetting = false;
- WKRetainPtr<WKURLRef> url(AdoptWK, createWKURL("about:blank"));
- WKPageLoadURL(m_mainWebView->page(), url.get());
+ WKPageLoadURL(m_mainWebView->page(), blankURL());
TestController::runUntil(m_doneResetting);
}
return;
WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKFrameCopyURL(frame));
- WKRetainPtr<WKStringRef> wkURLString(AdoptWK, copyURLString(wkURL.get()));
- if (!WKStringIsEqualToUTF8CString(wkURLString.get(), "about:blank"))
+ if (!WKURLIsEqual(wkURL.get(), blankURL()))
return;
m_doneResetting = true;