Chromium Code Reviews| 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); |
|
Sam McNally
2016/09/09 06:08:12
I don't think the explicit cast is necessary.
Ken Rockot(use gerrit already)
2016/09/09 17:22:27
Done
|
| + } |
| + |
| 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()); |
| } |
| } |