TEST(WebKit2, WillSendSubmitEvent)
{
    WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("WillSendSubmitEventTest"));
    setInjectedBundleClient(context.get());

    PlatformWebView webView(context.get());
    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("auto-submitting-form", "html")).get());
    Util::run(&didReceiveMessage);
}
Ejemplo n.º 2
0
TEST(WebKit2, CanHandleRequest)
{
    WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("CanHandleRequestTest"));
    setInjectedBundleClient(context.get());

    _WKContextRegisterURLSchemeAsEmptyDocument(context.get(), Util::toWK("emptyscheme").get());

    PlatformWebView webView(context.get());

    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());

    WKContextPostMessageToInjectedBundle(context.get(), Util::toWK("CheckCanHandleRequest").get(), 0);
    Util::run(&didReceiveMessage);
    EXPECT_TRUE(canHandleRequest);
}
Ejemplo n.º 3
0
    virtual void SetUp()
    {
        context = adoptWK(Util::createContextForInjectedBundleTest("UserMessageTest"));
        setInjectedBundleClient(context.get(), this);

        webView = std::make_unique<PlatformWebView>(context.get());
        setPageLoaderClient(webView->page(), this);

        didFinishLoad = false;
        didReceiveMessage = false;

        // Force the creation of the 
        WKPageLoadURL(webView->page(), adoptWK(Util::createURLForResource("simple", "html")).get());
        Util::run(&didFinishLoad);

    }
TEST(WebKit2, HitTestResultNodeHandle)
{
    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("HitTestResultNodeHandleTest"));
    
    setInjectedBundleClient(context.get());

    PlatformWebView webView(context.get());
    setPageLoaderClient(webView.page());

    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
    Util::run(&didFinishLoad);
    didFinishLoad = false;

    webView.simulateRightClick(10, 10);
    Util::run(&done);
}
TEST(WebKit2, StopLoadingDuringDidFailProvisionalLoadTest)
{
    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("StopLoadingDuringDidFailProvisionalLoadTest"));
    setInjectedBundleClient(context.get());

    PlatformWebView webView(context.get());

    WKPageLoaderClientV0 loaderClient;
    memset(&loaderClient, 0, sizeof(loaderClient));
    loaderClient.didFailProvisionalLoadWithErrorForFrame = didFailProvisionalLoadWithErrorForFrame;
    WKPageSetPageLoaderClient(webView.page(), &loaderClient.base);

    WKRetainPtr<WKURLRef> url(AdoptWK, Util::URLForNonExistentResource());
    WKPageLoadURL(webView.page(), url.get());

    Util::run(&done);
}