Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
index 38be0df067a3b73ac2753682366478d38531d52d..95b5555cbf5546bf9ebd8c40cf56f4e7708146e3 100644
--- a/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp
@@ -166,9 +166,10 @@ void TestPlugin::PrintPage(int page_number, WebCanvas* canvas) {
test_client_->OnPrintPage();
}
-WebPluginContainer* GetWebPluginContainer(WebView* web_view,
+WebPluginContainer* GetWebPluginContainer(WebViewBase* web_view,
const WebString& id) {
- WebElement element = web_view->MainFrame()->GetDocument().GetElementById(id);
+ WebElement element =
+ web_view->MainFrameImpl()->GetDocument().GetElementById(id);
return element.PluginContainer();
}
@@ -179,7 +180,7 @@ TEST_F(WebPluginContainerTest, WindowToLocalPointTest) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -218,12 +219,12 @@ TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "test.pdf", &plugin_web_frame_client);
DCHECK(web_view);
web_view->UpdateAllLifecyclePhases();
- WebDocument document = web_view->MainFrame()->GetDocument();
+ WebDocument document = web_view->MainFrameImpl()->GetDocument();
EXPECT_TRUE(document.IsPluginDocument());
WebPluginContainer* plugin_container =
GetWebPluginContainer(web_view, "plugin");
@@ -237,13 +238,14 @@ TEST_F(WebPluginContainerTest, IFramePluginDocumentNotFocused) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "iframe_pdf.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->UpdateAllLifecyclePhases();
- WebDocument document = web_view->MainFrame()->GetDocument();
- WebFrame* iframe = web_view->MainFrame()->FirstChild();
+ WebDocument document = web_view->MainFrameImpl()->GetDocument();
+ WebLocalFrame* iframe =
+ web_view->MainFrame()->FirstChild()->ToWebLocalFrame();
EXPECT_TRUE(iframe->GetDocument().IsPluginDocument());
WebPluginContainer* plugin_container =
iframe->GetDocument().GetElementById("plugin").PluginContainer();
@@ -305,7 +307,7 @@ TEST_F(WebPluginContainerTest, LocalToWindowPointTest) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -343,7 +345,7 @@ TEST_F(WebPluginContainerTest, Copy) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -351,7 +353,7 @@ TEST_F(WebPluginContainerTest, Copy) {
web_view->UpdateAllLifecyclePhases();
RunPendingTasks();
- web_view->MainFrame()
+ web_view->MainFrameImpl()
->GetDocument()
.Unwrap<Document>()
->body()
@@ -367,7 +369,7 @@ TEST_F(WebPluginContainerTest, CopyFromContextMenu) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -398,7 +400,7 @@ TEST_F(WebPluginContainerTest, CopyFromContextMenu) {
web_view->ClearFocusedElement();
// 3) Copy should still operate on the context node, even though the focus had
// shifted.
- EXPECT_TRUE(web_view->MainFrame()->ToWebLocalFrame()->ExecuteCommand("Copy"));
+ EXPECT_TRUE(web_view->MainFrameImpl()->ExecuteCommand("Copy"));
EXPECT_EQ(WebString("x"), Platform::Current()->Clipboard()->ReadPlainText(
WebClipboard::Buffer()));
}
@@ -410,7 +412,7 @@ TEST_F(WebPluginContainerTest, CopyInsertKeyboardEventsTest) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -419,7 +421,7 @@ TEST_F(WebPluginContainerTest, CopyInsertKeyboardEventsTest) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("translated-plugin"));
WebInputEvent::Modifiers modifier_key = static_cast<WebInputEvent::Modifiers>(
WebInputEvent::kControlKey | WebInputEvent::kNumLockOn |
@@ -507,7 +509,7 @@ TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -516,7 +518,7 @@ TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("translated-plugin"));
WebPlugin* plugin = static_cast<WebPluginContainerBase*>(
plugin_container_one_element.PluginContainer())
@@ -556,7 +558,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventTranslated) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -565,7 +567,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventTranslated) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("translated-plugin"));
WebPlugin* plugin = static_cast<WebPluginContainerBase*>(
plugin_container_one_element.PluginContainer())
@@ -592,7 +594,7 @@ TEST_F(WebPluginContainerTest, TouchEventScrolled) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -604,7 +606,7 @@ TEST_F(WebPluginContainerTest, TouchEventScrolled) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRaw);
@@ -634,7 +636,7 @@ TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -646,7 +648,7 @@ TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRawLowLatency);
@@ -692,7 +694,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventScrolled) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -704,7 +706,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventScrolled) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRaw);
@@ -733,7 +735,7 @@ TEST_F(WebPluginContainerTest, MouseEventScrolled) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -745,7 +747,7 @@ TEST_F(WebPluginContainerTest, MouseEventScrolled) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRaw);
@@ -773,7 +775,7 @@ TEST_F(WebPluginContainerTest, MouseEventZoomed) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -784,7 +786,7 @@ TEST_F(WebPluginContainerTest, MouseEventZoomed) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRaw);
@@ -814,7 +816,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventZoomed) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -825,7 +827,7 @@ TEST_F(WebPluginContainerTest, MouseWheelEventZoomed) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRaw);
@@ -856,7 +858,7 @@ TEST_F(WebPluginContainerTest, TouchEventZoomed) {
CustomPluginWebFrameClient<EventTestPlugin>
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_scroll.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -867,7 +869,7 @@ TEST_F(WebPluginContainerTest, TouchEventZoomed) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("scrolled-plugin"));
plugin_container_one_element.PluginContainer()->RequestTouchEventType(
WebPluginContainer::kTouchEventRequestTypeRaw);
@@ -901,7 +903,7 @@ TEST_F(WebPluginContainerTest, IsRectTopmostTest) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -947,9 +949,11 @@ TEST_F(WebPluginContainerTest, ClippedRectsForIframedElement) {
web_view->UpdateAllLifecyclePhases();
RunPendingTasks();
- WebElement plugin_element =
- web_view->MainFrame()->FirstChild()->GetDocument().GetElementById(
- "translated-plugin");
+ WebElement plugin_element = web_view->MainFrame()
+ ->FirstChild()
+ ->ToWebLocalFrame()
+ ->GetDocument()
+ .GetElementById("translated-plugin");
WebPluginContainerBase* plugin_container_impl =
ToWebPluginContainerBase(plugin_element.PluginContainer());
@@ -972,7 +976,7 @@ TEST_F(WebPluginContainerTest, ClippedRectsForSubpixelPositionedPlugin) {
TestPluginWebFrameClient
plugin_web_frame_client; // Must outlive webViewHelper.
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -981,7 +985,7 @@ TEST_F(WebPluginContainerTest, ClippedRectsForSubpixelPositionedPlugin) {
RunPendingTasks();
WebElement plugin_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
"subpixel-positioned-plugin");
WebPluginContainerBase* plugin_container_impl =
ToWebPluginContainerBase(plugin_element.PluginContainer());
@@ -1021,7 +1025,7 @@ TEST_F(WebPluginContainerTest, TopmostAfterDetachTest) {
// The client must outlive WebViewHelper.
CustomPluginWebFrameClient<TopmostPlugin> plugin_web_frame_client;
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin_container.html", &plugin_web_frame_client);
DCHECK(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -1081,7 +1085,7 @@ TEST_F(WebPluginContainerTest, CompositedPluginSPv2) {
RegisterMockedURL("plugin.html");
CustomPluginWebFrameClient<CompositedPlugin> web_frame_client;
FrameTestHelpers::WebViewHelper web_view_helper;
- WebView* web_view = web_view_helper.InitializeAndLoad(
+ WebViewBase* web_view = web_view_helper.InitializeAndLoad(
base_url_ + "plugin.html", &web_frame_client);
ASSERT_TRUE(web_view);
web_view->GetSettings()->SetPluginsEnabled(true);
@@ -1132,7 +1136,7 @@ TEST_F(WebPluginContainerTest, NeedsWheelEvents) {
RunPendingTasks();
WebElement plugin_container_one_element =
- web_view->MainFrame()->GetDocument().GetElementById(
+ web_view->MainFrameImpl()->GetDocument().GetElementById(
WebString::FromUTF8("translated-plugin"));
plugin_container_one_element.PluginContainer()->SetWantsWheelEvents(true);

Powered by Google App Engine
This is Rietveld 408576698