summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp')
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp
index 3d0db3d2f..532c92373 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/PrivateBrowsingPushStateNoHistoryCallback.cpp
@@ -24,24 +24,33 @@
*/
#include "config.h"
+
+#if WK_HAVE_C_SPI
+
#include "PlatformUtilities.h"
#include "PlatformWebView.h"
#include "Test.h"
-#include <WebKit2/WKRetainPtr.h>
+#include <WebKit/WKRetainPtr.h>
namespace TestWebKitAPI {
-static bool testDone;
+static bool didNavigate;
+static bool didSameDocumentNavigation;
-static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
+static void didNavigateWithoutNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
{
// This should never be called when navigating in Private Browsing.
FAIL();
}
+static void didNavigateWithNavigationData(WKContextRef context, WKPageRef page, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
+{
+ didNavigate = true;
+}
+
static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo)
{
- testDone = true;
+ didSameDocumentNavigation = true;
}
TEST(WebKit2, PrivateBrowsingPushStateNoHistoryCallback)
@@ -52,7 +61,7 @@ TEST(WebKit2, PrivateBrowsingPushStateNoHistoryCallback)
memset(&historyClient, 0, sizeof(historyClient));
historyClient.base.version = 0;
- historyClient.didNavigateWithNavigationData = didNavigateWithNavigationData;
+ historyClient.didNavigateWithNavigationData = didNavigateWithoutNavigationData;
WKContextSetHistoryClient(context.get(), &historyClient.base);
@@ -75,7 +84,18 @@ TEST(WebKit2, PrivateBrowsingPushStateNoHistoryCallback)
WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("push-state", "html"));
WKPageLoadURL(webView.page(), url.get());
- Util::run(&testDone);
+ Util::run(&didSameDocumentNavigation);
+
+ WKPreferencesSetPrivateBrowsingEnabled(preferences.get(), false);
+
+ historyClient.didNavigateWithNavigationData = didNavigateWithNavigationData;
+ WKContextSetHistoryClient(context.get(), &historyClient.base);
+
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&didNavigate);
}
} // namespace TestWebKitAPI
+
+#endif