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

Unified Diff: chrome/browser/net/net_error_tab_helper_unittest.cc

Issue 2310583002: Convert some NetError[Tab]Helper messages to mojom (Closed)
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « chrome/browser/net/net_error_tab_helper.cc ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/net_error_tab_helper_unittest.cc
diff --git a/chrome/browser/net/net_error_tab_helper_unittest.cc b/chrome/browser/net/net_error_tab_helper_unittest.cc
index 579212ad768bf6c5db71d35a440edb31a375c911..1f20962dc440fbca16a2ce896a05f419c0aff311 100644
--- a/chrome/browser/net/net_error_tab_helper_unittest.cc
+++ b/chrome/browser/net/net_error_tab_helper_unittest.cc
@@ -43,6 +43,13 @@ class TestNetErrorTabHelper : public NetErrorTabHelper {
return times_diagnostics_dialog_invoked_;
}
+ void SetCurrentTargetFrame(content::RenderFrameHost* render_frame_host) {
+ network_diagnostics_bindings_for_testing().SetCurrentTargetFrameForTesting(
+ render_frame_host);
+ }
+
+ mojom::NetworkDiagnostics* network_diagnostics_interface() { return this; }
+
private:
// NetErrorTabHelper implementation:
@@ -420,10 +427,9 @@ TEST_F(NetErrorTabHelperTest, CoalesceFailures) {
// Makes sure that URLs are sanitized before running the platform network
// diagnostics tool.
TEST_F(NetErrorTabHelperTest, SanitizeDiagnosticsUrl) {
- content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
- rfh->OnMessageReceived(ChromeViewHostMsg_RunNetworkDiagnostics(
- rfh->GetRoutingID(),
- GURL("http://foo:bar@somewhere:123/hats?for#goats")));
+ tab_helper()->SetCurrentTargetFrame(web_contents()->GetMainFrame());
+ tab_helper()->network_diagnostics_interface()->RunNetworkDiagnostics(
+ GURL("http://foo:bar@somewhere:123/hats?for#goats"));
EXPECT_EQ("http://somewhere:123/",
tab_helper()->network_diagnostics_url());
EXPECT_EQ(1, tab_helper()->times_diagnostics_dialog_invoked());
@@ -442,9 +448,9 @@ TEST_F(NetErrorTabHelperTest, NoDiagnosticsForNonHttpSchemes) {
};
for (const char* url : kUrls) {
- content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
- rfh->OnMessageReceived(ChromeViewHostMsg_RunNetworkDiagnostics(
- rfh->GetRoutingID(), GURL(url)));
+ tab_helper()->SetCurrentTargetFrame(web_contents()->GetMainFrame());
+ tab_helper()->network_diagnostics_interface()
+ ->RunNetworkDiagnostics(GURL(url));
EXPECT_EQ(0, tab_helper()->times_diagnostics_dialog_invoked());
}
}
« no previous file with comments | « chrome/browser/net/net_error_tab_helper.cc ('k') | chrome/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698