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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Rebase Created 3 years, 11 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
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 23 matching lines...) Expand all
34 #include "core/events/KeyboardEvent.h" 34 #include "core/events/KeyboardEvent.h"
35 #include "core/frame/EventHandlerRegistry.h" 35 #include "core/frame/EventHandlerRegistry.h"
36 #include "core/frame/FrameHost.h" 36 #include "core/frame/FrameHost.h"
37 #include "core/layout/LayoutObject.h" 37 #include "core/layout/LayoutObject.h"
38 #include "core/page/Page.h" 38 #include "core/page/Page.h"
39 #include "platform/PlatformEvent.h" 39 #include "platform/PlatformEvent.h"
40 #include "platform/graphics/GraphicsContext.h" 40 #include "platform/graphics/GraphicsContext.h"
41 #include "platform/graphics/paint/CullRect.h" 41 #include "platform/graphics/paint/CullRect.h"
42 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" 42 #include "platform/graphics/paint/ForeignLayerDisplayItem.h"
43 #include "platform/graphics/paint/PaintController.h" 43 #include "platform/graphics/paint/PaintController.h"
44 #include "platform/graphics/paint/PaintRecorder.h"
44 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 45 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
45 #include "platform/testing/URLTestHelpers.h" 46 #include "platform/testing/URLTestHelpers.h"
46 #include "platform/testing/UnitTestHelpers.h" 47 #include "platform/testing/UnitTestHelpers.h"
47 #include "public/platform/Platform.h" 48 #include "public/platform/Platform.h"
48 #include "public/platform/WebClipboard.h" 49 #include "public/platform/WebClipboard.h"
49 #include "public/platform/WebCompositorSupport.h" 50 #include "public/platform/WebCompositorSupport.h"
50 #include "public/platform/WebLayer.h" 51 #include "public/platform/WebLayer.h"
51 #include "public/platform/WebMouseWheelEvent.h" 52 #include "public/platform/WebMouseWheelEvent.h"
52 #include "public/platform/WebThread.h" 53 #include "public/platform/WebThread.h"
53 #include "public/platform/WebURLLoaderMockFactory.h" 54 #include "public/platform/WebURLLoaderMockFactory.h"
54 #include "public/web/WebCache.h" 55 #include "public/web/WebCache.h"
55 #include "public/web/WebDocument.h" 56 #include "public/web/WebDocument.h"
56 #include "public/web/WebElement.h" 57 #include "public/web/WebElement.h"
57 #include "public/web/WebFrame.h" 58 #include "public/web/WebFrame.h"
58 #include "public/web/WebFrameClient.h" 59 #include "public/web/WebFrameClient.h"
59 #include "public/web/WebPluginParams.h" 60 #include "public/web/WebPluginParams.h"
60 #include "public/web/WebPrintParams.h" 61 #include "public/web/WebPrintParams.h"
61 #include "public/web/WebSettings.h" 62 #include "public/web/WebSettings.h"
62 #include "public/web/WebView.h" 63 #include "public/web/WebView.h"
63 #include "testing/gtest/include/gtest/gtest.h" 64 #include "testing/gtest/include/gtest/gtest.h"
64 #include "third_party/skia/include/core/SkPictureRecorder.h"
65 #include "web/WebLocalFrameImpl.h" 65 #include "web/WebLocalFrameImpl.h"
66 #include "web/WebPluginContainerImpl.h" 66 #include "web/WebPluginContainerImpl.h"
67 #include "web/WebViewImpl.h" 67 #include "web/WebViewImpl.h"
68 #include "web/tests/FakeWebPlugin.h" 68 #include "web/tests/FakeWebPlugin.h"
69 #include "web/tests/FrameTestHelpers.h" 69 #include "web/tests/FrameTestHelpers.h"
70 #include <memory> 70 #include <memory>
71 71
72 using blink::testing::runPendingTasks; 72 using blink::testing::runPendingTasks;
73 73
74 namespace blink { 74 namespace blink {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 DCHECK(webView); 252 DCHECK(webView);
253 webView->updateAllLifecyclePhases(); 253 webView->updateAllLifecyclePhases();
254 runPendingTasks(); 254 runPendingTasks();
255 WebFrame* frame = webView->mainFrame(); 255 WebFrame* frame = webView->mainFrame();
256 256
257 WebPrintParams printParams; 257 WebPrintParams printParams;
258 printParams.printContentArea.width = 500; 258 printParams.printContentArea.width = 500;
259 printParams.printContentArea.height = 500; 259 printParams.printContentArea.height = 500;
260 260
261 frame->printBegin(printParams); 261 frame->printBegin(printParams);
262 SkPictureRecorder recorder; 262 PaintRecorder recorder;
263 frame->printPage(0, recorder.beginRecording(IntRect())); 263 frame->printPage(0, recorder.beginRecording(IntRect()));
264 frame->printEnd(); 264 frame->printEnd();
265 DCHECK(pluginWebFrameClient.printedAtLeastOnePage()); 265 DCHECK(pluginWebFrameClient.printedAtLeastOnePage());
266 } 266 }
267 267
268 TEST_F(WebPluginContainerTest, PrintAllPages) { 268 TEST_F(WebPluginContainerTest, PrintAllPages) {
269 URLTestHelpers::registerMockedURLFromBaseURL( 269 URLTestHelpers::registerMockedURLFromBaseURL(
270 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"), 270 WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("test.pdf"),
271 WebString::fromUTF8("application/pdf")); 271 WebString::fromUTF8("application/pdf"));
272 272
273 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper. 273 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper.
274 FrameTestHelpers::WebViewHelper webViewHelper; 274 FrameTestHelpers::WebViewHelper webViewHelper;
275 WebView* webView = webViewHelper.initializeAndLoad( 275 WebView* webView = webViewHelper.initializeAndLoad(
276 m_baseURL + "test.pdf", true, &pluginWebFrameClient); 276 m_baseURL + "test.pdf", true, &pluginWebFrameClient);
277 DCHECK(webView); 277 DCHECK(webView);
278 webView->updateAllLifecyclePhases(); 278 webView->updateAllLifecyclePhases();
279 runPendingTasks(); 279 runPendingTasks();
280 WebFrame* frame = webView->mainFrame(); 280 WebFrame* frame = webView->mainFrame();
281 281
282 WebPrintParams printParams; 282 WebPrintParams printParams;
283 printParams.printContentArea.width = 500; 283 printParams.printContentArea.width = 500;
284 printParams.printContentArea.height = 500; 284 printParams.printContentArea.height = 500;
285 285
286 frame->printBegin(printParams); 286 frame->printBegin(printParams);
287 SkPictureRecorder recorder; 287 PaintRecorder recorder;
288 frame->printPagesWithBoundaries(recorder.beginRecording(IntRect()), 288 frame->printPagesWithBoundaries(recorder.beginRecording(IntRect()),
289 WebSize()); 289 WebSize());
290 frame->printEnd(); 290 frame->printEnd();
291 DCHECK(pluginWebFrameClient.printedAtLeastOnePage()); 291 DCHECK(pluginWebFrameClient.printedAtLeastOnePage());
292 } 292 }
293 293
294 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) { 294 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) {
295 URLTestHelpers::registerMockedURLFromBaseURL( 295 URLTestHelpers::registerMockedURLFromBaseURL(
296 WebString::fromUTF8(m_baseURL.c_str()), 296 WebString::fromUTF8(m_baseURL.c_str()),
297 WebString::fromUTF8("plugin_container.html")); 297 WebString::fromUTF8("plugin_container.html"));
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 WebString::fromUTF8("translated-plugin")); 815 WebString::fromUTF8("translated-plugin"));
816 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); 816 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true);
817 817
818 runPendingTasks(); 818 runPendingTasks();
819 EXPECT_TRUE( 819 EXPECT_TRUE(
820 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers( 820 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers(
821 EventHandlerRegistry::WheelEventBlocking)); 821 EventHandlerRegistry::WheelEventBlocking));
822 } 822 }
823 823
824 } // namespace blink 824 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698