本文整理汇总了C++中frametesthelpers::WebViewHelper::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ WebViewHelper::reset方法的具体用法?C++ WebViewHelper::reset怎么用?C++ WebViewHelper::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类frametesthelpers::WebViewHelper
的用法示例。
在下文中一共展示了WebViewHelper::reset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runShadowDOMTest
void TouchActionTest::runShadowDOMTest(std::string file) {
TouchActionTrackingWebViewClient client;
WebView* webView = setupTest(file, client);
TrackExceptionState es;
// Oilpan: see runTouchActionTest() comment why these are persistent
// references.
Persistent<Document> document =
static_cast<Document*>(webView->mainFrame()->document());
Persistent<StaticElementList> hostNodes =
document->querySelectorAll("[shadow-host]", es);
ASSERT_FALSE(es.hadException());
ASSERT_GE(hostNodes->length(), 1u);
for (unsigned index = 0; index < hostNodes->length(); index++) {
ShadowRoot* shadowRoot = hostNodes->item(index)->openShadowRoot();
runTestOnTree(shadowRoot, webView, client);
}
// Projections show up in the main document.
runTestOnTree(document.get(), webView, client);
// Explicitly reset to break dependency on locally scoped client.
m_webViewHelper.reset();
}
示例2: runImeOnFocusTest
void ImeOnFocusTest::runImeOnFocusTest(std::string fileName, int expectedImeRequestCount, IntPoint tapPoint, const AtomicString& focusElement, std::string frame)
{
ImeRequestTrackingWebViewClient client;
registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::fromUTF8(fileName));
WebViewImpl* webView = m_webViewHelper.initialize(true, 0, &client);
webView->resize(WebSize(800, 1200));
loadFrame(webView->mainFrame(), m_baseURL + fileName);
m_document = m_webViewHelper.webViewImpl()->mainFrameImpl()->document().unwrap<Document>();
if (!focusElement.isNull())
focus(focusElement);
EXPECT_EQ(0, client.imeRequestCount());
if (tapPoint.x() >= 0 && tapPoint.y() >= 0)
sendGestureTap(webView, tapPoint);
if (!frame.empty()) {
registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::fromUTF8(frame));
WebFrame* childFrame = webView->mainFrame()->firstChild();
loadFrame(childFrame, m_baseURL + frame);
}
if (!focusElement.isNull())
focus(focusElement);
EXPECT_EQ(expectedImeRequestCount, client.imeRequestCount());
m_webViewHelper.reset();
}
示例3: ASSERT
TEST_F(WebPluginContainerTest, ClippedRectsForIframedElement)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("plugin_container.html"));
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("plugin_containing_page.html"));
TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_containing_page.html", true, &pluginWebFrameClient);
ASSERT(webView);
webView->settings()->setPluginsEnabled(true);
webView->resize(WebSize(300, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
WebElement pluginElement = webView->mainFrame()->firstChild()->document().getElementById("translated-plugin");
RefPtrWillBeRawPtr<WebPluginContainerImpl> pluginContainerImpl = toWebPluginContainerImpl(pluginElement.pluginContainer());
ASSERT(pluginContainerImpl.get());
pluginContainerImpl->setFrameRect(IntRect(0, 0, 300, 300));
IntRect windowRect, clipRect, unobscuredRect;
Vector<IntRect> cutOutRects;
calculateGeometry(pluginContainerImpl.get(), windowRect, clipRect, unobscuredRect, cutOutRects);
EXPECT_RECT_EQ(IntRect(10, 210, 300, 300), windowRect);
EXPECT_RECT_EQ(IntRect(0, 0, 240, 90), clipRect);
EXPECT_RECT_EQ(IntRect(0, 0, 240, 160), unobscuredRect);
// Cause the plugin's frame to be detached.
webViewHelper.reset();
}
示例4: topmostRect
TEST_F(WebPluginContainerTest, TopmostAfterDetachTest)
{
static WebRect topmostRect(10, 10, 40, 40);
// Plugin that checks isRectTopmost in destroy().
class TopmostPlugin : public FakeWebPlugin {
public:
TopmostPlugin(WebFrame* frame, const WebPluginParams& params)
: FakeWebPlugin(frame, params) {}
bool isRectTopmost()
{
return container()->isRectTopmost(topmostRect);
}
void destroy() override
{
// In destroy, isRectTopmost is no longer valid.
EXPECT_FALSE(container()->isRectTopmost(topmostRect));
FakeWebPlugin::destroy();
}
};
class TopmostPluginWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
WebPlugin* createPlugin(WebLocalFrame* frame, const WebPluginParams& params) override
{
return new TopmostPlugin(frame, params);
}
};
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("plugin_container.html"));
TopmostPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_container.html", true, &pluginWebFrameClient);
ASSERT(webView);
webView->settings()->setPluginsEnabled(true);
webView->resize(WebSize(300, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
RefPtrWillBeRawPtr<WebPluginContainerImpl> pluginContainerImpl =
toWebPluginContainerImpl(getWebPluginContainer(webView, WebString::fromUTF8("translated-plugin")));
pluginContainerImpl->setFrameRect(IntRect(0, 0, 300, 300));
EXPECT_TRUE(pluginContainerImpl->isRectTopmost(topmostRect));
TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl->plugin());
EXPECT_TRUE(testPlugin->isRectTopmost());
// Cause the plugin's frame to be detached.
webViewHelper.reset();
EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect));
}
示例5: runIFrameTest
void TouchActionTest::runIFrameTest(std::string file) {
TouchActionTrackingWebViewClient client;
WebView* webView = setupTest(file, client);
WebFrame* curFrame = webView->mainFrame()->firstChild();
ASSERT_TRUE(curFrame);
for (; curFrame; curFrame = curFrame->nextSibling()) {
// Oilpan: see runTouchActionTest() comment why these are persistent
// references.
Persistent<Document> contentDoc =
static_cast<Document*>(curFrame->document());
runTestOnTree(contentDoc.get(), webView, client);
}
// Explicitly reset to break dependency on locally scoped client.
m_webViewHelper.reset();
}
示例6: runTouchActionTest
void TouchActionTest::runTouchActionTest(std::string file) {
TouchActionTrackingWebViewClient client;
// runTouchActionTest() loads a document in a frame, setting up a
// nested message loop. Should any Oilpan GC happen while it is in
// effect, the implicit assumption that we're outside any event
// loop (=> there being no pointers on the stack needing scanning)
// when that GC strikes will no longer hold.
//
// To ensure that the references on the stack are also traced, we
// turn them into persistent, stack allocated references. This
// workaround is sufficient to handle this artificial test
// scenario.
WebView* webView = setupTest(file, client);
Persistent<Document> document =
static_cast<Document*>(webView->mainFrame()->document());
runTestOnTree(document.get(), webView, client);
// Explicitly reset to break dependency on locally scoped client.
m_webViewHelper.reset();
}