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