Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 10941042: Browser plugin: Implement loadStart and loadAbort events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extra space Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/common/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698