| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/net/net_error_tab_helper.h" | 5 #include "chrome/browser/net/net_error_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "components/error_page/common/net_error_info.h" | 8 #include "components/error_page/common/net_error_info.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/test/test_renderer_host.h" | 10 #include "content/public/test/test_renderer_host.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 if (error_type == DNS_ERROR) | 93 if (error_type == DNS_ERROR) |
| 94 net_error = net::ERR_NAME_NOT_RESOLVED; | 94 net_error = net::ERR_NAME_NOT_RESOLVED; |
| 95 else | 95 else |
| 96 net_error = net::ERR_TIMED_OUT; | 96 net_error = net::ERR_TIMED_OUT; |
| 97 | 97 |
| 98 tab_helper_->DidFailProvisionalLoad( | 98 tab_helper_->DidFailProvisionalLoad( |
| 99 (main_frame == MAIN_FRAME) ? main_rfh() : subframe_, | 99 (main_frame == MAIN_FRAME) ? main_rfh() : subframe_, |
| 100 bogus_url_, // validated_url | 100 bogus_url_, // validated_url |
| 101 net_error, | 101 net_error, |
| 102 base::string16()); | 102 base::string16(), |
| 103 false); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void FinishProbe(DnsProbeStatus status) { tab_helper_->FinishProbe(status); } | 106 void FinishProbe(DnsProbeStatus status) { tab_helper_->FinishProbe(status); } |
| 106 | 107 |
| 107 bool probe_running() { return tab_helper_->mock_probe_running(); } | 108 bool probe_running() { return tab_helper_->mock_probe_running(); } |
| 108 DnsProbeStatus last_status_sent() { return tab_helper_->last_status_sent(); } | 109 DnsProbeStatus last_status_sent() { return tab_helper_->last_status_sent(); } |
| 109 int sent_count() { return tab_helper_->mock_sent_count(); } | 110 int sent_count() { return tab_helper_->mock_sent_count(); } |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 content::RenderFrameHost* subframe_; | 113 content::RenderFrameHost* subframe_; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 CommitProvisionalLoad(MAIN_FRAME); | 382 CommitProvisionalLoad(MAIN_FRAME); |
| 382 EXPECT_TRUE(probe_running()); | 383 EXPECT_TRUE(probe_running()); |
| 383 EXPECT_EQ(3, sent_count()); | 384 EXPECT_EQ(3, sent_count()); |
| 384 EXPECT_EQ(chrome_common_net::DNS_PROBE_STARTED, last_status_sent()); | 385 EXPECT_EQ(chrome_common_net::DNS_PROBE_STARTED, last_status_sent()); |
| 385 | 386 |
| 386 FinishProbe(chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN); | 387 FinishProbe(chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN); |
| 387 EXPECT_FALSE(probe_running()); | 388 EXPECT_FALSE(probe_running()); |
| 388 EXPECT_EQ(4, sent_count()); | 389 EXPECT_EQ(4, sent_count()); |
| 389 EXPECT_EQ(chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN, last_status_sent()); | 390 EXPECT_EQ(chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN, last_status_sent()); |
| 390 } | 391 } |
| OLD | NEW |