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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 CookieOptions* options) OVERRIDE { | 72 CookieOptions* options) OVERRIDE { |
73 return true; | 73 return true; |
74 } | 74 } |
75 virtual bool OnCanAccessFile(const net::URLRequest& request, | 75 virtual bool OnCanAccessFile(const net::URLRequest& request, |
76 const FilePath& path) const OVERRIDE { | 76 const FilePath& path) const OVERRIDE { |
77 return true; | 77 return true; |
78 } | 78 } |
79 virtual bool OnCanThrottleRequest(const URLRequest& request) const OVERRIDE { | 79 virtual bool OnCanThrottleRequest(const URLRequest& request) const OVERRIDE { |
80 return false; | 80 return false; |
81 } | 81 } |
| 82 virtual int OnBeforeSocketStreamConnect( |
| 83 SocketStream* stream, |
| 84 const CompletionCallback& callback) OVERRIDE { |
| 85 return OK; |
| 86 } |
82 | 87 |
83 bool got_pac_error_; | 88 bool got_pac_error_; |
84 }; | 89 }; |
85 | 90 |
86 } // namespace | 91 } // namespace |
87 | 92 |
88 // Check that the OnPACScriptError method can be called from an arbitrary | 93 // Check that the OnPACScriptError method can be called from an arbitrary |
89 // thread. | 94 // thread. |
90 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { | 95 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { |
91 base::Thread thread("test_thread"); | 96 base::Thread thread("test_thread"); |
(...skipping 20 matching lines...) Expand all Loading... |
112 thread.message_loop()->PostTask( | 117 thread.message_loop()->PostTask( |
113 FROM_HERE, | 118 FROM_HERE, |
114 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, | 119 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, |
115 base::Unretained(&observer), 42, string16())); | 120 base::Unretained(&observer), 42, string16())); |
116 thread.Stop(); | 121 thread.Stop(); |
117 MessageLoop::current()->RunAllPending(); | 122 MessageLoop::current()->RunAllPending(); |
118 // Shouldn't have crashed until here... | 123 // Shouldn't have crashed until here... |
119 } | 124 } |
120 | 125 |
121 } // namespace net | 126 } // namespace net |
OLD | NEW |