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

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

Issue 17165004: <webview>: Partially migrate loadcommit event from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 7 years, 6 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
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/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 // Renavigate the guest to |kHTMLForGuest|. 1121 // Renavigate the guest to |kHTMLForGuest|.
1122 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 1122 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
1123 test_embedder()->web_contents()->GetRenderViewHost()); 1123 test_embedder()->web_contents()->GetRenderViewHost());
1124 ExecuteSyncJSFunction(rvh, 1124 ExecuteSyncJSFunction(rvh,
1125 base::StringPrintf("SetSrc('%s');", kHTMLForGuest)); 1125 base::StringPrintf("SetSrc('%s');", kHTMLForGuest));
1126 1126
1127 string16 actual_title = title_watcher.WaitAndGetTitle(); 1127 string16 actual_title = title_watcher.WaitAndGetTitle();
1128 EXPECT_EQ(expected_title, actual_title); 1128 EXPECT_EQ(expected_title, actual_title);
1129 } 1129 }
1130 1130
1131 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) {
1132 const char* kEmbedderURL = "/browser_plugin_embedder.html";
1133 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, std::string());
1134
1135 const string16 expected_title = ASCIIToUTF16(
1136 base::StringPrintf("loadCommit:%s", kHTMLForGuest));
1137 content::TitleWatcher title_watcher(
1138 test_embedder()->web_contents(), expected_title);
1139 // Renavigate the guest to |kHTMLForGuest|.
1140 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
1141 test_embedder()->web_contents()->GetRenderViewHost());
1142 ExecuteSyncJSFunction(rvh,
1143 base::StringPrintf("SetSrc('%s');", kHTMLForGuest));
1144
1145 string16 actual_title = title_watcher.WaitAndGetTitle();
1146 EXPECT_EQ(expected_title, actual_title);
1147 scoped_ptr<base::Value> is_top_level =
1148 content::ExecuteScriptAndGetValue(rvh, "commitIsTopLevel");
1149 bool top_level_bool = false;
1150 EXPECT_TRUE(is_top_level->GetAsBoolean(&top_level_bool));
1151 EXPECT_EQ(true, top_level_bool);
1152 }
1153
1154 // This test verifies that if a browser plugin is hidden before navigation, 1131 // This test verifies that if a browser plugin is hidden before navigation,
1155 // the guest starts off hidden. 1132 // the guest starts off hidden.
1156 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, HiddenBeforeNavigation) { 1133 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, HiddenBeforeNavigation) {
1157 const char* kEmbedderURL = "/browser_plugin_embedder.html"; 1134 const char* kEmbedderURL = "/browser_plugin_embedder.html";
1158 const std::string embedder_code = 1135 const std::string embedder_code =
1159 "document.getElementById('plugin').style.visibility = 'hidden'"; 1136 "document.getElementById('plugin').style.visibility = 'hidden'";
1160 StartBrowserPluginTest( 1137 StartBrowserPluginTest(
1161 kEmbedderURL, kHTMLForGuest, true, embedder_code); 1138 kEmbedderURL, kHTMLForGuest, true, embedder_code);
1162 EXPECT_FALSE(test_guest()->visible()); 1139 EXPECT_FALSE(test_guest()->visible());
1163 } 1140 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 // in the guest. 1447 // in the guest.
1471 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) { 1448 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) {
1472 const char* kEmbedderURL = "/browser_plugin_embedder.html"; 1449 const char* kEmbedderURL = "/browser_plugin_embedder.html";
1473 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); 1450 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string());
1474 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 1451 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
1475 test_guest()->web_contents()->GetRenderViewHost()); 1452 test_guest()->web_contents()->GetRenderViewHost());
1476 EXPECT_TRUE(rvh->input_method_active()); 1453 EXPECT_TRUE(rvh->input_method_active());
1477 } 1454 }
1478 1455
1479 } // namespace content 1456 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698