| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const URLRequest* request, | 67 const URLRequest* request, |
| 68 const CookieList& cookie_list) OVERRIDE { | 68 const CookieList& cookie_list) OVERRIDE { |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 virtual bool CanSetCookie( | 71 virtual bool CanSetCookie( |
| 72 const URLRequest* request, | 72 const URLRequest* request, |
| 73 const std::string& cookie_line, | 73 const std::string& cookie_line, |
| 74 CookieOptions* options) OVERRIDE { | 74 CookieOptions* options) OVERRIDE { |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 virtual bool CanAccessFile(const net::URLRequest* request, |
| 78 const FilePath& path) OVERRIDE { |
| 79 return true; |
| 80 } |
| 77 | 81 |
| 78 bool got_pac_error_; | 82 bool got_pac_error_; |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 } // namespace | 85 } // namespace |
| 82 | 86 |
| 83 // Check that the OnPACScriptError method can be called from an arbitrary | 87 // Check that the OnPACScriptError method can be called from an arbitrary |
| 84 // thread. | 88 // thread. |
| 85 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { | 89 TEST(NetworkDelegateErrorObserverTest, CallOnThread) { |
| 86 base::Thread thread("test_thread"); | 90 base::Thread thread("test_thread"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 107 thread.message_loop()->PostTask( | 111 thread.message_loop()->PostTask( |
| 108 FROM_HERE, | 112 FROM_HERE, |
| 109 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, | 113 base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, |
| 110 base::Unretained(&observer), 42, string16())); | 114 base::Unretained(&observer), 42, string16())); |
| 111 thread.Stop(); | 115 thread.Stop(); |
| 112 MessageLoop::current()->RunAllPending(); | 116 MessageLoop::current()->RunAllPending(); |
| 113 // Shouldn't have crashed until here... | 117 // Shouldn't have crashed until here... |
| 114 } | 118 } |
| 115 | 119 |
| 116 } // namespace net | 120 } // namespace net |
| OLD | NEW |