| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   159  |   159  | 
|   160  private: |   160  private: | 
|   161   bool printed_page_ = false; |   161   bool printed_page_ = false; | 
|   162 }; |   162 }; | 
|   163  |   163  | 
|   164 void TestPlugin::PrintPage(int page_number, WebCanvas* canvas) { |   164 void TestPlugin::PrintPage(int page_number, WebCanvas* canvas) { | 
|   165   DCHECK(test_client_); |   165   DCHECK(test_client_); | 
|   166   test_client_->OnPrintPage(); |   166   test_client_->OnPrintPage(); | 
|   167 } |   167 } | 
|   168  |   168  | 
|   169 WebPluginContainer* GetWebPluginContainer(WebView* web_view, |   169 WebPluginContainer* GetWebPluginContainer(WebViewBase* web_view, | 
|   170                                           const WebString& id) { |   170                                           const WebString& id) { | 
|   171   WebElement element = web_view->MainFrame()->GetDocument().GetElementById(id); |   171   WebElement element = | 
 |   172       web_view->MainFrameImpl()->GetDocument().GetElementById(id); | 
|   172   return element.PluginContainer(); |   173   return element.PluginContainer(); | 
|   173 } |   174 } | 
|   174  |   175  | 
|   175 }  // namespace |   176 }  // namespace | 
|   176  |   177  | 
|   177 TEST_F(WebPluginContainerTest, WindowToLocalPointTest) { |   178 TEST_F(WebPluginContainerTest, WindowToLocalPointTest) { | 
|   178   RegisterMockedURL("plugin_container.html"); |   179   RegisterMockedURL("plugin_container.html"); | 
|   179   TestPluginWebFrameClient |   180   TestPluginWebFrameClient | 
|   180       plugin_web_frame_client;  // Must outlive webViewHelper. |   181       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   181   FrameTestHelpers::WebViewHelper web_view_helper; |   182   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   182   WebView* web_view = web_view_helper.InitializeAndLoad( |   183   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   183       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   184       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   184   DCHECK(web_view); |   185   DCHECK(web_view); | 
|   185   web_view->GetSettings()->SetPluginsEnabled(true); |   186   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   186   web_view->Resize(WebSize(300, 300)); |   187   web_view->Resize(WebSize(300, 300)); | 
|   187   web_view->UpdateAllLifecyclePhases(); |   188   web_view->UpdateAllLifecyclePhases(); | 
|   188   RunPendingTasks(); |   189   RunPendingTasks(); | 
|   189  |   190  | 
|   190   WebPluginContainer* plugin_container_one = |   191   WebPluginContainer* plugin_container_one = | 
|   191       GetWebPluginContainer(web_view, WebString::FromUTF8("translated-plugin")); |   192       GetWebPluginContainer(web_view, WebString::FromUTF8("translated-plugin")); | 
|   192   DCHECK(plugin_container_one); |   193   DCHECK(plugin_container_one); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|   211   ASSERT_EQ(10, point4.x); |   212   ASSERT_EQ(10, point4.x); | 
|   212   ASSERT_EQ(10, point4.y); |   213   ASSERT_EQ(10, point4.y); | 
|   213 } |   214 } | 
|   214  |   215  | 
|   215 TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused) { |   216 TEST_F(WebPluginContainerTest, PluginDocumentPluginIsFocused) { | 
|   216   RegisterMockedURL("test.pdf", "application/pdf"); |   217   RegisterMockedURL("test.pdf", "application/pdf"); | 
|   217  |   218  | 
|   218   TestPluginWebFrameClient |   219   TestPluginWebFrameClient | 
|   219       plugin_web_frame_client;  // Must outlive webViewHelper. |   220       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   220   FrameTestHelpers::WebViewHelper web_view_helper; |   221   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   221   WebView* web_view = web_view_helper.InitializeAndLoad( |   222   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   222       base_url_ + "test.pdf", &plugin_web_frame_client); |   223       base_url_ + "test.pdf", &plugin_web_frame_client); | 
|   223   DCHECK(web_view); |   224   DCHECK(web_view); | 
|   224   web_view->UpdateAllLifecyclePhases(); |   225   web_view->UpdateAllLifecyclePhases(); | 
|   225  |   226  | 
|   226   WebDocument document = web_view->MainFrame()->GetDocument(); |   227   WebDocument document = web_view->MainFrameImpl()->GetDocument(); | 
|   227   EXPECT_TRUE(document.IsPluginDocument()); |   228   EXPECT_TRUE(document.IsPluginDocument()); | 
|   228   WebPluginContainer* plugin_container = |   229   WebPluginContainer* plugin_container = | 
|   229       GetWebPluginContainer(web_view, "plugin"); |   230       GetWebPluginContainer(web_view, "plugin"); | 
|   230   EXPECT_EQ(document.FocusedElement(), plugin_container->GetElement()); |   231   EXPECT_EQ(document.FocusedElement(), plugin_container->GetElement()); | 
|   231 } |   232 } | 
|   232  |   233  | 
|   233 TEST_F(WebPluginContainerTest, IFramePluginDocumentNotFocused) { |   234 TEST_F(WebPluginContainerTest, IFramePluginDocumentNotFocused) { | 
|   234   RegisterMockedURL("test.pdf", "application/pdf"); |   235   RegisterMockedURL("test.pdf", "application/pdf"); | 
|   235   RegisterMockedURL("iframe_pdf.html", "text/html"); |   236   RegisterMockedURL("iframe_pdf.html", "text/html"); | 
|   236  |   237  | 
|   237   TestPluginWebFrameClient |   238   TestPluginWebFrameClient | 
|   238       plugin_web_frame_client;  // Must outlive webViewHelper. |   239       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   239   FrameTestHelpers::WebViewHelper web_view_helper; |   240   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   240   WebView* web_view = web_view_helper.InitializeAndLoad( |   241   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   241       base_url_ + "iframe_pdf.html", &plugin_web_frame_client); |   242       base_url_ + "iframe_pdf.html", &plugin_web_frame_client); | 
|   242   DCHECK(web_view); |   243   DCHECK(web_view); | 
|   243   web_view->UpdateAllLifecyclePhases(); |   244   web_view->UpdateAllLifecyclePhases(); | 
|   244  |   245  | 
|   245   WebDocument document = web_view->MainFrame()->GetDocument(); |   246   WebDocument document = web_view->MainFrameImpl()->GetDocument(); | 
|   246   WebFrame* iframe = web_view->MainFrame()->FirstChild(); |   247   WebLocalFrame* iframe = | 
 |   248       web_view->MainFrame()->FirstChild()->ToWebLocalFrame(); | 
|   247   EXPECT_TRUE(iframe->GetDocument().IsPluginDocument()); |   249   EXPECT_TRUE(iframe->GetDocument().IsPluginDocument()); | 
|   248   WebPluginContainer* plugin_container = |   250   WebPluginContainer* plugin_container = | 
|   249       iframe->GetDocument().GetElementById("plugin").PluginContainer(); |   251       iframe->GetDocument().GetElementById("plugin").PluginContainer(); | 
|   250   EXPECT_NE(document.FocusedElement(), plugin_container->GetElement()); |   252   EXPECT_NE(document.FocusedElement(), plugin_container->GetElement()); | 
|   251   EXPECT_NE(iframe->GetDocument().FocusedElement(), |   253   EXPECT_NE(iframe->GetDocument().FocusedElement(), | 
|   252             plugin_container->GetElement()); |   254             plugin_container->GetElement()); | 
|   253 } |   255 } | 
|   254  |   256  | 
|   255 TEST_F(WebPluginContainerTest, PrintOnePage) { |   257 TEST_F(WebPluginContainerTest, PrintOnePage) { | 
|   256   RegisterMockedURL("test.pdf", "application/pdf"); |   258   RegisterMockedURL("test.pdf", "application/pdf"); | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   298   frame->PrintPagesForTesting(recorder.beginRecording(IntRect()), WebSize()); |   300   frame->PrintPagesForTesting(recorder.beginRecording(IntRect()), WebSize()); | 
|   299   frame->PrintEnd(); |   301   frame->PrintEnd(); | 
|   300   DCHECK(plugin_web_frame_client.PrintedAtLeastOnePage()); |   302   DCHECK(plugin_web_frame_client.PrintedAtLeastOnePage()); | 
|   301 } |   303 } | 
|   302  |   304  | 
|   303 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) { |   305 TEST_F(WebPluginContainerTest, LocalToWindowPointTest) { | 
|   304   RegisterMockedURL("plugin_container.html"); |   306   RegisterMockedURL("plugin_container.html"); | 
|   305   TestPluginWebFrameClient |   307   TestPluginWebFrameClient | 
|   306       plugin_web_frame_client;  // Must outlive webViewHelper. |   308       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   307   FrameTestHelpers::WebViewHelper web_view_helper; |   309   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   308   WebView* web_view = web_view_helper.InitializeAndLoad( |   310   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   309       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   311       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   310   DCHECK(web_view); |   312   DCHECK(web_view); | 
|   311   web_view->GetSettings()->SetPluginsEnabled(true); |   313   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   312   web_view->Resize(WebSize(300, 300)); |   314   web_view->Resize(WebSize(300, 300)); | 
|   313   web_view->UpdateAllLifecyclePhases(); |   315   web_view->UpdateAllLifecyclePhases(); | 
|   314   RunPendingTasks(); |   316   RunPendingTasks(); | 
|   315  |   317  | 
|   316   WebPluginContainer* plugin_container_one = |   318   WebPluginContainer* plugin_container_one = | 
|   317       GetWebPluginContainer(web_view, WebString::FromUTF8("translated-plugin")); |   319       GetWebPluginContainer(web_view, WebString::FromUTF8("translated-plugin")); | 
|   318   DCHECK(plugin_container_one); |   320   DCHECK(plugin_container_one); | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   336   ASSERT_EQ(-10, point4.x); |   338   ASSERT_EQ(-10, point4.x); | 
|   337   ASSERT_EQ(10, point4.y); |   339   ASSERT_EQ(10, point4.y); | 
|   338 } |   340 } | 
|   339  |   341  | 
|   340 // Verifies executing the command 'Copy' results in copying to the clipboard. |   342 // Verifies executing the command 'Copy' results in copying to the clipboard. | 
|   341 TEST_F(WebPluginContainerTest, Copy) { |   343 TEST_F(WebPluginContainerTest, Copy) { | 
|   342   RegisterMockedURL("plugin_container.html"); |   344   RegisterMockedURL("plugin_container.html"); | 
|   343   TestPluginWebFrameClient |   345   TestPluginWebFrameClient | 
|   344       plugin_web_frame_client;  // Must outlive webViewHelper. |   346       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   345   FrameTestHelpers::WebViewHelper web_view_helper; |   347   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   346   WebView* web_view = web_view_helper.InitializeAndLoad( |   348   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   347       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   349       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   348   DCHECK(web_view); |   350   DCHECK(web_view); | 
|   349   web_view->GetSettings()->SetPluginsEnabled(true); |   351   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   350   web_view->Resize(WebSize(300, 300)); |   352   web_view->Resize(WebSize(300, 300)); | 
|   351   web_view->UpdateAllLifecyclePhases(); |   353   web_view->UpdateAllLifecyclePhases(); | 
|   352   RunPendingTasks(); |   354   RunPendingTasks(); | 
|   353  |   355  | 
|   354   web_view->MainFrame() |   356   web_view->MainFrameImpl() | 
|   355       ->GetDocument() |   357       ->GetDocument() | 
|   356       .Unwrap<Document>() |   358       .Unwrap<Document>() | 
|   357       ->body() |   359       ->body() | 
|   358       ->getElementById("translated-plugin") |   360       ->getElementById("translated-plugin") | 
|   359       ->focus(); |   361       ->focus(); | 
|   360   EXPECT_TRUE(web_view->MainFrame()->ToWebLocalFrame()->ExecuteCommand("Copy")); |   362   EXPECT_TRUE(web_view->MainFrame()->ToWebLocalFrame()->ExecuteCommand("Copy")); | 
|   361   EXPECT_EQ(WebString("x"), Platform::Current()->Clipboard()->ReadPlainText( |   363   EXPECT_EQ(WebString("x"), Platform::Current()->Clipboard()->ReadPlainText( | 
|   362                                 WebClipboard::Buffer())); |   364                                 WebClipboard::Buffer())); | 
|   363 } |   365 } | 
|   364  |   366  | 
|   365 TEST_F(WebPluginContainerTest, CopyFromContextMenu) { |   367 TEST_F(WebPluginContainerTest, CopyFromContextMenu) { | 
|   366   RegisterMockedURL("plugin_container.html"); |   368   RegisterMockedURL("plugin_container.html"); | 
|   367   TestPluginWebFrameClient |   369   TestPluginWebFrameClient | 
|   368       plugin_web_frame_client;  // Must outlive webViewHelper. |   370       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   369   FrameTestHelpers::WebViewHelper web_view_helper; |   371   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   370   WebView* web_view = web_view_helper.InitializeAndLoad( |   372   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   371       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   373       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   372   DCHECK(web_view); |   374   DCHECK(web_view); | 
|   373   web_view->GetSettings()->SetPluginsEnabled(true); |   375   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   374   web_view->Resize(WebSize(300, 300)); |   376   web_view->Resize(WebSize(300, 300)); | 
|   375   web_view->UpdateAllLifecyclePhases(); |   377   web_view->UpdateAllLifecyclePhases(); | 
|   376   RunPendingTasks(); |   378   RunPendingTasks(); | 
|   377  |   379  | 
|   378   auto event = FrameTestHelpers::CreateMouseEvent(WebMouseEvent::kMouseDown, |   380   auto event = FrameTestHelpers::CreateMouseEvent(WebMouseEvent::kMouseDown, | 
|   379                                                   WebMouseEvent::Button::kRight, |   381                                                   WebMouseEvent::Button::kRight, | 
|   380                                                   WebPoint(30, 30), 0); |   382                                                   WebPoint(30, 30), 0); | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|   391   EXPECT_EQ(WebString(""), Platform::Current()->Clipboard()->ReadPlainText( |   393   EXPECT_EQ(WebString(""), Platform::Current()->Clipboard()->ReadPlainText( | 
|   392                                WebClipboard::Buffer())); |   394                                WebClipboard::Buffer())); | 
|   393  |   395  | 
|   394   // Now, let's try a more complex scenario: |   396   // Now, let's try a more complex scenario: | 
|   395   // 1) open the context menu. This will focus the plugin. |   397   // 1) open the context menu. This will focus the plugin. | 
|   396   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); |   398   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); | 
|   397   // 2) document blurs the plugin, because it can. |   399   // 2) document blurs the plugin, because it can. | 
|   398   web_view->ClearFocusedElement(); |   400   web_view->ClearFocusedElement(); | 
|   399   // 3) Copy should still operate on the context node, even though the focus had |   401   // 3) Copy should still operate on the context node, even though the focus had | 
|   400   //    shifted. |   402   //    shifted. | 
|   401   EXPECT_TRUE(web_view->MainFrame()->ToWebLocalFrame()->ExecuteCommand("Copy")); |   403   EXPECT_TRUE(web_view->MainFrameImpl()->ExecuteCommand("Copy")); | 
|   402   EXPECT_EQ(WebString("x"), Platform::Current()->Clipboard()->ReadPlainText( |   404   EXPECT_EQ(WebString("x"), Platform::Current()->Clipboard()->ReadPlainText( | 
|   403                                 WebClipboard::Buffer())); |   405                                 WebClipboard::Buffer())); | 
|   404 } |   406 } | 
|   405  |   407  | 
|   406 // Verifies |Ctrl-C| and |Ctrl-Insert| keyboard events, results in copying to |   408 // Verifies |Ctrl-C| and |Ctrl-Insert| keyboard events, results in copying to | 
|   407 // the clipboard. |   409 // the clipboard. | 
|   408 TEST_F(WebPluginContainerTest, CopyInsertKeyboardEventsTest) { |   410 TEST_F(WebPluginContainerTest, CopyInsertKeyboardEventsTest) { | 
|   409   RegisterMockedURL("plugin_container.html"); |   411   RegisterMockedURL("plugin_container.html"); | 
|   410   TestPluginWebFrameClient |   412   TestPluginWebFrameClient | 
|   411       plugin_web_frame_client;  // Must outlive webViewHelper. |   413       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   412   FrameTestHelpers::WebViewHelper web_view_helper; |   414   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   413   WebView* web_view = web_view_helper.InitializeAndLoad( |   415   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   414       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   416       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   415   DCHECK(web_view); |   417   DCHECK(web_view); | 
|   416   web_view->GetSettings()->SetPluginsEnabled(true); |   418   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   417   web_view->Resize(WebSize(300, 300)); |   419   web_view->Resize(WebSize(300, 300)); | 
|   418   web_view->UpdateAllLifecyclePhases(); |   420   web_view->UpdateAllLifecyclePhases(); | 
|   419   RunPendingTasks(); |   421   RunPendingTasks(); | 
|   420  |   422  | 
|   421   WebElement plugin_container_one_element = |   423   WebElement plugin_container_one_element = | 
|   422       web_view->MainFrame()->GetDocument().GetElementById( |   424       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   423           WebString::FromUTF8("translated-plugin")); |   425           WebString::FromUTF8("translated-plugin")); | 
|   424   WebInputEvent::Modifiers modifier_key = static_cast<WebInputEvent::Modifiers>( |   426   WebInputEvent::Modifiers modifier_key = static_cast<WebInputEvent::Modifiers>( | 
|   425       WebInputEvent::kControlKey | WebInputEvent::kNumLockOn | |   427       WebInputEvent::kControlKey | WebInputEvent::kNumLockOn | | 
|   426       WebInputEvent::kIsLeft); |   428       WebInputEvent::kIsLeft); | 
|   427 #if OS(MACOSX) |   429 #if OS(MACOSX) | 
|   428   modifier_key = static_cast<WebInputEvent::Modifiers>( |   430   modifier_key = static_cast<WebInputEvent::Modifiers>( | 
|   429       WebInputEvent::kMetaKey | WebInputEvent::kNumLockOn | |   431       WebInputEvent::kMetaKey | WebInputEvent::kNumLockOn | | 
|   430       WebInputEvent::kIsLeft); |   432       WebInputEvent::kIsLeft); | 
|   431 #endif |   433 #endif | 
|   432   WebKeyboardEvent web_keyboard_event_c(WebInputEvent::kRawKeyDown, |   434   WebKeyboardEvent web_keyboard_event_c(WebInputEvent::kRawKeyDown, | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   500   size_t coalesced_event_count_; |   502   size_t coalesced_event_count_; | 
|   501   WebInputEvent::Type last_event_type_; |   503   WebInputEvent::Type last_event_type_; | 
|   502   IntPoint last_event_location_; |   504   IntPoint last_event_location_; | 
|   503 }; |   505 }; | 
|   504  |   506  | 
|   505 TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) { |   507 TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) { | 
|   506   RegisterMockedURL("plugin_container.html"); |   508   RegisterMockedURL("plugin_container.html"); | 
|   507   CustomPluginWebFrameClient<EventTestPlugin> |   509   CustomPluginWebFrameClient<EventTestPlugin> | 
|   508       plugin_web_frame_client;  // Must outlive webViewHelper. |   510       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   509   FrameTestHelpers::WebViewHelper web_view_helper; |   511   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   510   WebView* web_view = web_view_helper.InitializeAndLoad( |   512   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   511       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   513       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   512   DCHECK(web_view); |   514   DCHECK(web_view); | 
|   513   web_view->GetSettings()->SetPluginsEnabled(true); |   515   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   514   web_view->Resize(WebSize(300, 300)); |   516   web_view->Resize(WebSize(300, 300)); | 
|   515   web_view->UpdateAllLifecyclePhases(); |   517   web_view->UpdateAllLifecyclePhases(); | 
|   516   RunPendingTasks(); |   518   RunPendingTasks(); | 
|   517  |   519  | 
|   518   WebElement plugin_container_one_element = |   520   WebElement plugin_container_one_element = | 
|   519       web_view->MainFrame()->GetDocument().GetElementById( |   521       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   520           WebString::FromUTF8("translated-plugin")); |   522           WebString::FromUTF8("translated-plugin")); | 
|   521   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   523   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   522                           plugin_container_one_element.PluginContainer()) |   524                           plugin_container_one_element.PluginContainer()) | 
|   523                           ->Plugin(); |   525                           ->Plugin(); | 
|   524   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   526   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   525  |   527  | 
|   526   WebGestureEvent event(WebInputEvent::kGestureLongPress, |   528   WebGestureEvent event(WebInputEvent::kGestureLongPress, | 
|   527                         WebInputEvent::kNoModifiers, |   529                         WebInputEvent::kNoModifiers, | 
|   528                         WebInputEvent::kTimeStampForTesting); |   530                         WebInputEvent::kTimeStampForTesting); | 
|   529   event.source_device = kWebGestureDeviceTouchscreen; |   531   event.source_device = kWebGestureDeviceTouchscreen; | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|   549  |   551  | 
|   550   EXPECT_EQ(WebInputEvent::kGestureLongPress, |   552   EXPECT_EQ(WebInputEvent::kGestureLongPress, | 
|   551             test_plugin->GetLastInputEventType()); |   553             test_plugin->GetLastInputEventType()); | 
|   552 } |   554 } | 
|   553  |   555  | 
|   554 TEST_F(WebPluginContainerTest, MouseWheelEventTranslated) { |   556 TEST_F(WebPluginContainerTest, MouseWheelEventTranslated) { | 
|   555   RegisterMockedURL("plugin_container.html"); |   557   RegisterMockedURL("plugin_container.html"); | 
|   556   CustomPluginWebFrameClient<EventTestPlugin> |   558   CustomPluginWebFrameClient<EventTestPlugin> | 
|   557       plugin_web_frame_client;  // Must outlive webViewHelper. |   559       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   558   FrameTestHelpers::WebViewHelper web_view_helper; |   560   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   559   WebView* web_view = web_view_helper.InitializeAndLoad( |   561   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   560       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   562       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   561   DCHECK(web_view); |   563   DCHECK(web_view); | 
|   562   web_view->GetSettings()->SetPluginsEnabled(true); |   564   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   563   web_view->Resize(WebSize(300, 300)); |   565   web_view->Resize(WebSize(300, 300)); | 
|   564   web_view->UpdateAllLifecyclePhases(); |   566   web_view->UpdateAllLifecyclePhases(); | 
|   565   RunPendingTasks(); |   567   RunPendingTasks(); | 
|   566  |   568  | 
|   567   WebElement plugin_container_one_element = |   569   WebElement plugin_container_one_element = | 
|   568       web_view->MainFrame()->GetDocument().GetElementById( |   570       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   569           WebString::FromUTF8("translated-plugin")); |   571           WebString::FromUTF8("translated-plugin")); | 
|   570   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   572   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   571                           plugin_container_one_element.PluginContainer()) |   573                           plugin_container_one_element.PluginContainer()) | 
|   572                           ->Plugin(); |   574                           ->Plugin(); | 
|   573   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   575   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   574  |   576  | 
|   575   WebMouseWheelEvent event(WebInputEvent::kMouseWheel, |   577   WebMouseWheelEvent event(WebInputEvent::kMouseWheel, | 
|   576                            WebInputEvent::kNoModifiers, |   578                            WebInputEvent::kNoModifiers, | 
|   577                            WebInputEvent::kTimeStampForTesting); |   579                            WebInputEvent::kTimeStampForTesting); | 
|   578  |   580  | 
|   579   WebRect rect = plugin_container_one_element.BoundsInViewport(); |   581   WebRect rect = plugin_container_one_element.BoundsInViewport(); | 
|   580   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); |   582   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); | 
|   581  |   583  | 
|   582   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); |   584   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); | 
|   583   RunPendingTasks(); |   585   RunPendingTasks(); | 
|   584  |   586  | 
|   585   EXPECT_EQ(WebInputEvent::kMouseWheel, test_plugin->GetLastInputEventType()); |   587   EXPECT_EQ(WebInputEvent::kMouseWheel, test_plugin->GetLastInputEventType()); | 
|   586   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); |   588   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); | 
|   587   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); |   589   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); | 
|   588 } |   590 } | 
|   589  |   591  | 
|   590 TEST_F(WebPluginContainerTest, TouchEventScrolled) { |   592 TEST_F(WebPluginContainerTest, TouchEventScrolled) { | 
|   591   RegisterMockedURL("plugin_scroll.html"); |   593   RegisterMockedURL("plugin_scroll.html"); | 
|   592   CustomPluginWebFrameClient<EventTestPlugin> |   594   CustomPluginWebFrameClient<EventTestPlugin> | 
|   593       plugin_web_frame_client;  // Must outlive webViewHelper. |   595       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   594   FrameTestHelpers::WebViewHelper web_view_helper; |   596   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   595   WebView* web_view = web_view_helper.InitializeAndLoad( |   597   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   596       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   598       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   597   DCHECK(web_view); |   599   DCHECK(web_view); | 
|   598   web_view->GetSettings()->SetPluginsEnabled(true); |   600   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   599   web_view->Resize(WebSize(300, 300)); |   601   web_view->Resize(WebSize(300, 300)); | 
|   600   web_view->UpdateAllLifecyclePhases(); |   602   web_view->UpdateAllLifecyclePhases(); | 
|   601   RunPendingTasks(); |   603   RunPendingTasks(); | 
|   602   web_view->SmoothScroll(0, 200, 0); |   604   web_view->SmoothScroll(0, 200, 0); | 
|   603   web_view->UpdateAllLifecyclePhases(); |   605   web_view->UpdateAllLifecyclePhases(); | 
|   604   RunPendingTasks(); |   606   RunPendingTasks(); | 
|   605  |   607  | 
|   606   WebElement plugin_container_one_element = |   608   WebElement plugin_container_one_element = | 
|   607       web_view->MainFrame()->GetDocument().GetElementById( |   609       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   608           WebString::FromUTF8("scrolled-plugin")); |   610           WebString::FromUTF8("scrolled-plugin")); | 
|   609   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   611   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   610       WebPluginContainer::kTouchEventRequestTypeRaw); |   612       WebPluginContainer::kTouchEventRequestTypeRaw); | 
|   611   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   613   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   612                           plugin_container_one_element.PluginContainer()) |   614                           plugin_container_one_element.PluginContainer()) | 
|   613                           ->Plugin(); |   615                           ->Plugin(); | 
|   614   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   616   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   615  |   617  | 
|   616   WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, |   618   WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, | 
|   617                       WebInputEvent::kTimeStampForTesting); |   619                       WebInputEvent::kTimeStampForTesting); | 
|   618   event.touches_length = 1; |   620   event.touches_length = 1; | 
|   619   WebRect rect = plugin_container_one_element.BoundsInViewport(); |   621   WebRect rect = plugin_container_one_element.BoundsInViewport(); | 
|   620   event.touches[0].state = WebTouchPoint::kStatePressed; |   622   event.touches[0].state = WebTouchPoint::kStatePressed; | 
|   621   event.touches[0].SetPositionInWidget(rect.x + rect.width / 2, |   623   event.touches[0].SetPositionInWidget(rect.x + rect.width / 2, | 
|   622                                        rect.y + rect.height / 2); |   624                                        rect.y + rect.height / 2); | 
|   623  |   625  | 
|   624   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); |   626   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); | 
|   625   RunPendingTasks(); |   627   RunPendingTasks(); | 
|   626  |   628  | 
|   627   EXPECT_EQ(WebInputEvent::kTouchStart, test_plugin->GetLastInputEventType()); |   629   EXPECT_EQ(WebInputEvent::kTouchStart, test_plugin->GetLastInputEventType()); | 
|   628   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); |   630   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); | 
|   629   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); |   631   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); | 
|   630 } |   632 } | 
|   631  |   633  | 
|   632 TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) { |   634 TEST_F(WebPluginContainerTest, TouchEventScrolledWithCoalescedTouches) { | 
|   633   RegisterMockedURL("plugin_scroll.html"); |   635   RegisterMockedURL("plugin_scroll.html"); | 
|   634   CustomPluginWebFrameClient<EventTestPlugin> |   636   CustomPluginWebFrameClient<EventTestPlugin> | 
|   635       plugin_web_frame_client;  // Must outlive webViewHelper. |   637       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   636   FrameTestHelpers::WebViewHelper web_view_helper; |   638   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   637   WebView* web_view = web_view_helper.InitializeAndLoad( |   639   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   638       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   640       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   639   DCHECK(web_view); |   641   DCHECK(web_view); | 
|   640   web_view->GetSettings()->SetPluginsEnabled(true); |   642   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   641   web_view->Resize(WebSize(300, 300)); |   643   web_view->Resize(WebSize(300, 300)); | 
|   642   web_view->UpdateAllLifecyclePhases(); |   644   web_view->UpdateAllLifecyclePhases(); | 
|   643   RunPendingTasks(); |   645   RunPendingTasks(); | 
|   644   web_view->SmoothScroll(0, 200, 0); |   646   web_view->SmoothScroll(0, 200, 0); | 
|   645   web_view->UpdateAllLifecyclePhases(); |   647   web_view->UpdateAllLifecyclePhases(); | 
|   646   RunPendingTasks(); |   648   RunPendingTasks(); | 
|   647  |   649  | 
|   648   WebElement plugin_container_one_element = |   650   WebElement plugin_container_one_element = | 
|   649       web_view->MainFrame()->GetDocument().GetElementById( |   651       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   650           WebString::FromUTF8("scrolled-plugin")); |   652           WebString::FromUTF8("scrolled-plugin")); | 
|   651   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   653   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   652       WebPluginContainer::kTouchEventRequestTypeRawLowLatency); |   654       WebPluginContainer::kTouchEventRequestTypeRawLowLatency); | 
|   653   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   655   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   654                           plugin_container_one_element.PluginContainer()) |   656                           plugin_container_one_element.PluginContainer()) | 
|   655                           ->Plugin(); |   657                           ->Plugin(); | 
|   656   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   658   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   657  |   659  | 
|   658   WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, |   660   WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, | 
|   659                       WebInputEvent::kTimeStampForTesting); |   661                       WebInputEvent::kTimeStampForTesting); | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   685   EXPECT_EQ(WebInputEvent::kTouchStart, test_plugin->GetLastInputEventType()); |   687   EXPECT_EQ(WebInputEvent::kTouchStart, test_plugin->GetLastInputEventType()); | 
|   686   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); |   688   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); | 
|   687   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); |   689   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); | 
|   688 } |   690 } | 
|   689  |   691  | 
|   690 TEST_F(WebPluginContainerTest, MouseWheelEventScrolled) { |   692 TEST_F(WebPluginContainerTest, MouseWheelEventScrolled) { | 
|   691   RegisterMockedURL("plugin_scroll.html"); |   693   RegisterMockedURL("plugin_scroll.html"); | 
|   692   CustomPluginWebFrameClient<EventTestPlugin> |   694   CustomPluginWebFrameClient<EventTestPlugin> | 
|   693       plugin_web_frame_client;  // Must outlive webViewHelper. |   695       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   694   FrameTestHelpers::WebViewHelper web_view_helper; |   696   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   695   WebView* web_view = web_view_helper.InitializeAndLoad( |   697   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   696       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   698       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   697   DCHECK(web_view); |   699   DCHECK(web_view); | 
|   698   web_view->GetSettings()->SetPluginsEnabled(true); |   700   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   699   web_view->Resize(WebSize(300, 300)); |   701   web_view->Resize(WebSize(300, 300)); | 
|   700   web_view->UpdateAllLifecyclePhases(); |   702   web_view->UpdateAllLifecyclePhases(); | 
|   701   RunPendingTasks(); |   703   RunPendingTasks(); | 
|   702   web_view->SmoothScroll(0, 200, 0); |   704   web_view->SmoothScroll(0, 200, 0); | 
|   703   web_view->UpdateAllLifecyclePhases(); |   705   web_view->UpdateAllLifecyclePhases(); | 
|   704   RunPendingTasks(); |   706   RunPendingTasks(); | 
|   705  |   707  | 
|   706   WebElement plugin_container_one_element = |   708   WebElement plugin_container_one_element = | 
|   707       web_view->MainFrame()->GetDocument().GetElementById( |   709       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   708           WebString::FromUTF8("scrolled-plugin")); |   710           WebString::FromUTF8("scrolled-plugin")); | 
|   709   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   711   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   710       WebPluginContainer::kTouchEventRequestTypeRaw); |   712       WebPluginContainer::kTouchEventRequestTypeRaw); | 
|   711   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   713   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   712                           plugin_container_one_element.PluginContainer()) |   714                           plugin_container_one_element.PluginContainer()) | 
|   713                           ->Plugin(); |   715                           ->Plugin(); | 
|   714   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   716   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   715  |   717  | 
|   716   WebMouseWheelEvent event(WebInputEvent::kMouseWheel, |   718   WebMouseWheelEvent event(WebInputEvent::kMouseWheel, | 
|   717                            WebInputEvent::kNoModifiers, |   719                            WebInputEvent::kNoModifiers, | 
|   718                            WebInputEvent::kTimeStampForTesting); |   720                            WebInputEvent::kTimeStampForTesting); | 
|   719  |   721  | 
|   720   WebRect rect = plugin_container_one_element.BoundsInViewport(); |   722   WebRect rect = plugin_container_one_element.BoundsInViewport(); | 
|   721   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); |   723   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); | 
|   722  |   724  | 
|   723   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); |   725   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); | 
|   724   RunPendingTasks(); |   726   RunPendingTasks(); | 
|   725  |   727  | 
|   726   EXPECT_EQ(WebInputEvent::kMouseWheel, test_plugin->GetLastInputEventType()); |   728   EXPECT_EQ(WebInputEvent::kMouseWheel, test_plugin->GetLastInputEventType()); | 
|   727   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); |   729   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); | 
|   728   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); |   730   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); | 
|   729 } |   731 } | 
|   730  |   732  | 
|   731 TEST_F(WebPluginContainerTest, MouseEventScrolled) { |   733 TEST_F(WebPluginContainerTest, MouseEventScrolled) { | 
|   732   RegisterMockedURL("plugin_scroll.html"); |   734   RegisterMockedURL("plugin_scroll.html"); | 
|   733   CustomPluginWebFrameClient<EventTestPlugin> |   735   CustomPluginWebFrameClient<EventTestPlugin> | 
|   734       plugin_web_frame_client;  // Must outlive webViewHelper. |   736       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   735   FrameTestHelpers::WebViewHelper web_view_helper; |   737   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   736   WebView* web_view = web_view_helper.InitializeAndLoad( |   738   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   737       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   739       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   738   DCHECK(web_view); |   740   DCHECK(web_view); | 
|   739   web_view->GetSettings()->SetPluginsEnabled(true); |   741   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   740   web_view->Resize(WebSize(300, 300)); |   742   web_view->Resize(WebSize(300, 300)); | 
|   741   web_view->UpdateAllLifecyclePhases(); |   743   web_view->UpdateAllLifecyclePhases(); | 
|   742   RunPendingTasks(); |   744   RunPendingTasks(); | 
|   743   web_view->SmoothScroll(0, 200, 0); |   745   web_view->SmoothScroll(0, 200, 0); | 
|   744   web_view->UpdateAllLifecyclePhases(); |   746   web_view->UpdateAllLifecyclePhases(); | 
|   745   RunPendingTasks(); |   747   RunPendingTasks(); | 
|   746  |   748  | 
|   747   WebElement plugin_container_one_element = |   749   WebElement plugin_container_one_element = | 
|   748       web_view->MainFrame()->GetDocument().GetElementById( |   750       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   749           WebString::FromUTF8("scrolled-plugin")); |   751           WebString::FromUTF8("scrolled-plugin")); | 
|   750   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   752   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   751       WebPluginContainer::kTouchEventRequestTypeRaw); |   753       WebPluginContainer::kTouchEventRequestTypeRaw); | 
|   752   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   754   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   753                           plugin_container_one_element.PluginContainer()) |   755                           plugin_container_one_element.PluginContainer()) | 
|   754                           ->Plugin(); |   756                           ->Plugin(); | 
|   755   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   757   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   756  |   758  | 
|   757   WebMouseEvent event(WebInputEvent::kMouseMove, WebInputEvent::kNoModifiers, |   759   WebMouseEvent event(WebInputEvent::kMouseMove, WebInputEvent::kNoModifiers, | 
|   758                       WebInputEvent::kTimeStampForTesting); |   760                       WebInputEvent::kTimeStampForTesting); | 
|   759  |   761  | 
|   760   WebRect rect = plugin_container_one_element.BoundsInViewport(); |   762   WebRect rect = plugin_container_one_element.BoundsInViewport(); | 
|   761   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); |   763   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); | 
|   762  |   764  | 
|   763   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); |   765   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); | 
|   764   RunPendingTasks(); |   766   RunPendingTasks(); | 
|   765  |   767  | 
|   766   EXPECT_EQ(WebInputEvent::kMouseMove, test_plugin->GetLastInputEventType()); |   768   EXPECT_EQ(WebInputEvent::kMouseMove, test_plugin->GetLastInputEventType()); | 
|   767   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); |   769   EXPECT_EQ(rect.width / 2, test_plugin->GetLastEventLocation().X()); | 
|   768   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); |   770   EXPECT_EQ(rect.height / 2, test_plugin->GetLastEventLocation().Y()); | 
|   769 } |   771 } | 
|   770  |   772  | 
|   771 TEST_F(WebPluginContainerTest, MouseEventZoomed) { |   773 TEST_F(WebPluginContainerTest, MouseEventZoomed) { | 
|   772   RegisterMockedURL("plugin_scroll.html"); |   774   RegisterMockedURL("plugin_scroll.html"); | 
|   773   CustomPluginWebFrameClient<EventTestPlugin> |   775   CustomPluginWebFrameClient<EventTestPlugin> | 
|   774       plugin_web_frame_client;  // Must outlive webViewHelper. |   776       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   775   FrameTestHelpers::WebViewHelper web_view_helper; |   777   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   776   WebView* web_view = web_view_helper.InitializeAndLoad( |   778   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   777       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   779       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   778   DCHECK(web_view); |   780   DCHECK(web_view); | 
|   779   web_view->GetSettings()->SetPluginsEnabled(true); |   781   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   780   web_view->Resize(WebSize(300, 300)); |   782   web_view->Resize(WebSize(300, 300)); | 
|   781   web_view->SetPageScaleFactor(2); |   783   web_view->SetPageScaleFactor(2); | 
|   782   web_view->SmoothScroll(0, 300, 0); |   784   web_view->SmoothScroll(0, 300, 0); | 
|   783   web_view->UpdateAllLifecyclePhases(); |   785   web_view->UpdateAllLifecyclePhases(); | 
|   784   RunPendingTasks(); |   786   RunPendingTasks(); | 
|   785  |   787  | 
|   786   WebElement plugin_container_one_element = |   788   WebElement plugin_container_one_element = | 
|   787       web_view->MainFrame()->GetDocument().GetElementById( |   789       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   788           WebString::FromUTF8("scrolled-plugin")); |   790           WebString::FromUTF8("scrolled-plugin")); | 
|   789   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   791   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   790       WebPluginContainer::kTouchEventRequestTypeRaw); |   792       WebPluginContainer::kTouchEventRequestTypeRaw); | 
|   791   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   793   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   792                           plugin_container_one_element.PluginContainer()) |   794                           plugin_container_one_element.PluginContainer()) | 
|   793                           ->Plugin(); |   795                           ->Plugin(); | 
|   794   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   796   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   795  |   797  | 
|   796   WebMouseEvent event(WebInputEvent::kMouseMove, WebInputEvent::kNoModifiers, |   798   WebMouseEvent event(WebInputEvent::kMouseMove, WebInputEvent::kNoModifiers, | 
|   797                       WebInputEvent::kTimeStampForTesting); |   799                       WebInputEvent::kTimeStampForTesting); | 
|   798  |   800  | 
|   799   WebRect rect = plugin_container_one_element.BoundsInViewport(); |   801   WebRect rect = plugin_container_one_element.BoundsInViewport(); | 
|   800   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); |   802   event.SetPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); | 
|   801  |   803  | 
|   802   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); |   804   web_view->HandleInputEvent(WebCoalescedInputEvent(event)); | 
|   803   RunPendingTasks(); |   805   RunPendingTasks(); | 
|   804  |   806  | 
|   805   // rect.width/height divided by 4 because the rect is in viewport bounds and |   807   // rect.width/height divided by 4 because the rect is in viewport bounds and | 
|   806   // there is a scale of 2 set. |   808   // there is a scale of 2 set. | 
|   807   EXPECT_EQ(WebInputEvent::kMouseMove, test_plugin->GetLastInputEventType()); |   809   EXPECT_EQ(WebInputEvent::kMouseMove, test_plugin->GetLastInputEventType()); | 
|   808   EXPECT_EQ(rect.width / 4, test_plugin->GetLastEventLocation().X()); |   810   EXPECT_EQ(rect.width / 4, test_plugin->GetLastEventLocation().X()); | 
|   809   EXPECT_EQ(rect.height / 4, test_plugin->GetLastEventLocation().Y()); |   811   EXPECT_EQ(rect.height / 4, test_plugin->GetLastEventLocation().Y()); | 
|   810 } |   812 } | 
|   811  |   813  | 
|   812 TEST_F(WebPluginContainerTest, MouseWheelEventZoomed) { |   814 TEST_F(WebPluginContainerTest, MouseWheelEventZoomed) { | 
|   813   RegisterMockedURL("plugin_scroll.html"); |   815   RegisterMockedURL("plugin_scroll.html"); | 
|   814   CustomPluginWebFrameClient<EventTestPlugin> |   816   CustomPluginWebFrameClient<EventTestPlugin> | 
|   815       plugin_web_frame_client;  // Must outlive webViewHelper. |   817       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   816   FrameTestHelpers::WebViewHelper web_view_helper; |   818   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   817   WebView* web_view = web_view_helper.InitializeAndLoad( |   819   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   818       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   820       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   819   DCHECK(web_view); |   821   DCHECK(web_view); | 
|   820   web_view->GetSettings()->SetPluginsEnabled(true); |   822   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   821   web_view->Resize(WebSize(300, 300)); |   823   web_view->Resize(WebSize(300, 300)); | 
|   822   web_view->SetPageScaleFactor(2); |   824   web_view->SetPageScaleFactor(2); | 
|   823   web_view->SmoothScroll(0, 300, 0); |   825   web_view->SmoothScroll(0, 300, 0); | 
|   824   web_view->UpdateAllLifecyclePhases(); |   826   web_view->UpdateAllLifecyclePhases(); | 
|   825   RunPendingTasks(); |   827   RunPendingTasks(); | 
|   826  |   828  | 
|   827   WebElement plugin_container_one_element = |   829   WebElement plugin_container_one_element = | 
|   828       web_view->MainFrame()->GetDocument().GetElementById( |   830       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   829           WebString::FromUTF8("scrolled-plugin")); |   831           WebString::FromUTF8("scrolled-plugin")); | 
|   830   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   832   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   831       WebPluginContainer::kTouchEventRequestTypeRaw); |   833       WebPluginContainer::kTouchEventRequestTypeRaw); | 
|   832   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   834   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   833                           plugin_container_one_element.PluginContainer()) |   835                           plugin_container_one_element.PluginContainer()) | 
|   834                           ->Plugin(); |   836                           ->Plugin(); | 
|   835   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   837   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   836  |   838  | 
|   837   WebMouseWheelEvent event(WebInputEvent::kMouseWheel, |   839   WebMouseWheelEvent event(WebInputEvent::kMouseWheel, | 
|   838                            WebInputEvent::kNoModifiers, |   840                            WebInputEvent::kNoModifiers, | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|   849   EXPECT_EQ(WebInputEvent::kMouseWheel, test_plugin->GetLastInputEventType()); |   851   EXPECT_EQ(WebInputEvent::kMouseWheel, test_plugin->GetLastInputEventType()); | 
|   850   EXPECT_EQ(rect.width / 4, test_plugin->GetLastEventLocation().X()); |   852   EXPECT_EQ(rect.width / 4, test_plugin->GetLastEventLocation().X()); | 
|   851   EXPECT_EQ(rect.height / 4, test_plugin->GetLastEventLocation().Y()); |   853   EXPECT_EQ(rect.height / 4, test_plugin->GetLastEventLocation().Y()); | 
|   852 } |   854 } | 
|   853  |   855  | 
|   854 TEST_F(WebPluginContainerTest, TouchEventZoomed) { |   856 TEST_F(WebPluginContainerTest, TouchEventZoomed) { | 
|   855   RegisterMockedURL("plugin_scroll.html"); |   857   RegisterMockedURL("plugin_scroll.html"); | 
|   856   CustomPluginWebFrameClient<EventTestPlugin> |   858   CustomPluginWebFrameClient<EventTestPlugin> | 
|   857       plugin_web_frame_client;  // Must outlive webViewHelper. |   859       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   858   FrameTestHelpers::WebViewHelper web_view_helper; |   860   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   859   WebView* web_view = web_view_helper.InitializeAndLoad( |   861   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   860       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); |   862       base_url_ + "plugin_scroll.html", &plugin_web_frame_client); | 
|   861   DCHECK(web_view); |   863   DCHECK(web_view); | 
|   862   web_view->GetSettings()->SetPluginsEnabled(true); |   864   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   863   web_view->Resize(WebSize(300, 300)); |   865   web_view->Resize(WebSize(300, 300)); | 
|   864   web_view->SetPageScaleFactor(2); |   866   web_view->SetPageScaleFactor(2); | 
|   865   web_view->SmoothScroll(0, 300, 0); |   867   web_view->SmoothScroll(0, 300, 0); | 
|   866   web_view->UpdateAllLifecyclePhases(); |   868   web_view->UpdateAllLifecyclePhases(); | 
|   867   RunPendingTasks(); |   869   RunPendingTasks(); | 
|   868  |   870  | 
|   869   WebElement plugin_container_one_element = |   871   WebElement plugin_container_one_element = | 
|   870       web_view->MainFrame()->GetDocument().GetElementById( |   872       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   871           WebString::FromUTF8("scrolled-plugin")); |   873           WebString::FromUTF8("scrolled-plugin")); | 
|   872   plugin_container_one_element.PluginContainer()->RequestTouchEventType( |   874   plugin_container_one_element.PluginContainer()->RequestTouchEventType( | 
|   873       WebPluginContainer::kTouchEventRequestTypeRaw); |   875       WebPluginContainer::kTouchEventRequestTypeRaw); | 
|   874   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( |   876   WebPlugin* plugin = static_cast<WebPluginContainerBase*>( | 
|   875                           plugin_container_one_element.PluginContainer()) |   877                           plugin_container_one_element.PluginContainer()) | 
|   876                           ->Plugin(); |   878                           ->Plugin(); | 
|   877   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); |   879   EventTestPlugin* test_plugin = static_cast<EventTestPlugin*>(plugin); | 
|   878  |   880  | 
|   879   WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, |   881   WebTouchEvent event(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, | 
|   880                       WebInputEvent::kTimeStampForTesting); |   882                       WebInputEvent::kTimeStampForTesting); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|   894   EXPECT_EQ(rect.width / 4, test_plugin->GetLastEventLocation().X()); |   896   EXPECT_EQ(rect.width / 4, test_plugin->GetLastEventLocation().X()); | 
|   895   EXPECT_EQ(rect.height / 4, test_plugin->GetLastEventLocation().Y()); |   897   EXPECT_EQ(rect.height / 4, test_plugin->GetLastEventLocation().Y()); | 
|   896 } |   898 } | 
|   897  |   899  | 
|   898 // Verify that isRectTopmost returns false when the document is detached. |   900 // Verify that isRectTopmost returns false when the document is detached. | 
|   899 TEST_F(WebPluginContainerTest, IsRectTopmostTest) { |   901 TEST_F(WebPluginContainerTest, IsRectTopmostTest) { | 
|   900   RegisterMockedURL("plugin_container.html"); |   902   RegisterMockedURL("plugin_container.html"); | 
|   901   TestPluginWebFrameClient |   903   TestPluginWebFrameClient | 
|   902       plugin_web_frame_client;  // Must outlive webViewHelper. |   904       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   903   FrameTestHelpers::WebViewHelper web_view_helper; |   905   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   904   WebView* web_view = web_view_helper.InitializeAndLoad( |   906   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   905       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   907       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   906   DCHECK(web_view); |   908   DCHECK(web_view); | 
|   907   web_view->GetSettings()->SetPluginsEnabled(true); |   909   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   908   web_view->Resize(WebSize(300, 300)); |   910   web_view->Resize(WebSize(300, 300)); | 
|   909   web_view->UpdateAllLifecyclePhases(); |   911   web_view->UpdateAllLifecyclePhases(); | 
|   910   RunPendingTasks(); |   912   RunPendingTasks(); | 
|   911  |   913  | 
|   912   WebPluginContainerBase* plugin_container_impl = |   914   WebPluginContainerBase* plugin_container_impl = | 
|   913       ToWebPluginContainerBase(GetWebPluginContainer( |   915       ToWebPluginContainerBase(GetWebPluginContainer( | 
|   914           web_view, WebString::FromUTF8("translated-plugin"))); |   916           web_view, WebString::FromUTF8("translated-plugin"))); | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   940       plugin_web_frame_client;  // Must outlive webViewHelper. |   942       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   941   FrameTestHelpers::WebViewHelper web_view_helper; |   943   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   942   WebView* web_view = web_view_helper.InitializeAndLoad( |   944   WebView* web_view = web_view_helper.InitializeAndLoad( | 
|   943       base_url_ + "plugin_containing_page.html", &plugin_web_frame_client); |   945       base_url_ + "plugin_containing_page.html", &plugin_web_frame_client); | 
|   944   DCHECK(web_view); |   946   DCHECK(web_view); | 
|   945   web_view->GetSettings()->SetPluginsEnabled(true); |   947   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   946   web_view->Resize(WebSize(300, 300)); |   948   web_view->Resize(WebSize(300, 300)); | 
|   947   web_view->UpdateAllLifecyclePhases(); |   949   web_view->UpdateAllLifecyclePhases(); | 
|   948   RunPendingTasks(); |   950   RunPendingTasks(); | 
|   949  |   951  | 
|   950   WebElement plugin_element = |   952   WebElement plugin_element = web_view->MainFrame() | 
|   951       web_view->MainFrame()->FirstChild()->GetDocument().GetElementById( |   953                                   ->FirstChild() | 
|   952           "translated-plugin"); |   954                                   ->ToWebLocalFrame() | 
 |   955                                   ->GetDocument() | 
 |   956                                   .GetElementById("translated-plugin"); | 
