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

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

Issue 2310583002: Convert some NetError[Tab]Helper messages to mojom (Closed)
Patch Set: . 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
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..6d1930a4e95ae90a51ab33d3f1db0a52bf6548e6 100644
--- a/chrome/browser/net/net_error_tab_helper_unittest.cc
+++ b/chrome/browser/net/net_error_tab_helper_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/error_page/common/net_error_info.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/web_contents_interface_registry.h"
#include "content/public/test/test_renderer_host.h"
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -43,6 +44,10 @@ class TestNetErrorTabHelper : public NetErrorTabHelper {
return times_diagnostics_dialog_invoked_;
}
+ mojom::NetworkDiagnostics* network_diagnostics_interface() {
+ return static_cast<mojom::NetworkDiagnostics*>(this);
+ }
+
private:
// NetErrorTabHelper implementation:
@@ -420,10 +425,10 @@ 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")));
+ web_contents()->GetInterfaces()->SetCurrentTargetFrameForTesting(
+ 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 +447,10 @@ TEST_F(NetErrorTabHelperTest, NoDiagnosticsForNonHttpSchemes) {
};
for (const char* url : kUrls) {
- content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
- rfh->OnMessageReceived(ChromeViewHostMsg_RunNetworkDiagnostics(
- rfh->GetRoutingID(), GURL(url)));
+ web_contents()->GetInterfaces()->SetCurrentTargetFrameForTesting(
+ web_contents()->GetMainFrame());
+ tab_helper()->network_diagnostics_interface()
+ ->RunNetworkDiagnostics(GURL(url));
EXPECT_EQ(0, tab_helper()->times_diagnostics_dialog_invoked());
}
}

Powered by Google App Engine
This is Rietveld 408576698