OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
12 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 12 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
13 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 13 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
14 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h" | 14 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h" |
15 #include "content/browser/browser_plugin/test_browser_plugin_guest.h" | 15 #include "content/browser/browser_plugin/test_browser_plugin_guest.h" |
16 #include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h" | 16 #include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h" |
17 #include "content/browser/child_process_security_policy_impl.h" | 17 #include "content/browser/child_process_security_policy_impl.h" |
18 #include "content/browser/renderer_host/render_view_host_impl.h" | 18 #include "content/browser/renderer_host/render_view_host_impl.h" |
19 #include "content/browser/web_contents/web_contents_impl.h" | 19 #include "content/browser/web_contents/web_contents_impl.h" |
20 #include "content/common/view_messages.h" | 20 #include "content/common/view_messages.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
23 #include "content/public/browser/render_view_host_observer.h" | 23 #include "content/public/browser/render_view_host_observer.h" |
24 #include "content/public/browser/render_widget_host_view.h" | 24 #include "content/public/browser/render_widget_host_view.h" |
25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/drop_data.h" |
26 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
27 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
28 #include "content/shell/shell.h" | 29 #include "content/shell/shell.h" |
29 #include "content/test/content_browser_test.h" | 30 #include "content/test/content_browser_test.h" |
30 #include "content/test/content_browser_test_utils.h" | 31 #include "content/test/content_browser_test_utils.h" |
31 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
32 #include "net/test/embedded_test_server/embedded_test_server.h" | 33 #include "net/test/embedded_test_server/embedded_test_server.h" |
33 #include "net/test/embedded_test_server/http_request.h" | 34 #include "net/test/embedded_test_server/http_request.h" |
34 #include "net/test/embedded_test_server/http_response.h" | 35 #include "net/test/embedded_test_server/http_response.h" |
35 #include "net/test/spawned_test_server/spawned_test_server.h" | 36 #include "net/test/spawned_test_server/spawned_test_server.h" |
36 #include "third_party/WebKit/public/web/WebInputEvent.h" | 37 #include "third_party/WebKit/public/web/WebInputEvent.h" |
37 #include "webkit/common/webdropdata.h" | |
38 | 38 |
39 using WebKit::WebInputEvent; | 39 using WebKit::WebInputEvent; |
40 using WebKit::WebMouseEvent; | 40 using WebKit::WebMouseEvent; |
41 using content::BrowserPluginEmbedder; | 41 using content::BrowserPluginEmbedder; |
42 using content::BrowserPluginGuest; | 42 using content::BrowserPluginGuest; |
43 using content::BrowserPluginHostFactory; | 43 using content::BrowserPluginHostFactory; |
44 using content::WebContentsImpl; | 44 using content::WebContentsImpl; |
45 | 45 |
46 namespace { | 46 namespace { |
47 | 47 |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 ASSERT_TRUE(value->GetAsList(&start) && start->GetSize() == 2); | 856 ASSERT_TRUE(value->GetAsList(&start) && start->GetSize() == 2); |
857 double start_x, start_y; | 857 double start_x, start_y; |
858 ASSERT_TRUE(start->GetDouble(0, &start_x) && start->GetDouble(1, &start_y)); | 858 ASSERT_TRUE(start->GetDouble(0, &start_x) && start->GetDouble(1, &start_y)); |
859 | 859 |
860 // Get a location in the embedder that falls inside the plugin. | 860 // Get a location in the embedder that falls inside the plugin. |
861 value = content::ExecuteScriptAndGetValue(rvh, "dropLocation()"); | 861 value = content::ExecuteScriptAndGetValue(rvh, "dropLocation()"); |
862 ASSERT_TRUE(value->GetAsList(&end) && end->GetSize() == 2); | 862 ASSERT_TRUE(value->GetAsList(&end) && end->GetSize() == 2); |
863 double end_x, end_y; | 863 double end_x, end_y; |
864 ASSERT_TRUE(end->GetDouble(0, &end_x) && end->GetDouble(1, &end_y)); | 864 ASSERT_TRUE(end->GetDouble(0, &end_x) && end->GetDouble(1, &end_y)); |
865 | 865 |
866 WebDropData drop_data; | 866 DropData drop_data; |
867 GURL url = GURL("https://www.domain.com/index.html"); | 867 GURL url = GURL("https://www.domain.com/index.html"); |
868 drop_data.url = url; | 868 drop_data.url = url; |
869 | 869 |
870 // Pretend that the URL is being dragged over the embedder. Start the drag | 870 // Pretend that the URL is being dragged over the embedder. Start the drag |
871 // from outside the plugin, then move the drag inside the plugin and drop. | 871 // from outside the plugin, then move the drag inside the plugin and drop. |
872 // This should trigger appropriate messages from the embedder to the guest, | 872 // This should trigger appropriate messages from the embedder to the guest, |
873 // and end with a drop on the guest. The guest changes title when a drop | 873 // and end with a drop on the guest. The guest changes title when a drop |
874 // happens. | 874 // happens. |
875 const string16 expected_title = ASCIIToUTF16("DROPPED"); | 875 const string16 expected_title = ASCIIToUTF16("DROPPED"); |
876 content::TitleWatcher title_watcher(test_guest()->web_contents(), | 876 content::TitleWatcher title_watcher(test_guest()->web_contents(), |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 // in the guest. | 1239 // in the guest. |
1240 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) { | 1240 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) { |
1241 const char* kEmbedderURL = "/browser_plugin_embedder.html"; | 1241 const char* kEmbedderURL = "/browser_plugin_embedder.html"; |
1242 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); | 1242 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); |
1243 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 1243 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
1244 test_guest()->web_contents()->GetRenderViewHost()); | 1244 test_guest()->web_contents()->GetRenderViewHost()); |
1245 EXPECT_TRUE(rvh->input_method_active()); | 1245 EXPECT_TRUE(rvh->input_method_active()); |
1246 } | 1246 } |
1247 | 1247 |
1248 } // namespace content | 1248 } // namespace content |
OLD | NEW |