Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/base/network_delegate.h" | 10 #include "net/base/network_delegate.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 DISABLE_RUNNABLE_METHOD_REFCOUNT(net::NetworkDelegateErrorObserver); | 13 DISABLE_RUNNABLE_METHOD_REFCOUNT(net::NetworkDelegateErrorObserver); |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | |
| 18 class TestNetworkDelegate : public net::NetworkDelegate { | 19 class TestNetworkDelegate : public net::NetworkDelegate { |
| 19 public: | 20 public: |
| 20 TestNetworkDelegate() : got_pac_error_(false) {} | 21 TestNetworkDelegate() : got_pac_error_(false) {} |
| 21 virtual ~TestNetworkDelegate() {} | 22 virtual ~TestNetworkDelegate() {} |
| 22 | 23 |
| 23 bool got_pac_error() const { return got_pac_error_; } | 24 bool got_pac_error() const { return got_pac_error_; } |
| 24 | 25 |
| 25 private: | 26 private: |
| 26 // net::NetworkDelegate: | 27 // net::NetworkDelegate: |
| 27 virtual int OnBeforeURLRequest(URLRequest* request, | 28 virtual int OnBeforeURLRequest(URLRequest* request, |
| 28 CompletionCallback* callback, | 29 CompletionCallback* callback, |
| 29 GURL* new_url) { | 30 GURL* new_url) { |
| 30 return net::OK; | 31 return net::OK; |
| 31 } | 32 } |
| 32 virtual int OnBeforeSendHeaders(uint64 request_id, | 33 virtual int OnBeforeSendHeaders(uint64 request_id, |
| 33 CompletionCallback* callback, | 34 CompletionCallback* callback, |
| 34 HttpRequestHeaders* headers) { | 35 HttpRequestHeaders* headers) { |
| 35 return net::OK; | 36 return net::OK; |
| 36 } | 37 } |
| 37 virtual void OnRequestSent(uint64 request_id, | 38 virtual void OnRequestSent(uint64 request_id, |
| 38 const HostPortPair& socket_address, | 39 const HostPortPair& socket_address, |
| 39 const HttpRequestHeaders& headers) {} | 40 const HttpRequestHeaders& headers) {} |
| 40 virtual void OnBeforeRedirect(URLRequest* request, | 41 virtual void OnBeforeRedirect(URLRequest* request, |
| 41 const GURL& new_location) {} | 42 const GURL& new_location) {} |
| 42 virtual void OnResponseStarted(URLRequest* request) {} | 43 virtual void OnResponseStarted(URLRequest* request) {} |
| 44 virtual void OnBytesRead(const URLRequest& /* request */, | |
|
rvargas (doing something else)
2011/05/18 21:45:18
nit: I would follow the current style of not comme
willchan no longer on Chromium
2011/05/18 23:55:55
I'm going to fix the rest. The style guide explici
rvargas (doing something else)
2011/05/19 00:40:33
Sure, I know about the style guide, but that is no
willchan no longer on Chromium
2011/05/19 23:39:18
I think we've documented all our differences/quirk
rvargas (doing something else)
2011/05/20 00:37:31
I just don't see the reason for sometimes saying "
willchan no longer on Chromium
2011/05/20 01:08:40
OK, I think most of this seems to be your personal
rvargas (doing something else)
2011/05/20 02:50:00
I did a search under /chrome/ and I found very few
willchan no longer on Chromium
2011/05/20 22:57:38
Fair enough. I'll try to be consistent with existi
| |
| 45 int /* bytes_read */) {} | |
| 43 virtual void OnCompleted(URLRequest* request) {} | 46 virtual void OnCompleted(URLRequest* request) {} |
| 44 virtual void OnURLRequestDestroyed(URLRequest* request) {} | 47 virtual void OnURLRequestDestroyed(URLRequest* request) {} |
| 45 virtual void OnHttpTransactionDestroyed(uint64 request_id) {} | 48 virtual void OnHttpTransactionDestroyed(uint64 request_id) {} |
| 46 virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) { | 49 virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) { |
| 47 return NULL; | 50 return NULL; |
| 48 } | 51 } |
| 49 virtual void OnPACScriptError(int line_number, const string16& error) { | 52 virtual void OnPACScriptError(int line_number, const string16& error) { |
| 50 got_pac_error_ = true; | 53 got_pac_error_ = true; |
| 51 } | 54 } |
| 52 | 55 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 FROM_HERE, | 87 FROM_HERE, |
| 85 NewRunnableMethod(&observer, | 88 NewRunnableMethod(&observer, |
| 86 &NetworkDelegateErrorObserver::OnPACScriptError, | 89 &NetworkDelegateErrorObserver::OnPACScriptError, |
| 87 42, string16())); | 90 42, string16())); |
| 88 thread.Stop(); | 91 thread.Stop(); |
| 89 MessageLoop::current()->RunAllPending(); | 92 MessageLoop::current()->RunAllPending(); |
| 90 // Shouldn't have crashed until here... | 93 // Shouldn't have crashed until here... |
| 91 } | 94 } |
| 92 | 95 |
| 93 } // namespace net | 96 } // namespace net |
| OLD | NEW |