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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 virtual bool OnCanSetCookie(const URLRequest& request, | 70 virtual bool OnCanSetCookie(const URLRequest& request, |
71 const std::string& cookie_line, | 71 const std::string& cookie_line, |
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 int OnBeforeSocketStreamConnect( |
| 80 SocketStream* stream, |
| 81 const CompletionCallback& callback) OVERRIDE { |
| 82 return OK; |
| 83 } |
79 | 84 |
80 bool got_pac_error_; | 85 bool got_pac_error_; |
81 }; | 86 }; |
82 | 87 |
83 } // namespace | 88 } // namespace |
84 | 89 |
85 // Check that the OnPACScriptError method can be called from an arbitrary | 90 // Check that the OnPACScriptError method can be called from an arbitrary |
86 // thread. | 91 // thread. |
87 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { | 92 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { |
88 base::Thread thread("test_thread"); | 93 base::Thread thread("test_thread"); |
(...skipping 20 matching lines...) Expand all Loading... |
109 thread.message_loop()->PostTask( | 114 thread.message_loop()->PostTask( |
110 FROM_HERE, | 115 FROM_HERE, |
111 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, | 116 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, |
112 base::Unretained(&observer), 42, string16())); | 117 base::Unretained(&observer), 42, string16())); |
113 thread.Stop(); | 118 thread.Stop(); |
114 MessageLoop::current()->RunAllPending(); | 119 MessageLoop::current()->RunAllPending(); |
115 // Shouldn't have crashed until here... | 120 // Shouldn't have crashed until here... |
116 } | 121 } |
117 | 122 |
118 } // namespace net | 123 } // namespace net |
OLD | NEW |