diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp')
-rw-r--r-- | Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp index acc23348b..def60bcb9 100644 --- a/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp +++ b/Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2011 Apple Inc. All rights reserved. - * Copyright (C) 2015 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,16 +24,13 @@ */ #include "config.h" - -#if WK_HAVE_C_SPI - #include "JavaScriptTest.h" #include "PlatformUtilities.h" #include "PlatformWebView.h" -#include <WebKit/WKContext.h> -#include <WebKit/WKPage.h> -#include <WebKit/WKRetainPtr.h> +#include <WebKit2/WKContext.h> +#include <WebKit2/WKPage.h> +#include <WebKit2/WKRetainPtr.h> namespace TestWebKitAPI { @@ -45,7 +41,7 @@ static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef us didFinishLoad = true; } -static void loadAlternateHTMLString(WKURLRef baseURL, WKURLRef unreachableURL) +TEST(WebKit2, LoadAlternateHTMLStringWithNonDirectoryURL) { WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate()); PlatformWebView webView(context.get()); @@ -57,29 +53,14 @@ static void loadAlternateHTMLString(WKURLRef baseURL, WKURLRef unreachableURL) loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; WKPageSetPageLoaderClient(webView.page(), &loaderClient.base); + WKRetainPtr<WKURLRef> fileURL(AdoptWK, Util::createURLForResource("simple", "html")); WKRetainPtr<WKStringRef> alternateHTMLString(AdoptWK, WKStringCreateWithUTF8CString("<html><body><img src='icon.png'></body></html>")); - WKPageLoadAlternateHTMLString(webView.page(), alternateHTMLString.get(), baseURL, unreachableURL); - + + // Call WKPageLoadAlternateHTMLString() with fileURL which does not point to a directory + WKPageLoadAlternateHTMLString(webView.page(), alternateHTMLString.get(), fileURL.get(), fileURL.get()); + // If we can finish loading the html without resulting in an invalid message being sent from the WebProcess, this test passes. Util::run(&didFinishLoad); } -TEST(WebKit2, LoadAlternateHTMLStringWithNonDirectoryURL) -{ - // Call WKPageLoadAlternateHTMLString() with fileURL which does not point to a directory. - WKRetainPtr<WKURLRef> fileURL(AdoptWK, Util::createURLForResource("simple", "html")); - loadAlternateHTMLString(fileURL.get(), fileURL.get()); -} - -TEST(WebKit2, LoadAlternateHTMLStringWithEmptyBaseURL) -{ - // Call WKPageLoadAlternateHTMLString() with empty baseURL to make sure this test works - // when baseURL does not grant read access to the unreachableURL. We use a separate test - // to ensure the previous test does not pollute the result. - WKRetainPtr<WKURLRef> unreachableURL(AdoptWK, Util::URLForNonExistentResource()); - loadAlternateHTMLString(nullptr, unreachableURL.get()); -} - } // namespace TestWebKitAPI - -#endif |