|   953   WebPluginContainerBase* plugin_container_impl = |   957   WebPluginContainerBase* plugin_container_impl = | 
|   954       ToWebPluginContainerBase(plugin_element.PluginContainer()); |   958       ToWebPluginContainerBase(plugin_element.PluginContainer()); | 
|   955  |   959  | 
|   956   DCHECK(plugin_container_impl); |   960   DCHECK(plugin_container_impl); | 
|   957  |   961  | 
|   958   IntRect window_rect, clip_rect, unobscured_rect; |   962   IntRect window_rect, clip_rect, unobscured_rect; | 
|   959   CalculateGeometry(plugin_container_impl, window_rect, clip_rect, |   963   CalculateGeometry(plugin_container_impl, window_rect, clip_rect, | 
|   960                     unobscured_rect); |   964                     unobscured_rect); | 
|   961   EXPECT_RECT_EQ(IntRect(20, 220, 40, 40), window_rect); |   965   EXPECT_RECT_EQ(IntRect(20, 220, 40, 40), window_rect); | 
|   962   EXPECT_RECT_EQ(IntRect(0, 0, 40, 40), clip_rect); |   966   EXPECT_RECT_EQ(IntRect(0, 0, 40, 40), clip_rect); | 
|   963   EXPECT_RECT_EQ(IntRect(0, 0, 40, 40), unobscured_rect); |   967   EXPECT_RECT_EQ(IntRect(0, 0, 40, 40), unobscured_rect); | 
|   964  |   968  | 
|   965   // Cause the plugin's frame to be detached. |   969   // Cause the plugin's frame to be detached. | 
|   966   web_view_helper.Reset(); |   970   web_view_helper.Reset(); | 
|   967 } |   971 } | 
|   968  |   972  | 
|   969 TEST_F(WebPluginContainerTest, ClippedRectsForSubpixelPositionedPlugin) { |   973 TEST_F(WebPluginContainerTest, ClippedRectsForSubpixelPositionedPlugin) { | 
|   970   RegisterMockedURL("plugin_container.html"); |   974   RegisterMockedURL("plugin_container.html"); | 
|   971  |   975  | 
|   972   TestPluginWebFrameClient |   976   TestPluginWebFrameClient | 
|   973       plugin_web_frame_client;  // Must outlive webViewHelper. |   977       plugin_web_frame_client;  // Must outlive webViewHelper. | 
|   974   FrameTestHelpers::WebViewHelper web_view_helper; |   978   FrameTestHelpers::WebViewHelper web_view_helper; | 
|   975   WebView* web_view = web_view_helper.InitializeAndLoad( |   979   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|   976       base_url_ + "plugin_container.html", &plugin_web_frame_client); |   980       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|   977   DCHECK(web_view); |   981   DCHECK(web_view); | 
|   978   web_view->GetSettings()->SetPluginsEnabled(true); |   982   web_view->GetSettings()->SetPluginsEnabled(true); | 
|   979   web_view->Resize(WebSize(300, 300)); |   983   web_view->Resize(WebSize(300, 300)); | 
|   980   web_view->UpdateAllLifecyclePhases(); |   984   web_view->UpdateAllLifecyclePhases(); | 
|   981   RunPendingTasks(); |   985   RunPendingTasks(); | 
|   982  |   986  | 
|   983   WebElement plugin_element = |   987   WebElement plugin_element = | 
|   984       web_view->MainFrame()->GetDocument().GetElementById( |   988       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|   985           "subpixel-positioned-plugin"); |   989           "subpixel-positioned-plugin"); | 
|   986   WebPluginContainerBase* plugin_container_impl = |   990   WebPluginContainerBase* plugin_container_impl = | 
|   987       ToWebPluginContainerBase(plugin_element.PluginContainer()); |   991       ToWebPluginContainerBase(plugin_element.PluginContainer()); | 
|   988  |   992  | 
|   989   DCHECK(plugin_container_impl); |   993   DCHECK(plugin_container_impl); | 
|   990  |   994  | 
|   991   IntRect window_rect, clip_rect, unobscured_rect; |   995   IntRect window_rect, clip_rect, unobscured_rect; | 
|   992   CalculateGeometry(plugin_container_impl, window_rect, clip_rect, |   996   CalculateGeometry(plugin_container_impl, window_rect, clip_rect, | 
|   993                     unobscured_rect); |   997                     unobscured_rect); | 
|   994   EXPECT_RECT_EQ(IntRect(0, 0, 40, 40), window_rect); |   998   EXPECT_RECT_EQ(IntRect(0, 0, 40, 40), window_rect); | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  1014       // In destroy, IsRectTopmost is no longer valid. |  1018       // In destroy, IsRectTopmost is no longer valid. | 
|  1015       EXPECT_FALSE(Container()->IsRectTopmost(topmost_rect)); |  1019       EXPECT_FALSE(Container()->IsRectTopmost(topmost_rect)); | 
|  1016       FakeWebPlugin::Destroy(); |  1020       FakeWebPlugin::Destroy(); | 
|  1017     } |  1021     } | 
|  1018   }; |  1022   }; | 
|  1019  |  1023  | 
|  1020   RegisterMockedURL("plugin_container.html"); |  1024   RegisterMockedURL("plugin_container.html"); | 
|  1021   // The client must outlive WebViewHelper. |  1025   // The client must outlive WebViewHelper. | 
|  1022   CustomPluginWebFrameClient<TopmostPlugin> plugin_web_frame_client; |  1026   CustomPluginWebFrameClient<TopmostPlugin> plugin_web_frame_client; | 
|  1023   FrameTestHelpers::WebViewHelper web_view_helper; |  1027   FrameTestHelpers::WebViewHelper web_view_helper; | 
|  1024   WebView* web_view = web_view_helper.InitializeAndLoad( |  1028   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|  1025       base_url_ + "plugin_container.html", &plugin_web_frame_client); |  1029       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|  1026   DCHECK(web_view); |  1030   DCHECK(web_view); | 
|  1027   web_view->GetSettings()->SetPluginsEnabled(true); |  1031   web_view->GetSettings()->SetPluginsEnabled(true); | 
|  1028   web_view->Resize(WebSize(300, 300)); |  1032   web_view->Resize(WebSize(300, 300)); | 
|  1029   web_view->UpdateAllLifecyclePhases(); |  1033   web_view->UpdateAllLifecyclePhases(); | 
|  1030   RunPendingTasks(); |  1034   RunPendingTasks(); | 
|  1031  |  1035  | 
|  1032   WebPluginContainerBase* plugin_container_impl = |  1036   WebPluginContainerBase* plugin_container_impl = | 
|  1033       ToWebPluginContainerBase(GetWebPluginContainer( |  1037       ToWebPluginContainerBase(GetWebPluginContainer( | 
|  1034           web_view, WebString::FromUTF8("translated-plugin"))); |  1038           web_view, WebString::FromUTF8("translated-plugin"))); | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1074   std::unique_ptr<WebLayer> layer_; |  1078   std::unique_ptr<WebLayer> layer_; | 
|  1075 }; |  1079 }; | 
|  1076  |  1080  | 
|  1077 }  // namespace |  1081 }  // namespace | 
|  1078  |  1082  | 
|  1079 TEST_F(WebPluginContainerTest, CompositedPluginSPv2) { |  1083 TEST_F(WebPluginContainerTest, CompositedPluginSPv2) { | 
|  1080   ScopedSlimmingPaintV2ForTest enable_s_pv2(true); |  1084   ScopedSlimmingPaintV2ForTest enable_s_pv2(true); | 
|  1081   RegisterMockedURL("plugin.html"); |  1085   RegisterMockedURL("plugin.html"); | 
|  1082   CustomPluginWebFrameClient<CompositedPlugin> web_frame_client; |  1086   CustomPluginWebFrameClient<CompositedPlugin> web_frame_client; | 
|  1083   FrameTestHelpers::WebViewHelper web_view_helper; |  1087   FrameTestHelpers::WebViewHelper web_view_helper; | 
|  1084   WebView* web_view = web_view_helper.InitializeAndLoad( |  1088   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|  1085       base_url_ + "plugin.html", &web_frame_client); |  1089       base_url_ + "plugin.html", &web_frame_client); | 
|  1086   ASSERT_TRUE(web_view); |  1090   ASSERT_TRUE(web_view); | 
|  1087   web_view->GetSettings()->SetPluginsEnabled(true); |  1091   web_view->GetSettings()->SetPluginsEnabled(true); | 
|  1088   web_view->Resize(WebSize(800, 600)); |  1092   web_view->Resize(WebSize(800, 600)); | 
|  1089   web_view->UpdateAllLifecyclePhases(); |  1093   web_view->UpdateAllLifecyclePhases(); | 
|  1090   RunPendingTasks(); |  1094   RunPendingTasks(); | 
|  1091  |  1095  | 
|  1092   WebPluginContainerBase* container = static_cast<WebPluginContainerBase*>( |  1096   WebPluginContainerBase* container = static_cast<WebPluginContainerBase*>( | 
|  1093       GetWebPluginContainer(web_view, WebString::FromUTF8("plugin"))); |  1097       GetWebPluginContainer(web_view, WebString::FromUTF8("plugin"))); | 
|  1094   ASSERT_TRUE(container); |  1098   ASSERT_TRUE(container); | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|  1125   FrameTestHelpers::WebViewHelper web_view_helper; |  1129   FrameTestHelpers::WebViewHelper web_view_helper; | 
|  1126   WebViewBase* web_view = web_view_helper.InitializeAndLoad( |  1130   WebViewBase* web_view = web_view_helper.InitializeAndLoad( | 
|  1127       base_url_ + "plugin_container.html", &plugin_web_frame_client); |  1131       base_url_ + "plugin_container.html", &plugin_web_frame_client); | 
|  1128   DCHECK(web_view); |  1132   DCHECK(web_view); | 
|  1129   web_view->GetSettings()->SetPluginsEnabled(true); |  1133   web_view->GetSettings()->SetPluginsEnabled(true); | 
|  1130   web_view->Resize(WebSize(300, 300)); |  1134   web_view->Resize(WebSize(300, 300)); | 
|  1131   web_view->UpdateAllLifecyclePhases(); |  1135   web_view->UpdateAllLifecyclePhases(); | 
|  1132   RunPendingTasks(); |  1136   RunPendingTasks(); | 
|  1133  |  1137  | 
|  1134   WebElement plugin_container_one_element = |  1138   WebElement plugin_container_one_element = | 
|  1135       web_view->MainFrame()->GetDocument().GetElementById( |  1139       web_view->MainFrameImpl()->GetDocument().GetElementById( | 
|  1136           WebString::FromUTF8("translated-plugin")); |  1140           WebString::FromUTF8("translated-plugin")); | 
|  1137   plugin_container_one_element.PluginContainer()->SetWantsWheelEvents(true); |  1141   plugin_container_one_element.PluginContainer()->SetWantsWheelEvents(true); | 
|  1138  |  1142  | 
|  1139   RunPendingTasks(); |  1143   RunPendingTasks(); | 
|  1140   EXPECT_TRUE(web_view->GetPage()->GetEventHandlerRegistry().HasEventHandlers( |  1144   EXPECT_TRUE(web_view->GetPage()->GetEventHandlerRegistry().HasEventHandlers( | 
|  1141       EventHandlerRegistry::kWheelEventBlocking)); |  1145       EventHandlerRegistry::kWheelEventBlocking)); | 
|  1142 } |  1146 } | 
|  1143  |  1147  | 
|  1144 }  // namespace blink |  1148 }  // namespace blink | 
| OLD | NEW |