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 "chrome/browser/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/api/prefs/pref_member.h" | 10 #include "chrome/browser/api/prefs/pref_member.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 ChromeNetworkDelegate::g_never_throttle_requests_ = false; | 24 ChromeNetworkDelegate::g_never_throttle_requests_ = false; |
25 } | 25 } |
26 | 26 |
27 virtual void TearDown() OVERRIDE { | 27 virtual void TearDown() OVERRIDE { |
28 ChromeNetworkDelegate::g_never_throttle_requests_ = | 28 ChromeNetworkDelegate::g_never_throttle_requests_ = |
29 never_throttle_requests_original_value_; | 29 never_throttle_requests_original_value_; |
30 } | 30 } |
31 | 31 |
32 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { | 32 scoped_ptr<ChromeNetworkDelegate> CreateNetworkDelegate() { |
33 return scoped_ptr<ChromeNetworkDelegate>(new ChromeNetworkDelegate( | 33 return scoped_ptr<ChromeNetworkDelegate>(new ChromeNetworkDelegate( |
34 forwarder_.get(), NULL, NULL, NULL, NULL, NULL, &pref_member_, NULL)); | 34 forwarder_.get(), NULL, NULL, NULL, NULL, NULL, &pref_member_, NULL, |
| 35 NULL)); |
35 } | 36 } |
36 | 37 |
37 // Implementation moved here for access to private bits. | 38 // Implementation moved here for access to private bits. |
38 void NeverThrottleLogicImpl() { | 39 void NeverThrottleLogicImpl() { |
39 scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate()); | 40 scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate()); |
40 | 41 |
41 TestURLRequestContext context; | 42 TestURLRequestContext context; |
42 TestURLRequest extension_request( | 43 TestURLRequest extension_request( |
43 GURL("http://example.com/"), NULL, &context); | 44 GURL("http://example.com/"), NULL, &context); |
44 extension_request.set_first_party_for_cookies( | 45 extension_request.set_first_party_for_cookies( |
(...skipping 27 matching lines...) Expand all Loading... |
72 bool never_throttle_requests_original_value_; | 73 bool never_throttle_requests_original_value_; |
73 MessageLoopForIO message_loop_; | 74 MessageLoopForIO message_loop_; |
74 | 75 |
75 scoped_refptr<extensions::EventRouterForwarder> forwarder_; | 76 scoped_refptr<extensions::EventRouterForwarder> forwarder_; |
76 BooleanPrefMember pref_member_; | 77 BooleanPrefMember pref_member_; |
77 }; | 78 }; |
78 | 79 |
79 TEST_F(ChromeNetworkDelegateTest, NeverThrottleLogic) { | 80 TEST_F(ChromeNetworkDelegateTest, NeverThrottleLogic) { |
80 NeverThrottleLogicImpl(); | 81 NeverThrottleLogicImpl(); |
81 } | 82 } |
OLD | NEW |