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

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

Issue 11035067: Add loadCommit and loadStop Event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Test and Nits 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/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/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 std::string result; 702 std::string result;
703 EXPECT_TRUE(v->GetAsString(&result)); 703 EXPECT_TRUE(v->GetAsString(&result));
704 EXPECT_EQ(redirect_url.spec().c_str(), result); 704 EXPECT_EQ(redirect_url.spec().c_str(), result);
705 705
706 v = rvh->ExecuteJavascriptAndGetValue( 706 v = rvh->ExecuteJavascriptAndGetValue(
707 string16(), ASCIIToUTF16("redirectNewUrl")); 707 string16(), ASCIIToUTF16("redirectNewUrl"));
708 EXPECT_TRUE(v->GetAsString(&result)); 708 EXPECT_TRUE(v->GetAsString(&result));
709 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); 709 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result);
710 } 710 }
711 711
712 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) {
713 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
714 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
715
716 const string16 expected_title = ASCIIToUTF16("loadStop");
717 content::TitleWatcher title_watcher(
718 test_embedder()->web_contents(), expected_title);
719 // Renavigate the guest to |kHTMLForGuest|.
720 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
721 test_embedder()->web_contents()->GetRenderViewHost());
722 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
723 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
724
725 string16 actual_title = title_watcher.WaitAndGetTitle();
726 EXPECT_EQ(expected_title, actual_title);
727 }
728
729 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) {
730 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
731 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
732
733 const string16 expected_prefix = ASCIIToUTF16("loadCommit:");
734 const string16 expected_title = expected_prefix+ASCIIToUTF16(kHTMLForGuest);
Charlie Reis 2012/10/11 21:56:33 I would suggest StringPrintf on "loadCommit:%s" in
irobert 2012/10/15 19:51:40 Done.
735 content::TitleWatcher title_watcher(
736 test_embedder()->web_contents(), expected_title);
737 // Renavigate the guest to |kHTMLForGuest|.
738 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
739 test_embedder()->web_contents()->GetRenderViewHost());
740 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
741 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
742
743 string16 actual_title = title_watcher.WaitAndGetTitle();
744 EXPECT_EQ(expected_title, actual_title);
745 base::Value* isTopLevel = rvh->ExecuteJavascriptAndGetValue(
746 string16(), ASCIIToUTF16("commitIsTopLevel"));
747 bool t;
748 EXPECT_TRUE(isTopLevel->GetAsBoolean(&t));
749 EXPECT_EQ(true, t);
750 }
751
712 } // namespace content 752 } // 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