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

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 Comments 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 rvh->DragTargetDragEnter(drop_data, gfx::Point(start_x, start_y), 826 rvh->DragTargetDragEnter(drop_data, gfx::Point(start_x, start_y),
827 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0); 827 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0);
828 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 828 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y),
829 WebKit::WebDragOperationEvery, 0); 829 WebKit::WebDragOperationEvery, 0);
830 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0); 830 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0);
831 831
832 string16 actual_title = title_watcher.WaitAndGetTitle(); 832 string16 actual_title = title_watcher.WaitAndGetTitle();
833 EXPECT_EQ(expected_title, actual_title); 833 EXPECT_EQ(expected_title, actual_title);
834 } 834 }
835 835
836 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) {
837 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
838 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
839
840 const string16 expected_title = ASCIIToUTF16("loadStop");
841 content::TitleWatcher title_watcher(
842 test_embedder()->web_contents(), expected_title);
843 // Renavigate the guest to |kHTMLForGuest|.
844 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
845 test_embedder()->web_contents()->GetRenderViewHost());
846 ExecuteSyncJSFunction(rvh, ASCIIToUTF16(
847 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
848
849 string16 actual_title = title_watcher.WaitAndGetTitle();
850 EXPECT_EQ(expected_title, actual_title);
851 }
852
853 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) {
854 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
855 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
856
857 //const string16 expected_prefix = ASCIIToUTF16("loadCommit:");
858 const string16 expected_title = ASCIIToUTF16(
859 StringPrintf("loadCommit:%s", kHTMLForGuest));
860 content::TitleWatcher title_watcher(
861 test_embedder()->web_contents(), expected_title);
862 // Renavigate the guest to |kHTMLForGuest|.
863 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
864 test_embedder()->web_contents()->GetRenderViewHost());
865 ExecuteSyncJSFunction(rvh, ASCIIToUTF16(
866 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
867
868 string16 actual_title = title_watcher.WaitAndGetTitle();
869 EXPECT_EQ(expected_title, actual_title);
870 scoped_ptr<base::Value> isTopLevel(rvh->ExecuteJavascriptAndGetValue(
Charlie Reis 2012/10/16 21:17:55 nit: is_top_level
irobert 2012/10/17 20:12:37 Done.
871 string16(), ASCIIToUTF16("commitIsTopLevel")));
872 bool t;
Charlie Reis 2012/10/16 21:17:55 bool top_level_bool = false;
irobert 2012/10/17 20:12:37 Done.
873 EXPECT_TRUE(isTopLevel->GetAsBoolean(&t));
874 EXPECT_EQ(true, t);
875 }
876
836 } // namespace content 877 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698