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

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 DidNavigate Struct and Test 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 rvh->DragTargetDragEnter(drop_data, gfx::Point(start_x, start_y), 783 rvh->DragTargetDragEnter(drop_data, gfx::Point(start_x, start_y),
784 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0); 784 gfx::Point(start_x, start_y), WebKit::WebDragOperationEvery, 0);
785 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 785 rvh->DragTargetDragOver(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y),
786 WebKit::WebDragOperationEvery, 0); 786 WebKit::WebDragOperationEvery, 0);
787 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0); 787 rvh->DragTargetDrop(gfx::Point(end_x, end_y), gfx::Point(end_x, end_y), 0);
788 788
789 string16 actual_title = title_watcher.WaitAndGetTitle(); 789 string16 actual_title = title_watcher.WaitAndGetTitle();
790 EXPECT_EQ(expected_title, actual_title); 790 EXPECT_EQ(expected_title, actual_title);
791 } 791 }
792 792
793 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) {
794 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
795 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
796
797 const string16 expected_title = ASCIIToUTF16("loadStop");
798 content::TitleWatcher title_watcher(
799 test_embedder()->web_contents(), expected_title);
800 // Renavigate the guest to |kHTMLForGuest|.
801 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
802 test_embedder()->web_contents()->GetRenderViewHost());
803 ExecuteSyncJSFunction(rvh, ASCIIToUTF16(
804 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
805
806 string16 actual_title = title_watcher.WaitAndGetTitle();
807 EXPECT_EQ(expected_title, actual_title);
808 }
809
810 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) {
811 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
812 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
813
814 //const string16 expected_prefix = ASCIIToUTF16("loadCommit:");
815 const string16 expected_title = ASCIIToUTF16(
816 StringPrintf("loadCommit:%s", kHTMLForGuest));
817 content::TitleWatcher title_watcher(
818 test_embedder()->web_contents(), expected_title);
819 // Renavigate the guest to |kHTMLForGuest|.
820 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
821 test_embedder()->web_contents()->GetRenderViewHost());
822 ExecuteSyncJSFunction(rvh, ASCIIToUTF16(
823 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
824
825 string16 actual_title = title_watcher.WaitAndGetTitle();
826 EXPECT_EQ(expected_title, actual_title);
827 base::Value* isTopLevel = rvh->ExecuteJavascriptAndGetValue(
Fady Samuel 2012/10/16 01:40:00 Please make sure to hold this value in a scoped_pt
irobert 2012/10/16 20:10:09 Done.
828 string16(), ASCIIToUTF16("commitIsTopLevel"));
829 bool t;
830 EXPECT_TRUE(isTopLevel->GetAsBoolean(&t));
831 EXPECT_EQ(true, t);
832 }
833
793 } // namespace content 834 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698