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 "net/proxy/network_delegate_error_observer.h" | 5 #include "net/proxy/network_delegate_error_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const string16& error) OVERRIDE { | 56 const string16& error) OVERRIDE { |
57 got_pac_error_ = true; | 57 got_pac_error_ = true; |
58 } | 58 } |
59 virtual AuthRequiredResponse OnAuthRequired( | 59 virtual AuthRequiredResponse OnAuthRequired( |
60 URLRequest* request, | 60 URLRequest* request, |
61 const AuthChallengeInfo& auth_info, | 61 const AuthChallengeInfo& auth_info, |
62 const AuthCallback& callback, | 62 const AuthCallback& callback, |
63 AuthCredentials* credentials) OVERRIDE { | 63 AuthCredentials* credentials) OVERRIDE { |
64 return AUTH_REQUIRED_RESPONSE_NO_ACTION; | 64 return AUTH_REQUIRED_RESPONSE_NO_ACTION; |
65 } | 65 } |
| 66 virtual bool CanGetCookies( |
| 67 const URLRequest* request, |
| 68 const CookieList& cookie_list) OVERRIDE { |
| 69 return true; |
| 70 } |
| 71 virtual bool CanSetCookie( |
| 72 const URLRequest* request, |
| 73 const std::string& cookie_line, |
| 74 CookieOptions* options) OVERRIDE { |
| 75 return true; |
| 76 } |
66 | 77 |
67 bool got_pac_error_; | 78 bool got_pac_error_; |
68 }; | 79 }; |
69 | 80 |
70 } // namespace | 81 } // namespace |
71 | 82 |
72 // Check that the OnPACScriptError method can be called from an arbitrary | 83 // Check that the OnPACScriptError method can be called from an arbitrary |
73 // thread. | 84 // thread. |
74 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { | 85 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { |
75 base::Thread thread("test_thread"); | 86 base::Thread thread("test_thread"); |
(...skipping 20 matching lines...) Expand all Loading... |
96 thread.message_loop()->PostTask( | 107 thread.message_loop()->PostTask( |
97 FROM_HERE, | 108 FROM_HERE, |
98 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, | 109 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, |
99 base::Unretained(&observer), 42, string16())); | 110 base::Unretained(&observer), 42, string16())); |
100 thread.Stop(); | 111 thread.Stop(); |
101 MessageLoop::current()->RunAllPending(); | 112 MessageLoop::current()->RunAllPending(); |
102 // Shouldn't have crashed until here... | 113 // Shouldn't have crashed until here... |
103 } | 114 } |
104 | 115 |
105 } // namespace net | 116 } // namespace net |
OLD | NEW |