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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp

Issue 1389093002: Make sure plugin element is focused in PluginDocument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/PluginDocument.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 WebPluginContainer* pluginContainerTwo = getWebPluginContainer(webView, WebS tring::fromUTF8("rotated-plugin")); 152 WebPluginContainer* pluginContainerTwo = getWebPluginContainer(webView, WebS tring::fromUTF8("rotated-plugin"));
153 ASSERT(pluginContainerTwo); 153 ASSERT(pluginContainerTwo);
154 WebPoint point3 = pluginContainerTwo->rootFrameToLocalPoint(WebPoint(0, 10)) ; 154 WebPoint point3 = pluginContainerTwo->rootFrameToLocalPoint(WebPoint(0, 10)) ;
155 ASSERT_EQ(10, point3.x); 155 ASSERT_EQ(10, point3.x);
156 ASSERT_EQ(0, point3.y); 156 ASSERT_EQ(0, point3.y);
157 WebPoint point4 = pluginContainerTwo->rootFrameToLocalPoint(WebPoint(-10, 10 )); 157 WebPoint point4 = pluginContainerTwo->rootFrameToLocalPoint(WebPoint(-10, 10 ));
158 ASSERT_EQ(10, point4.x); 158 ASSERT_EQ(10, point4.x);
159 ASSERT_EQ(10, point4.y); 159 ASSERT_EQ(10, point4.y);
160 } 160 }
161 161
162 TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused)
163 {
164 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf") );
165
166 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper .
167 FrameTestHelpers::WebViewHelper webViewHelper;
168 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", t rue, &pluginWebFrameClient);
169 ASSERT(webView);
170 webView->layout();
171
172 WebDocument document = webView->mainFrame()->document();
173 EXPECT_TRUE(document.isPluginDocument());
174 WebPluginContainer* pluginContainer = getWebPluginContainer(webView, "plugin ");
175 EXPECT_EQ(document.focusedElement(), pluginContainer->element());
176 }
177
162 TEST_F(WebPluginContainerTest, PrintOnePage) 178 TEST_F(WebPluginContainerTest, PrintOnePage)
163 { 179 {
164 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf") ); 180 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("test.pdf"), WebString::fromUTF8("application/pdf") );
165 181
166 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper . 182 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper .
167 FrameTestHelpers::WebViewHelper webViewHelper; 183 FrameTestHelpers::WebViewHelper webViewHelper;
168 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", t rue, &pluginWebFrameClient); 184 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "test.pdf", t rue, &pluginWebFrameClient);
169 ASSERT(webView); 185 ASSERT(webView);
170 webView->layout(); 186 webView->layout();
171 runPendingTasks(); 187 runPendingTasks();
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl- >plugin()); 452 TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl- >plugin());
437 EXPECT_TRUE(testPlugin->isRectTopmost()); 453 EXPECT_TRUE(testPlugin->isRectTopmost());
438 454
439 // Cause the plugin's frame to be detached. 455 // Cause the plugin's frame to be detached.
440 webViewHelper.reset(); 456 webViewHelper.reset();
441 457
442 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect)); 458 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect));
443 } 459 }
444 460
445 } // namespace blink 461 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/PluginDocument.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698