| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "content/shell/browser/shell.h" | 31 #include "content/shell/browser/shell.h" |
| 32 #include "content/test/content_browser_test.h" | 32 #include "content/test/content_browser_test.h" |
| 33 #include "content/test/content_browser_test_utils.h" | 33 #include "content/test/content_browser_test_utils.h" |
| 34 #include "net/base/net_util.h" | 34 #include "net/base/net_util.h" |
| 35 #include "net/test/embedded_test_server/embedded_test_server.h" | 35 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 36 #include "net/test/embedded_test_server/http_request.h" | 36 #include "net/test/embedded_test_server/http_request.h" |
| 37 #include "net/test/embedded_test_server/http_response.h" | 37 #include "net/test/embedded_test_server/http_response.h" |
| 38 #include "net/test/spawned_test_server/spawned_test_server.h" | 38 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 39 #include "third_party/WebKit/public/web/WebInputEvent.h" | 39 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 40 | 40 |
| 41 using WebKit::WebInputEvent; | 41 using blink::WebInputEvent; |
| 42 using WebKit::WebMouseEvent; | 42 using blink::WebMouseEvent; |
| 43 using content::BrowserPluginEmbedder; | 43 using content::BrowserPluginEmbedder; |
| 44 using content::BrowserPluginGuest; | 44 using content::BrowserPluginGuest; |
| 45 using content::BrowserPluginHostFactory; | 45 using content::BrowserPluginHostFactory; |
| 46 using content::WebContentsImpl; | 46 using content::WebContentsImpl; |
| 47 | 47 |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 const char kHTMLForGuest[] = | 50 const char kHTMLForGuest[] = |
| 51 "data:text/html,<html><body>hello world</body></html>"; | 51 "data:text/html,<html><body>hello world</body></html>"; |
| 52 const char kHTMLForGuestTouchHandler[] = | 52 const char kHTMLForGuestTouchHandler[] = |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // This means the guest will be painted properly at that size. | 389 // This means the guest will be painted properly at that size. |
| 390 test_guest()->WaitForDamageBufferWithSize(nxt_size); | 390 test_guest()->WaitForDamageBufferWithSize(nxt_size); |
| 391 } | 391 } |
| 392 | 392 |
| 393 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { | 393 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { |
| 394 const char kEmbedderURL[] = "/browser_plugin_focus.html"; | 394 const char kEmbedderURL[] = "/browser_plugin_focus.html"; |
| 395 const char* kGuestURL = "/browser_plugin_focus_child.html"; | 395 const char* kGuestURL = "/browser_plugin_focus_child.html"; |
| 396 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, std::string()); | 396 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, std::string()); |
| 397 | 397 |
| 398 SimulateMouseClick(test_embedder()->web_contents(), 0, | 398 SimulateMouseClick(test_embedder()->web_contents(), 0, |
| 399 WebKit::WebMouseEvent::ButtonLeft); | 399 blink::WebMouseEvent::ButtonLeft); |
| 400 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents()); | 400 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents()); |
| 401 // Wait until we focus into the guest. | 401 // Wait until we focus into the guest. |
| 402 test_guest()->WaitForFocus(); | 402 test_guest()->WaitForFocus(); |
| 403 | 403 |
| 404 // TODO(fsamuel): A third Tab key press should not be necessary. | 404 // TODO(fsamuel): A third Tab key press should not be necessary. |
| 405 // The browser plugin will take keyboard focus but it will not | 405 // The browser plugin will take keyboard focus but it will not |
| 406 // focus an initial element. The initial element is dependent | 406 // focus an initial element. The initial element is dependent |
| 407 // upon tab direction which WebKit does not propagate to the plugin. | 407 // upon tab direction which WebKit does not propagate to the plugin. |
| 408 // See http://crbug.com/147644. | 408 // See http://crbug.com/147644. |
| 409 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents()); | 409 BrowserPluginHostTest::SimulateTabKeyPress(test_embedder()->web_contents()); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // Pretend that the URL is being dragged over the embedder. Start the drag | 626 // Pretend that the URL is being dragged over the embedder. Start the drag |
| 627 // from outside the plugin, then move the drag inside the plugin and drop. | 627 // from outside the plugin, then move the drag inside the plugin and drop. |
| 628 // This should trigger appropriate messages from the embedder to the guest, | 628 // This should trigger appropriate messages from the embedder to the guest, |
| 629 // and end with a drop on the guest. The guest changes title when a drop | 629 // and end with a drop on the guest. The guest changes title when a drop |
| 630 // happens. | 630 // happens. |
| 631 const string16 expected_title = ASCIIToUTF16("DROPPED"); | 631 const string16 expected_title = ASCIIToUTF16("DROPPED"); |
| 632 content::TitleWatcher title_watcher(test_guest()->web_contents(), | 632 content::TitleWatcher title_watcher(test_guest()->web_contents(), |
| 633 expected_title); | 633 expected_title); |
| 634 | 634 |
| 635 rvh->DragTargetDragEnter(drop_data, gfx::Point(start_x, start_y), | 635 rvh->DragTargetDragEnter(drop_data, gfx::Point(start_x, start_y), |
| 636 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0); | 636 gfx::Point(start_x, start_y), blink::WebDragOperationEvery, 0); |
| 637 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), | 637 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), |
| 638 WebKit::WebDragOperationEvery, 0); | 638 blink::WebDragOperationEvery, 0); |
| 639 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0); | 639 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0); |
| 640 | 640 |
| 641 string16 actual_title = title_watcher.WaitAndGetTitle(); | 641 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 642 EXPECT_EQ(expected_title, actual_title); | 642 EXPECT_EQ(expected_title, actual_title); |
| 643 } | 643 } |
| 644 | 644 |
| 645 // This test verifies that round trip postMessage works as expected. | 645 // This test verifies that round trip postMessage works as expected. |
| 646 // 1. The embedder posts a message 'testing123' to the guest. | 646 // 1. The embedder posts a message 'testing123' to the guest. |
| 647 // 2. The guest receives and replies to the message using the event object's | 647 // 2. The guest receives and replies to the message using the event object's |
| 648 // source object: event.source.postMessage('foobar', '*') | 648 // source object: event.source.postMessage('foobar', '*') |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 // Attempt a navigation to chrome-guest://abc123, which is a valid URL. But it | 814 // Attempt a navigation to chrome-guest://abc123, which is a valid URL. But it |
| 815 // should be blocked because the scheme isn't web-safe or a pseudo-scheme. | 815 // should be blocked because the scheme isn't web-safe or a pseudo-scheme. |
| 816 ExecuteSyncJSFunction( | 816 ExecuteSyncJSFunction( |
| 817 test_embedder()->web_contents()->GetRenderViewHost(), | 817 test_embedder()->web_contents()->GetRenderViewHost(), |
| 818 base::StringPrintf("SetSrc('%s://abc123');", kGuestScheme)); | 818 base::StringPrintf("SetSrc('%s://abc123');", kGuestScheme)); |
| 819 EXPECT_TRUE(delegate->load_aborted()); | 819 EXPECT_TRUE(delegate->load_aborted()); |
| 820 EXPECT_TRUE(delegate->load_aborted_url().is_valid()); | 820 EXPECT_TRUE(delegate->load_aborted_url().is_valid()); |
| 821 } | 821 } |
| 822 | 822 |
| 823 } // namespace content | 823 } // namespace content |
| OLD | NEW |