| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/bind.h" |
| 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/message_loop.h" |
| 8 #include "base/path_service.h" |
| 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/google/google_util.h" |
| 12 #include "chrome/browser/io_thread.h" |
| 13 #include "chrome/browser/net/dns_probe_test_util.h" |
| 14 #include "chrome/browser/net/net_error_tab_helper.h" |
| 15 #include "chrome/browser/net/url_request_mock_util.h" |
| 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/net/net_error_info.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/web_contents.h" |
| 24 #include "content/public/test/browser_test_utils.h" |
| 25 #include "content/test/net/url_request_failed_job.h" |
| 26 #include "content/test/net/url_request_mock_http_job.h" |
| 27 #include "net/base/net_errors.h" |
| 28 #include "net/dns/dns_test_util.h" |
| 29 #include "net/url_request/url_request_filter.h" |
| 30 #include "net/url_request/url_request_job.h" |
| 31 #include "net/url_request/url_request_job_factory.h" |
| 32 |
| 33 using base::Bind; |
| 34 using base::Callback; |
| 35 using base::Closure; |
| 36 using base::ConstRef; |
| 37 using base::FilePath; |
| 38 using base::MessageLoop; |
| 39 using base::Unretained; |
| 40 using chrome_common_net::DnsProbeStatus; |
| 41 using content::BrowserThread; |
| 42 using content::URLRequestFailedJob; |
| 43 using content::URLRequestMockHTTPJob; |
| 44 using content::WebContents; |
| 45 using google_util::LinkDoctorBaseURL; |
| 46 using net::MockDnsClientRule; |
| 47 using net::NetworkDelegate; |
| 48 using net::URLRequest; |
| 49 using net::URLRequestFilter; |
| 50 using net::URLRequestJob; |
| 51 using net::URLRequestJobFactory; |
| 52 using ui_test_utils::NavigateToURL; |
| 53 using ui_test_utils::NavigateToURLBlockUntilNavigationsComplete; |
| 54 |
| 55 namespace chrome_browser_net { |
| 56 |
| 57 namespace { |
| 58 |
| 59 class DelayingDnsProbeService : public DnsProbeService { |
| 60 public: |
| 61 DelayingDnsProbeService() : DnsProbeService() {} |
| 62 |
| 63 virtual void ProbeDns(const ProbeCallback& callback) OVERRIDE { |
| 64 DnsProbeService::ProbeDns(Bind( |
| 65 &DelayingDnsProbeService::WouldCallCallback, |
| 66 Unretained(this), |
| 67 callback)); |
| 68 } |
| 69 |
| 70 void WouldCallCallback(const ProbeCallback& callback, |
| 71 DnsProbeStatus result) { |
| 72 delayed_callbacks_.push_back(Bind(callback, result)); |
| 73 } |
| 74 |
| 75 void CallDelayedCallbacks() { |
| 76 std::vector<Closure> callbacks; |
| 77 callbacks.swap(delayed_callbacks_); |
| 78 |
| 79 for (std::vector<Closure>::const_iterator i = callbacks.begin(); |
| 80 i != callbacks.end(); ++i) { |
| 81 i->Run(); |
| 82 } |
| 83 } |
| 84 |
| 85 int delayed_callback_count() const { return delayed_callbacks_.size(); } |
| 86 |
| 87 private: |
| 88 std::vector<Closure> delayed_callbacks_; |
| 89 }; |
| 90 |
| 91 FilePath GetMockLinkDoctorFilePath() { |
| 92 FilePath root_http; |
| 93 PathService::Get(chrome::DIR_TEST_DATA, &root_http); |
| 94 return root_http.AppendASCII("mock-link-doctor.html"); |
| 95 } |
| 96 |
| 97 class BrokenLinkDoctorProtocolHandler |
| 98 : public URLRequestJobFactory::ProtocolHandler { |
| 99 public: |
| 100 explicit BrokenLinkDoctorProtocolHandler( |
| 101 const FilePath& mock_link_doctor_file_path) |
| 102 : mock_link_doctor_file_path_(mock_link_doctor_file_path), |
| 103 net_error_(net::OK) {} |
| 104 |
| 105 virtual ~BrokenLinkDoctorProtocolHandler() {} |
| 106 |
| 107 virtual URLRequestJob* MaybeCreateJob( |
| 108 URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE { |
| 109 if (net_error_ != net::OK) { |
| 110 return new URLRequestFailedJob(request, network_delegate, net_error_); |
| 111 } else { |
| 112 return new URLRequestMockHTTPJob( |
| 113 request, network_delegate, mock_link_doctor_file_path_); |
| 114 } |
| 115 } |
| 116 |
| 117 void set_net_error(int net_error) { net_error_ = net_error; } |
| 118 |
| 119 private: |
| 120 const FilePath mock_link_doctor_file_path_; |
| 121 int net_error_; |
| 122 }; |
| 123 |
| 124 class DnsProbeBrowserTestIOThreadHelper { |
| 125 public: |
| 126 DnsProbeBrowserTestIOThreadHelper(); |
| 127 |
| 128 void SetUpOnIOThread(IOThread* io_thread); |
| 129 void CleanUpOnIOThreadAndDeleteHelper(); |
| 130 |
| 131 void SetMockDnsClientRules(MockDnsClientRule::Result system_good_result, |
| 132 MockDnsClientRule::Result public_good_result); |
| 133 void SetLinkDoctorNetError(int link_doctor_net_error); |
| 134 void CallDelayedProbeCallbacks(int expected_delayed_callback_count); |
| 135 |
| 136 private: |
| 137 IOThread* io_thread_; |
| 138 DnsProbeService* original_dns_probe_service_; |
| 139 DelayingDnsProbeService* delaying_dns_probe_service_; |
| 140 BrokenLinkDoctorProtocolHandler* protocol_handler_; |
| 141 FilePath mock_link_doctor_file_path_; |
| 142 }; |
| 143 |
| 144 DnsProbeBrowserTestIOThreadHelper::DnsProbeBrowserTestIOThreadHelper() |
| 145 : io_thread_(NULL), |
| 146 original_dns_probe_service_(NULL), |
| 147 delaying_dns_probe_service_(NULL), |
| 148 protocol_handler_(NULL), |
| 149 mock_link_doctor_file_path_(GetMockLinkDoctorFilePath()) {} |
| 150 |
| 151 void DnsProbeBrowserTestIOThreadHelper::SetUpOnIOThread(IOThread* io_thread) { |
| 152 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 153 CHECK(io_thread); |
| 154 CHECK(!io_thread_); |
| 155 CHECK(!original_dns_probe_service_); |
| 156 CHECK(!delaying_dns_probe_service_); |
| 157 CHECK(!protocol_handler_); |
| 158 |
| 159 io_thread_ = io_thread; |
| 160 |
| 161 delaying_dns_probe_service_ = new DelayingDnsProbeService(); |
| 162 |
| 163 IOThread::Globals* globals = io_thread_->globals(); |
| 164 original_dns_probe_service_ = globals->dns_probe_service.release(); |
| 165 globals->dns_probe_service.reset(delaying_dns_probe_service_); |
| 166 |
| 167 URLRequestFailedJob::AddUrlHandler(); |
| 168 |
| 169 scoped_ptr<URLRequestJobFactory::ProtocolHandler> protocol_handler( |
| 170 new BrokenLinkDoctorProtocolHandler(mock_link_doctor_file_path_)); |
| 171 protocol_handler_ = |
| 172 static_cast<BrokenLinkDoctorProtocolHandler*>(protocol_handler.get()); |
| 173 const GURL link_doctor_base_url = LinkDoctorBaseURL(); |
| 174 const std::string link_doctor_host = link_doctor_base_url.host(); |
| 175 URLRequestFilter::GetInstance()->AddHostnameProtocolHandler( |
| 176 "http", link_doctor_host, protocol_handler.Pass()); |
| 177 |
| 178 } |
| 179 |
| 180 void DnsProbeBrowserTestIOThreadHelper::CleanUpOnIOThreadAndDeleteHelper() { |
| 181 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 182 |
| 183 URLRequestFilter::GetInstance()->ClearHandlers(); |
| 184 |
| 185 DnsProbeService* delaying_dns_probe_service; |
| 186 |
| 187 IOThread::Globals* globals = io_thread_->globals(); |
| 188 delaying_dns_probe_service = globals->dns_probe_service.release(); |
| 189 globals->dns_probe_service.reset(original_dns_probe_service_); |
| 190 |
| 191 CHECK_EQ(delaying_dns_probe_service_, delaying_dns_probe_service); |
| 192 delete delaying_dns_probe_service_; |
| 193 |
| 194 delete this; |
| 195 } |
| 196 |
| 197 void DnsProbeBrowserTestIOThreadHelper::SetMockDnsClientRules( |
| 198 MockDnsClientRule::Result system_result, |
| 199 MockDnsClientRule::Result public_result) { |
| 200 DnsProbeService* service = io_thread_->globals()->dns_probe_service.get(); |
| 201 service->SetSystemClientForTesting( |
| 202 CreateMockDnsClientForProbes(system_result)); |
| 203 service->SetPublicClientForTesting( |
| 204 CreateMockDnsClientForProbes(public_result)); |
| 205 } |
| 206 |
| 207 void DnsProbeBrowserTestIOThreadHelper::SetLinkDoctorNetError( |
| 208 int link_doctor_net_error) { |
| 209 protocol_handler_->set_net_error(link_doctor_net_error); |
| 210 } |
| 211 |
| 212 void DnsProbeBrowserTestIOThreadHelper::CallDelayedProbeCallbacks( |
| 213 int expected_delayed_callback_count) { |
| 214 CHECK(delaying_dns_probe_service_); |
| 215 |
| 216 if (expected_delayed_callback_count >= 0) { |
| 217 int actual_delayed_callback_count = |
| 218 delaying_dns_probe_service_->delayed_callback_count(); |
| 219 EXPECT_EQ(expected_delayed_callback_count, actual_delayed_callback_count); |
| 220 } |
| 221 |
| 222 delaying_dns_probe_service_->CallDelayedCallbacks(); |
| 223 } |
| 224 |
| 225 class DnsProbeBrowserTest : public InProcessBrowserTest { |
| 226 public: |
| 227 DnsProbeBrowserTest(); |
| 228 |
| 229 virtual void SetUpOnMainThread() OVERRIDE; |
| 230 virtual void CleanUpOnMainThread() OVERRIDE; |
| 231 |
| 232 protected: |
| 233 void SetLinkDoctorBroken(bool broken); |
| 234 void SetMockDnsClientRules(MockDnsClientRule::Result system_result, |
| 235 MockDnsClientRule::Result public_result); |
| 236 void NavigateToDnsError(); |
| 237 void NavigateToOtherError(); |
| 238 |
| 239 void CallDelayedProbeCallbacks(int expected_delayed_callback_count); |
| 240 DnsProbeStatus WaitForSentStatus(); |
| 241 int dns_probe_status_count() const { return dns_probe_status_count_; } |
| 242 |
| 243 bool TitleIs(const std::string& expected); |
| 244 bool PageContains(const std::string& expected); |
| 245 |
| 246 private: |
| 247 void OnDnsProbeStatusSent(DnsProbeStatus dns_probe_status); |
| 248 |
| 249 DnsProbeBrowserTestIOThreadHelper* helper_; |
| 250 |
| 251 bool awaiting_dns_probe_status_; |
| 252 int dns_probe_status_count_; |
| 253 std::list<DnsProbeStatus> dns_probe_statuses_; |
| 254 }; |
| 255 |
| 256 DnsProbeBrowserTest::DnsProbeBrowserTest() |
| 257 : helper_(new DnsProbeBrowserTestIOThreadHelper()), |
| 258 awaiting_dns_probe_status_(false), |
| 259 dns_probe_status_count_(0) { |
| 260 } |
| 261 |
| 262 void DnsProbeBrowserTest::SetUpOnMainThread() { |
| 263 NetErrorTabHelper::set_state_for_testing( |
| 264 NetErrorTabHelper::TESTING_FORCE_ENABLED); |
| 265 |
| 266 CHECK(helper_); |
| 267 BrowserThread::PostTask( |
| 268 BrowserThread::IO, FROM_HERE, |
| 269 Bind(&DnsProbeBrowserTestIOThreadHelper::SetUpOnIOThread, |
| 270 Unretained(helper_), |
| 271 g_browser_process->io_thread())); |
| 272 |
| 273 NetErrorTabHelper* tab_helper = NetErrorTabHelper::FromWebContents( |
| 274 browser()->tab_strip_model()->GetActiveWebContents()); |
| 275 tab_helper->set_dns_probe_status_snoop_callback_for_testing(Bind( |
| 276 &DnsProbeBrowserTest::OnDnsProbeStatusSent, |
| 277 Unretained(this))); |
| 278 } |
| 279 |
| 280 void DnsProbeBrowserTest::CleanUpOnMainThread() { |
| 281 CHECK(helper_); |
| 282 BrowserThread::PostTask( |
| 283 BrowserThread::IO, FROM_HERE, |
| 284 Bind(&DnsProbeBrowserTestIOThreadHelper::CleanUpOnIOThreadAndDeleteHelper, |
| 285 Unretained(helper_))); |
| 286 |
| 287 NetErrorTabHelper::set_state_for_testing( |
| 288 NetErrorTabHelper::TESTING_DEFAULT); |
| 289 } |
| 290 |
| 291 void DnsProbeBrowserTest::SetLinkDoctorBroken(bool broken) { |
| 292 int net_error = broken ? net::ERR_NAME_NOT_RESOLVED : net::OK; |
| 293 |
| 294 BrowserThread::PostTask( |
| 295 BrowserThread::IO, FROM_HERE, |
| 296 Bind(&DnsProbeBrowserTestIOThreadHelper::SetLinkDoctorNetError, |
| 297 Unretained(helper_), |
| 298 net_error)); |
| 299 } |
| 300 |
| 301 // These two functions wait for two navigations because Link Doctor loads two |
| 302 // pages: a blank page, so the user stops seeing the previous page, and then |
| 303 // either the Link Doctor page or a regular error page. We want to wait for |
| 304 // the error page, so we wait for both loads to finish. |
| 305 |
| 306 void DnsProbeBrowserTest::NavigateToDnsError() { |
| 307 NavigateToURLBlockUntilNavigationsComplete( |
| 308 browser(), |
| 309 URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED), |
| 310 2); |
| 311 } |
| 312 |
| 313 void DnsProbeBrowserTest::NavigateToOtherError() { |
| 314 NavigateToURLBlockUntilNavigationsComplete( |
| 315 browser(), |
| 316 URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_REFUSED), |
| 317 2); |
| 318 } |
| 319 |
| 320 void DnsProbeBrowserTest::SetMockDnsClientRules( |
| 321 MockDnsClientRule::Result system_result, |
| 322 MockDnsClientRule::Result public_result) { |
| 323 BrowserThread::PostTask( |
| 324 BrowserThread::IO, FROM_HERE, |
| 325 Bind(&DnsProbeBrowserTestIOThreadHelper::SetMockDnsClientRules, |
| 326 Unretained(helper_), |
| 327 system_result, |
| 328 public_result)); |
| 329 } |
| 330 |
| 331 void DnsProbeBrowserTest::CallDelayedProbeCallbacks( |
| 332 int expected_delayed_callback_count) { |
| 333 BrowserThread::PostTask( |
| 334 BrowserThread::IO, FROM_HERE, |
| 335 Bind(&DnsProbeBrowserTestIOThreadHelper::CallDelayedProbeCallbacks, |
| 336 Unretained(helper_), |
| 337 expected_delayed_callback_count)); |
| 338 } |
| 339 |
| 340 DnsProbeStatus DnsProbeBrowserTest::WaitForSentStatus() { |
| 341 CHECK(!awaiting_dns_probe_status_); |
| 342 while (dns_probe_statuses_.empty()) { |
| 343 awaiting_dns_probe_status_ = true; |
| 344 MessageLoop::current()->Run(); |
| 345 awaiting_dns_probe_status_ = false; |
| 346 } |
| 347 |
| 348 CHECK(!dns_probe_statuses_.empty()); |
| 349 DnsProbeStatus status = dns_probe_statuses_.front(); |
| 350 dns_probe_statuses_.pop_front(); |
| 351 return status; |
| 352 } |
| 353 |
| 354 // Check title by roundtripping to renderer, to make sure any probe results |
| 355 // sent before this have been applied. |
| 356 bool DnsProbeBrowserTest::TitleIs(const std::string& expected) { |
| 357 std::string title; |
| 358 |
| 359 WebContents* contents = |
| 360 browser()->tab_strip_model()->GetActiveWebContents(); |
| 361 |
| 362 bool rv = content::ExecuteScriptAndExtractString( |
| 363 contents, |
| 364 "domAutomationController.send(document.title);", |
| 365 &title); |
| 366 if (!rv) |
| 367 return false; |
| 368 |
| 369 return title == expected; |
| 370 } |
| 371 |
| 372 // Check text by roundtripping to renderer, to make sure any probe results |
| 373 // sent before this have been applied. |
| 374 bool DnsProbeBrowserTest::PageContains(const std::string& expected) { |
| 375 std::string text_content; |
| 376 |
| 377 bool rv = content::ExecuteScriptAndExtractString( |
| 378 browser()->tab_strip_model()->GetActiveWebContents(), |
| 379 "domAutomationController.send(document.body.textContent);", |
| 380 &text_content); |
| 381 if (!rv) |
| 382 return false; |
| 383 |
| 384 return text_content.find(expected) != std::string::npos; |
| 385 } |
| 386 |
| 387 void DnsProbeBrowserTest::OnDnsProbeStatusSent( |
| 388 DnsProbeStatus dns_probe_status) { |
| 389 dns_probe_statuses_.push_back(dns_probe_status); |
| 390 |
| 391 dns_probe_status_count_++; |
| 392 if (awaiting_dns_probe_status_) |
| 393 MessageLoop::current()->Quit(); |
| 394 } |
| 395 |
| 396 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, OtherErrorWithLinkDoctor) { |
| 397 SetLinkDoctorBroken(false); |
| 398 |
| 399 NavigateToOtherError(); |
| 400 EXPECT_TRUE(TitleIs("Mock Link Doctor")); |
| 401 |
| 402 EXPECT_EQ(0, dns_probe_status_count()); |
| 403 } |
| 404 |
| 405 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, OtherErrorWithoutLinkDoctor) { |
| 406 SetLinkDoctorBroken(true); |
| 407 |
| 408 NavigateToOtherError(); |
| 409 EXPECT_TRUE(PageContains("CONNECTION_REFUSED")); |
| 410 |
| 411 EXPECT_EQ(0, dns_probe_status_count()); |
| 412 } |
| 413 |
| 414 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, NxdomainWithLinkDoctor) { |
| 415 SetLinkDoctorBroken(false); |
| 416 SetMockDnsClientRules(MockDnsClientRule::OK, MockDnsClientRule::OK); |
| 417 |
| 418 NavigateToDnsError(); |
| 419 EXPECT_TRUE(TitleIs("Mock Link Doctor")); |
| 420 } |
| 421 |
| 422 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, NoInternetWithoutLinkDoctor) { |
| 423 SetLinkDoctorBroken(true); |
| 424 SetMockDnsClientRules(MockDnsClientRule::TIMEOUT, |
| 425 MockDnsClientRule::TIMEOUT); |
| 426 |
| 427 NavigateToDnsError(); |
| 428 |
| 429 EXPECT_EQ(chrome_common_net::DNS_PROBE_STARTED, WaitForSentStatus()); |
| 430 EXPECT_EQ(chrome_common_net::DNS_PROBE_STARTED, WaitForSentStatus()); |
| 431 |
| 432 // PageContains runs the RunLoop, so make sure nothing hairy happens. |
| 433 EXPECT_EQ(2, dns_probe_status_count()); |
| 434 EXPECT_TRUE(PageContains("DNS_PROBE_STARTED")); |
| 435 EXPECT_EQ(2, dns_probe_status_count()); |
| 436 |
| 437 CallDelayedProbeCallbacks(1); |
| 438 |
| 439 EXPECT_EQ(chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET, |
| 440 WaitForSentStatus()); |
| 441 |
| 442 // PageContains runs the RunLoop, so make sure nothing hairy happens. |
| 443 EXPECT_EQ(3, dns_probe_status_count()); |
| 444 EXPECT_TRUE(PageContains("DNS_PROBE_FINISHED_NO_INTERNET")); |
| 445 EXPECT_EQ(3, dns_probe_status_count()); |
| 446 } |
| 447 |
| 448 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, SyncFailureWithoutLinkDoctor) { |
| 449 SetLinkDoctorBroken(true); |
| 450 SetMockDnsClientRules(MockDnsClientRule::FAIL_SYNC, |
| 451 MockDnsClientRule::FAIL_SYNC); |
| 452 |
| 453 NavigateToDnsError(); |
| 454 |
| 455 EXPECT_EQ(chrome_common_net::DNS_PROBE_STARTED, WaitForSentStatus()); |
| 456 EXPECT_EQ(chrome_common_net::DNS_PROBE_STARTED, WaitForSentStatus()); |
| 457 |
| 458 // PageContains runs the RunLoop, so make sure nothing hairy happens. |
| 459 EXPECT_EQ(2, dns_probe_status_count()); |
| 460 EXPECT_TRUE(PageContains("DNS_PROBE_STARTED")); |
| 461 EXPECT_EQ(2, dns_probe_status_count()); |
| 462 |
| 463 CallDelayedProbeCallbacks(1); |
| 464 |
| 465 EXPECT_EQ(chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN, |
| 466 WaitForSentStatus()); |
| 467 |
| 468 // PageContains runs the RunLoop, so make sure nothing hairy happens. |
| 469 EXPECT_EQ(3, dns_probe_status_count()); |
| 470 EXPECT_TRUE(PageContains("NAME_NOT_RESOLVED")); |
| 471 EXPECT_EQ(3, dns_probe_status_count()); |
| 472 } |
| 473 |
| 474 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, NoProbeInSubframe) { |
| 475 SetLinkDoctorBroken(false); |
| 476 |
| 477 const FilePath::CharType kIframeDnsErrorHtmlName[] = |
| 478 FILE_PATH_LITERAL("iframe_dns_error.html"); |
| 479 |
| 480 NavigateToURL( |
| 481 browser(), |
| 482 URLRequestMockHTTPJob::GetMockUrl(FilePath(kIframeDnsErrorHtmlName))); |
| 483 |
| 484 // By the time NavigateToURL returns, the browser will have seen the failed |
| 485 // provisional load. If a probe was started (or considered but not run), |
| 486 // then the NetErrorTabHelper would have sent a NetErrorInfo message. Thus, |
| 487 // if one hasn't been sent by now, the NetErrorTabHelper has not (and won't) |
| 488 // start a probe for this DNS error. |
| 489 EXPECT_EQ(0, dns_probe_status_count()); |
| 490 } |
| 491 |
| 492 IN_PROC_BROWSER_TEST_F(DnsProbeBrowserTest, ProbesDisabled) { |
| 493 NetErrorTabHelper::set_state_for_testing( |
| 494 NetErrorTabHelper::TESTING_FORCE_DISABLED); |
| 495 |
| 496 SetLinkDoctorBroken(true); |
| 497 SetMockDnsClientRules(MockDnsClientRule::TIMEOUT, |
| 498 MockDnsClientRule::TIMEOUT); |
| 499 |
| 500 NavigateToDnsError(); |
| 501 |
| 502 EXPECT_EQ(chrome_common_net::DNS_PROBE_NOT_RUN, WaitForSentStatus()); |
| 503 EXPECT_EQ(chrome_common_net::DNS_PROBE_NOT_RUN, WaitForSentStatus()); |
| 504 |
| 505 // PageContains runs the RunLoop, so make sure nothing hairy happens. |
| 506 EXPECT_EQ(2, dns_probe_status_count()); |
| 507 EXPECT_TRUE(PageContains("NAME_NOT_RESOLVED")); |
| 508 EXPECT_EQ(2, dns_probe_status_count()); |
| 509 } |
| 510 |
| 511 } // namespace |
| 512 |
| 513 } // namespace chrome_browser_net |
| OLD | NEW |