本文整理汇总了C++中WebView::mainFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ WebView::mainFrame方法的具体用法?C++ WebView::mainFrame怎么用?C++ WebView::mainFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebView
的用法示例。
在下文中一共展示了WebView::mainFrame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: searchableFormData
TEST_F(WebSearchableFormDataTest, SearchString)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "search_form.html");
WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "search_form.html");
WebVector<WebFormElement> forms;
webView->mainFrame()->document().forms(forms);
EXPECT_EQ(forms.size(), 1U);
WebSearchableFormData searchableFormData(forms[0]);
EXPECT_EQ("http://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search", searchableFormData.url().string());
}
示例2: ASSERT
TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf"));
TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper webViewHelper;
WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", true, &pluginWebFrameClient);
ASSERT(webView);
webView->updateAllLifecyclePhases();
WebDocument document = webView->mainFrame()->document();
EXPECT_TRUE(document.isPluginDocument());
WebPluginContainer* pluginContainer = getWebPluginContainer(webView, "plugin");
EXPECT_EQ(document.focusedElement(), pluginContainer->element());
}
示例3: 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();
}
示例4: dispatchCreatePage
Frame* WebFrameLoaderClient::dispatchCreatePage()
{
#if PLATFORM(AMIGAOS4)
extern BalWidget *createAmigaWindow(WebView *);
extern void closeAmigaWindow(BalWidget *);
WebView* newWebView = WebView::createInstance();
if (newWebView) {
BalWidget *newowbwindow = createAmigaWindow(newWebView);
if (newowbwindow) {
IntRect clientRect(0, 0, amigaConfig.width, amigaConfig.height);
newWebView->initWithFrame(clientRect, "", "");
newWebView->setViewWindow(newowbwindow);
WebFrame *mainFrame = newWebView->mainFrame();
if (mainFrame && mainFrame->impl())
return mainFrame->impl();
closeAmigaWindow(newowbwindow);
}
delete newWebView;
}
return 0;
#else
/*WebView* webView = m_webFrame->webView();
COMPtr<IWebUIDelegate> ui;
if (FAILED(webView->uiDelegate(&ui)))
return 0;
COMPtr<IWebView> newWebView;
if (FAILED(ui->createWebViewWithRequest(webView, 0, &newWebView)))
return 0;
COMPtr<IWebFrame> mainFrame;
if (FAILED(newWebView->mainFrame(&mainFrame)))
return 0;
COMPtr<WebFrame> mainFrameImpl(Query, mainFrame);
return core(mainFrameImpl.get());*/
return 0;
#endif
}
示例5: openFromWorker
void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir)
{
#if ENABLE(WORKERS)
WebSecurityOrigin origin(prpOrigin);
if (!allowIDBFromWorkerThread(context, name, origin)) {
callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database."));
return;
}
WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy();
WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy);
WebView* webView = webWorker->view();
if (!webView) {
// Frame is closed, worker is terminaring.
return;
}
WebFrame* webFrame = webView->mainFrame();
m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir);
#endif
}
示例6: setupTest
WebView* TouchActionTest::setupTest(std::string file,
TouchActionTrackingWebViewClient& client) {
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL),
WebString::fromUTF8(file));
// Note that JavaScript must be enabled for shadow DOM tests.
WebView* webView =
m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, &client);
// Set size to enable hit testing, and avoid line wrapping for consistency
// with browser.
webView->resize(WebSize(800, 1200));
// Scroll to verify the code properly transforms windows to client co-ords.
const int kScrollOffset = 100;
Document* document = static_cast<Document*>(webView->mainFrame()->document());
document->frame()->view()->layoutViewportScrollableArea()->setScrollOffset(
ScrollOffset(0, kScrollOffset), ProgrammaticScroll);
return webView;
}
示例7: 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();
}