OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/browser/loader/resource_loader_delegate.h" | 9 #include "content/browser/loader/resource_loader_delegate.h" |
10 #include "content/public/browser/resource_request_info.h" | 10 #include "content/public/browser/resource_request_info.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 int call_count_; | 139 int call_count_; |
140 }; | 140 }; |
141 | 141 |
142 } // namespace | 142 } // namespace |
143 | 143 |
144 class ResourceLoaderTest : public testing::Test, | 144 class ResourceLoaderTest : public testing::Test, |
145 public ResourceLoaderDelegate { | 145 public ResourceLoaderDelegate { |
146 protected: | 146 protected: |
147 // testing::Test: | 147 // testing::Test: |
148 virtual void SetUp() OVERRIDE { | 148 virtual void SetUp() OVERRIDE { |
149 message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO)); | 149 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO)); |
150 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, | 150 ui_thread_.reset( |
151 message_loop_.get())); | 151 new BrowserThreadImpl(BrowserThread::UI, message_loop_.get())); |
152 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, | 152 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, |
153 message_loop_.get())); | 153 message_loop_.get())); |
154 } | 154 } |
155 | 155 |
156 // ResourceLoaderDelegate: | 156 // ResourceLoaderDelegate: |
157 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 157 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
158 ResourceLoader* loader, | 158 ResourceLoader* loader, |
159 net::AuthChallengeInfo* auth_info) OVERRIDE { | 159 net::AuthChallengeInfo* auth_info) OVERRIDE { |
160 return NULL; | 160 return NULL; |
161 } | 161 } |
(...skipping 10 matching lines...) Expand all Loading... |
172 virtual bool HandleExternalProtocol(ResourceLoader* loader, | 172 virtual bool HandleExternalProtocol(ResourceLoader* loader, |
173 const GURL& url) OVERRIDE { | 173 const GURL& url) OVERRIDE { |
174 return false; | 174 return false; |
175 } | 175 } |
176 virtual void DidStartRequest(ResourceLoader* loader) OVERRIDE {} | 176 virtual void DidStartRequest(ResourceLoader* loader) OVERRIDE {} |
177 virtual void DidReceiveRedirect(ResourceLoader* loader, | 177 virtual void DidReceiveRedirect(ResourceLoader* loader, |
178 const GURL& new_url) OVERRIDE {} | 178 const GURL& new_url) OVERRIDE {} |
179 virtual void DidReceiveResponse(ResourceLoader* loader) OVERRIDE {} | 179 virtual void DidReceiveResponse(ResourceLoader* loader) OVERRIDE {} |
180 virtual void DidFinishLoading(ResourceLoader* loader) OVERRIDE {} | 180 virtual void DidFinishLoading(ResourceLoader* loader) OVERRIDE {} |
181 | 181 |
182 scoped_ptr<MessageLoop> message_loop_; | 182 scoped_ptr<base::MessageLoop> message_loop_; |
183 scoped_ptr<BrowserThreadImpl> ui_thread_; | 183 scoped_ptr<BrowserThreadImpl> ui_thread_; |
184 scoped_ptr<BrowserThreadImpl> io_thread_; | 184 scoped_ptr<BrowserThreadImpl> io_thread_; |
185 | 185 |
186 content::MockResourceContext resource_context_; | 186 content::MockResourceContext resource_context_; |
187 }; | 187 }; |
188 | 188 |
189 // When OpenSSL is used, client cert store is not being queried in | 189 // When OpenSSL is used, client cert store is not being queried in |
190 // ResourceLoader. | 190 // ResourceLoader. |
191 #if !defined(USE_OPENSSL) | 191 #if !defined(USE_OPENSSL) |
192 // Verifies if a call to net::UrlRequest::Delegate::OnCertificateRequested() | 192 // Verifies if a call to net::UrlRequest::Delegate::OnCertificateRequested() |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 EXPECT_EQ(dummy_authority, raw_ptr_to_store->requested_authorities()); | 246 EXPECT_EQ(dummy_authority, raw_ptr_to_store->requested_authorities()); |
247 | 247 |
248 // Check if the retrieved certificates were passed to the content browser | 248 // Check if the retrieved certificates were passed to the content browser |
249 // client. | 249 // client. |
250 EXPECT_EQ(1, test_client.call_count()); | 250 EXPECT_EQ(1, test_client.call_count()); |
251 EXPECT_EQ(dummy_certs, test_client.passed_certs()); | 251 EXPECT_EQ(dummy_certs, test_client.passed_certs()); |
252 } | 252 } |
253 #endif // !defined(OPENSSL) | 253 #endif // !defined(OPENSSL) |
254 | 254 |
255 } // namespace content | 255 } // namespace content |
OLD | NEW |