OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 base::ThreadTaskRunnerHandle::Get()->PostTask( | 575 base::ThreadTaskRunnerHandle::Get()->PostTask( |
576 FROM_HERE, | 576 FROM_HERE, |
577 base::Bind(&BlockingNetworkDelegate::RunAuthCallback, | 577 base::Bind(&BlockingNetworkDelegate::RunAuthCallback, |
578 weak_factory_.GetWeakPtr(), auth_retval_, callback)); | 578 weak_factory_.GetWeakPtr(), auth_retval_, callback)); |
579 return AUTH_REQUIRED_RESPONSE_IO_PENDING; | 579 return AUTH_REQUIRED_RESPONSE_IO_PENDING; |
580 | 580 |
581 case USER_CALLBACK: | 581 case USER_CALLBACK: |
582 auth_callback_ = callback; | 582 auth_callback_ = callback; |
583 stage_blocked_for_callback_ = ON_AUTH_REQUIRED; | 583 stage_blocked_for_callback_ = ON_AUTH_REQUIRED; |
584 base::ThreadTaskRunnerHandle::Get()->PostTask( | 584 base::ThreadTaskRunnerHandle::Get()->PostTask( |
585 FROM_HERE, base::MessageLoop::QuitClosure()); | 585 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
586 return AUTH_REQUIRED_RESPONSE_IO_PENDING; | 586 return AUTH_REQUIRED_RESPONSE_IO_PENDING; |
587 } | 587 } |
588 NOTREACHED(); | 588 NOTREACHED(); |
589 return AUTH_REQUIRED_RESPONSE_NO_ACTION; // Dummy value. | 589 return AUTH_REQUIRED_RESPONSE_NO_ACTION; // Dummy value. |
590 } | 590 } |
591 | 591 |
592 void BlockingNetworkDelegate::Reset() { | 592 void BlockingNetworkDelegate::Reset() { |
593 EXPECT_NE(NOT_BLOCKED, stage_blocked_for_callback_); | 593 EXPECT_NE(NOT_BLOCKED, stage_blocked_for_callback_); |
594 stage_blocked_for_callback_ = NOT_BLOCKED; | 594 stage_blocked_for_callback_ = NOT_BLOCKED; |
595 callback_.Reset(); | 595 callback_.Reset(); |
(...skipping 18 matching lines...) Expand all Loading... |
614 case AUTO_CALLBACK: | 614 case AUTO_CALLBACK: |
615 base::ThreadTaskRunnerHandle::Get()->PostTask( | 615 base::ThreadTaskRunnerHandle::Get()->PostTask( |
616 FROM_HERE, base::Bind(&BlockingNetworkDelegate::RunCallback, | 616 FROM_HERE, base::Bind(&BlockingNetworkDelegate::RunCallback, |
617 weak_factory_.GetWeakPtr(), retval_, callback)); | 617 weak_factory_.GetWeakPtr(), retval_, callback)); |
618 return ERR_IO_PENDING; | 618 return ERR_IO_PENDING; |
619 | 619 |
620 case USER_CALLBACK: | 620 case USER_CALLBACK: |
621 callback_ = callback; | 621 callback_ = callback; |
622 stage_blocked_for_callback_ = stage; | 622 stage_blocked_for_callback_ = stage; |
623 base::ThreadTaskRunnerHandle::Get()->PostTask( | 623 base::ThreadTaskRunnerHandle::Get()->PostTask( |
624 FROM_HERE, base::MessageLoop::QuitClosure()); | 624 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
625 return ERR_IO_PENDING; | 625 return ERR_IO_PENDING; |
626 } | 626 } |
627 NOTREACHED(); | 627 NOTREACHED(); |
628 return 0; | 628 return 0; |
629 } | 629 } |
630 | 630 |
631 class TestURLRequestContextWithProxy : public TestURLRequestContext { | 631 class TestURLRequestContextWithProxy : public TestURLRequestContext { |
632 public: | 632 public: |
633 // Does not own |delegate|. | 633 // Does not own |delegate|. |
634 TestURLRequestContextWithProxy(const std::string& proxy, | 634 TestURLRequestContextWithProxy(const std::string& proxy, |
(...skipping 7325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7960 | 7960 |
7961 namespace { | 7961 namespace { |
7962 | 7962 |
7963 class SSLClientAuthTestDelegate : public TestDelegate { | 7963 class SSLClientAuthTestDelegate : public TestDelegate { |
7964 public: | 7964 public: |
7965 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { | 7965 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { |
7966 } | 7966 } |
7967 void OnCertificateRequested(URLRequest* request, | 7967 void OnCertificateRequested(URLRequest* request, |
7968 SSLCertRequestInfo* cert_request_info) override { | 7968 SSLCertRequestInfo* cert_request_info) override { |
7969 on_certificate_requested_count_++; | 7969 on_certificate_requested_count_++; |
7970 base::MessageLoop::current()->Quit(); | 7970 base::MessageLoop::current()->QuitWhenIdle(); |
7971 } | 7971 } |
7972 int on_certificate_requested_count() { | 7972 int on_certificate_requested_count() { |
7973 return on_certificate_requested_count_; | 7973 return on_certificate_requested_count_; |
7974 } | 7974 } |
7975 private: | 7975 private: |
7976 int on_certificate_requested_count_; | 7976 int on_certificate_requested_count_; |
7977 }; | 7977 }; |
7978 | 7978 |
7979 } // namespace | 7979 } // namespace |
7980 | 7980 |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9503 | 9503 |
9504 req->Start(); | 9504 req->Start(); |
9505 req->Cancel(); | 9505 req->Cancel(); |
9506 job->DetachRequest(); | 9506 job->DetachRequest(); |
9507 base::RunLoop().RunUntilIdle(); | 9507 base::RunLoop().RunUntilIdle(); |
9508 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 9508 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
9509 EXPECT_EQ(0, d.received_redirect_count()); | 9509 EXPECT_EQ(0, d.received_redirect_count()); |
9510 } | 9510 } |
9511 | 9511 |
9512 } // namespace net | 9512 } // namespace net |
OLD | NEW |