OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/memory/singleton.h" | 5 #include "base/memory/singleton.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 instance_map.begin()->second); | 602 instance_map.begin()->second); |
603 TestBrowserPluginGuest* new_test_guest = | 603 TestBrowserPluginGuest* new_test_guest = |
604 static_cast<TestBrowserPluginGuest*>( | 604 static_cast<TestBrowserPluginGuest*>( |
605 test_guest_web_contents->GetBrowserPluginGuest()); | 605 test_guest_web_contents->GetBrowserPluginGuest()); |
606 | 606 |
607 // Wait for the guest to send an UpdateRectMsg, meaning it is ready. | 607 // Wait for the guest to send an UpdateRectMsg, meaning it is ready. |
608 new_test_guest->WaitForUpdateRectMsg(); | 608 new_test_guest->WaitForUpdateRectMsg(); |
609 } | 609 } |
610 } | 610 } |
611 | 611 |
| 612 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) { |
| 613 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; |
| 614 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); |
| 615 |
| 616 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest); |
| 617 content::TitleWatcher title_watcher(test_embedder()->web_contents(), |
| 618 expected_title); |
| 619 // Renavigate the guest to |kHTMLForGuest|. |
| 620 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 621 test_embedder()->web_contents()->GetRenderViewHost()); |
| 622 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( |
| 623 StringPrintf("SetSrc('%s');", kHTMLForGuest))); |
| 624 |
| 625 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 626 EXPECT_EQ(expected_title, actual_title); |
| 627 } |
| 628 |
| 629 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadAbort) { |
| 630 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; |
| 631 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); |
| 632 |
| 633 const string16 expected_title = ASCIIToUTF16("ERR_EMPTY_RESPONSE"); |
| 634 content::TitleWatcher title_watcher(test_embedder()->web_contents(), |
| 635 expected_title); |
| 636 |
| 637 // Renavigate the guest to "close-socket". |
| 638 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 639 test_embedder()->web_contents()->GetRenderViewHost()); |
| 640 GURL test_url = test_server()->GetURL("close-socket"); |
| 641 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( |
| 642 StringPrintf("SetSrc('%s');", test_url.spec().c_str()))); |
| 643 |
| 644 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 645 EXPECT_EQ(expected_title, actual_title); |
| 646 } |
| 647 |
612 } // namespace content | 648 } // namespace content |
OLD | NEW |