当前位置: 首页>>代码示例>>C++>>正文


C++ WebViewImpl::updateAllLifecyclePhases方法代码示例

本文整理汇总了C++中WebViewImpl::updateAllLifecyclePhases方法的典型用法代码示例。如果您正苦于以下问题:C++ WebViewImpl::updateAllLifecyclePhases方法的具体用法?C++ WebViewImpl::updateAllLifecyclePhases怎么用?C++ WebViewImpl::updateAllLifecyclePhases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebViewImpl的用法示例。


在下文中一共展示了WebViewImpl::updateAllLifecyclePhases方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: baseURL

TEST(LinkHighlightImplTest, verifyWebViewImplIntegration)
{
    FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;

    const std::string baseURL("http://www.test.com/");
    const std::string fileName("test_touch_link_highlight.html");

    URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8("test_touch_link_highlight.html"));
    FrameTestHelpers::WebViewHelper webViewHelper;
    WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileName, true);
    int pageWidth = 640;
    int pageHeight = 480;
    webViewImpl->resize(WebSize(pageWidth, pageHeight));
    webViewImpl->updateAllLifecyclePhases();

    WebGestureEvent touchEvent;
    touchEvent.type = WebInputEvent::GestureShowPress;
    touchEvent.sourceDevice = WebGestureDeviceTouchscreen;

    // The coordinates below are linked to absolute positions in the referenced .html file.
    touchEvent.x = 20;
    touchEvent.y = 20;

    ASSERT_TRUE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEvent)));

    touchEvent.y = 40;
    EXPECT_FALSE(webViewImpl->bestTapNode(getTargetedEvent(webViewImpl, touchEvent)));

    touchEvent.y = 20;
    // Shouldn't crash.
    webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));

    EXPECT_TRUE(webViewImpl->linkHighlight(0));
    EXPECT_TRUE(webViewImpl->linkHighlight(0)->contentLayer());
    EXPECT_TRUE(webViewImpl->linkHighlight(0)->clipLayer());

    // Find a target inside a scrollable div
    touchEvent.y = 100;
    webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
    ASSERT_TRUE(webViewImpl->linkHighlight(0));

    // Don't highlight if no "hand cursor"
    touchEvent.y = 220; // An A-link with cross-hair cursor.
    webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
    ASSERT_EQ(0U, webViewImpl->numLinkHighlights());

    touchEvent.y = 260; // A text input box.
    webViewImpl->enableTapHighlightAtPoint(getTargetedEvent(webViewImpl, touchEvent));
    ASSERT_EQ(0U, webViewImpl->numLinkHighlights());

    Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
}
开发者ID:jiayuwang,项目名称:chromium,代码行数:52,代码来源:LinkHighlightImplTest.cpp


注:本文中的WebViewImpl::updateAllLifecyclePhases方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。