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

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc

Issue 2385363002: Pass the RenderProcessHost id on retargeting. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
index fac22e170844bcee11bdb95c1ac7d0340b184cb4..37116231477a413e65f14972aeafb4b9ab74fa1c 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -505,6 +505,7 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, FilteredTest) {
}
IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, UserAction) {
+ content::IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess());
ASSERT_TRUE(StartEmbeddedTestServer());
// Wait for the extension to set itself up and return control to us.
@@ -519,7 +520,8 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, UserAction) {
browser()->profile())->extension_service();
const extensions::Extension* extension =
service->GetExtensionById(last_loaded_extension_id(), false);
- GURL url = extension->GetResourceURL("a.html");
+ GURL url = extension->GetResourceURL(
+ "a.html?" + base::IntToString(embedded_test_server()->port()));
ui_test_utils::NavigateToURL(browser(), url);
@@ -530,7 +532,17 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, UserAction) {
params.page_url = url;
params.link_url = extension->GetResourceURL("b.html");
- TestRenderViewContextMenu menu(tab->GetMainFrame(), params);
+ std::vector<content::RenderFrameHost*> frames = tab->GetAllFrames();
+ content::RenderFrameHost* subframe = nullptr;
+ for (const auto& frame : frames) {
Charlie Reis 2016/10/03 22:15:23 This is a bit odd at first glance. Maybe clarify
nasko 2016/10/03 22:38:04 Done.
+ if (frame->GetParent()) {
+ subframe = frame;
+ break;
+ }
+ }
+ DCHECK(subframe);
+
+ TestRenderViewContextMenu menu(subframe, params);
menu.Init();
menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB, 0);

Powered by Google App Engine
This is Rietveld 408576698