OLD | NEW |
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 EXPECT_NE(iframe->GetDocument().FocusedElement(), | 239 EXPECT_NE(iframe->GetDocument().FocusedElement(), |
240 plugin_container->GetElement()); | 240 plugin_container->GetElement()); |
241 } | 241 } |
242 | 242 |
243 TEST_F(WebPluginContainerTest, PrintOnePage) { | 243 TEST_F(WebPluginContainerTest, PrintOnePage) { |
244 RegisterMockedURL("test.pdf", "application/pdf"); | 244 RegisterMockedURL("test.pdf", "application/pdf"); |
245 | 245 |
246 TestPluginWebFrameClient | 246 TestPluginWebFrameClient |
247 plugin_web_frame_client; // Must outlive webViewHelper. | 247 plugin_web_frame_client; // Must outlive webViewHelper. |
248 FrameTestHelpers::WebViewHelper web_view_helper; | 248 FrameTestHelpers::WebViewHelper web_view_helper; |
249 WebView* web_view = web_view_helper.InitializeAndLoad( | 249 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
250 base_url_ + "test.pdf", true, &plugin_web_frame_client); | 250 base_url_ + "test.pdf", true, &plugin_web_frame_client); |
251 DCHECK(web_view); | 251 DCHECK(web_view); |
252 web_view->UpdateAllLifecyclePhases(); | 252 web_view->UpdateAllLifecyclePhases(); |
253 RunPendingTasks(); | 253 RunPendingTasks(); |
254 WebFrame* frame = web_view->MainFrame(); | 254 WebLocalFrame* frame = web_view->MainFrameImpl(); |
255 | 255 |
256 WebPrintParams print_params; | 256 WebPrintParams print_params; |
257 print_params.print_content_area.width = 500; | 257 print_params.print_content_area.width = 500; |
258 print_params.print_content_area.height = 500; | 258 print_params.print_content_area.height = 500; |
259 | 259 |
260 frame->PrintBegin(print_params); | 260 frame->PrintBegin(print_params); |
261 PaintRecorder recorder; | 261 PaintRecorder recorder; |
262 frame->PrintPage(0, recorder.beginRecording(IntRect())); | 262 frame->PrintPage(0, recorder.beginRecording(IntRect())); |
263 frame->PrintEnd(); | 263 frame->PrintEnd(); |
264 DCHECK(plugin_web_frame_client.PrintedAtLeastOnePage()); | 264 DCHECK(plugin_web_frame_client.PrintedAtLeastOnePage()); |
265 } | 265 } |
266 | 266 |
267 TEST_F(WebPluginContainerTest, PrintAllPages) { | 267 TEST_F(WebPluginContainerTest, PrintAllPages) { |
268 RegisterMockedURL("test.pdf", "application/pdf"); | 268 RegisterMockedURL("test.pdf", "application/pdf"); |
269 | 269 |
270 TestPluginWebFrameClient | 270 TestPluginWebFrameClient |
271 plugin_web_frame_client; // Must outlive webViewHelper. | 271 plugin_web_frame_client; // Must outlive webViewHelper. |
272 FrameTestHelpers::WebViewHelper web_view_helper; | 272 FrameTestHelpers::WebViewHelper web_view_helper; |
273 WebView* web_view = web_view_helper.InitializeAndLoad( | 273 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
274 base_url_ + "test.pdf", true, &plugin_web_frame_client); | 274 base_url_ + "test.pdf", true, &plugin_web_frame_client); |
275 DCHECK(web_view); | 275 DCHECK(web_view); |
276 web_view->UpdateAllLifecyclePhases(); | 276 web_view->UpdateAllLifecyclePhases(); |
277 RunPendingTasks(); | 277 RunPendingTasks(); |
278 WebFrame* frame = web_view->MainFrame(); | 278 WebLocalFrame* frame = web_view->MainFrameImpl(); |
279 | 279 |
280 WebPrintParams print_params; | 280 WebPrintParams print_params; |
281 print_params.print_content_area.width = 500; | 281 print_params.print_content_area.width = 500; |
282 print_params.print_content_area.height = 500; | 282 print_params.print_content_area.height = 500; |
283 | 283 |
284 frame->PrintBegin(print_params); | 284 frame->PrintBegin(print_params); |
285 PaintRecorder recorder; | 285 PaintRecorder recorder; |
286 frame->PrintPagesWithBoundaries(recorder.beginRecording(IntRect()), | 286 frame->PrintPagesForTesting(recorder.beginRecording(IntRect()), WebSize()); |
287 WebSize()); | |
288 frame->PrintEnd(); | 287 frame->PrintEnd(); |
289 DCHECK(plugin_web_frame_client.PrintedAtLeastOnePage()); | 288 DCHECK(plugin_web_frame_client.PrintedAtLeastOnePage()); |
290 } | 289 } |
291 | 290 |
292 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) { | 291 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) { |
293 RegisterMockedURL("plugin_container.html"); | 292 RegisterMockedURL("plugin_container.html"); |
294 TestPluginWebFrameClient | 293 TestPluginWebFrameClient |
295 plugin_web_frame_client; // Must outlive webViewHelper. | 294 plugin_web_frame_client; // Must outlive webViewHelper. |
296 FrameTestHelpers::WebViewHelper web_view_helper; | 295 FrameTestHelpers::WebViewHelper web_view_helper; |
297 WebView* web_view = web_view_helper.InitializeAndLoad( | 296 WebView* web_view = web_view_helper.InitializeAndLoad( |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 web_view->MainFrame()->GetDocument().GetElementById( | 1127 web_view->MainFrame()->GetDocument().GetElementById( |
1129 WebString::FromUTF8("translated-plugin")); | 1128 WebString::FromUTF8("translated-plugin")); |
1130 plugin_container_one_element.PluginContainer()->SetWantsWheelEvents(true); | 1129 plugin_container_one_element.PluginContainer()->SetWantsWheelEvents(true); |
1131 | 1130 |
1132 RunPendingTasks(); | 1131 RunPendingTasks(); |
1133 EXPECT_TRUE(web_view->GetPage()->GetEventHandlerRegistry().HasEventHandlers( | 1132 EXPECT_TRUE(web_view->GetPage()->GetEventHandlerRegistry().HasEventHandlers( |
1134 EventHandlerRegistry::kWheelEventBlocking)); | 1133 EventHandlerRegistry::kWheelEventBlocking)); |
1135 } | 1134 } |
1136 | 1135 |
1137 } // namespace blink | 1136 } // namespace blink |
OLD | NEW |