Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: components/cronet/android/url_request_context_adapter.h

Issue 1389213003: [Cronet] Use Https for Quic Test Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ryancl
Patch Set: Use mock verifier and fix tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "net/log/net_log.h" 18 #include "net/log/net_log.h"
19 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
20 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
21 21
22 namespace net { 22 namespace net {
23 class WriteToFileNetLogObserver; 23 class WriteToFileNetLogObserver;
24 class ProxyConfigService; 24 class ProxyConfigService;
25 class SdchOwner; 25 class SdchOwner;
26
27 #if defined(CRONET_TEST)
28 class MockCertVerifier;
29 class URLRequestContextBuilder;
30 #endif
31
26 } // namespace net 32 } // namespace net
27 33
28 namespace cronet { 34 namespace cronet {
29 35
30 struct URLRequestContextConfig; 36 struct URLRequestContextConfig;
31 typedef base::Callback<void(void)> RunAfterContextInitTask; 37 typedef base::Callback<void(void)> RunAfterContextInitTask;
32 38
33 // Implementation of the Chromium NetLog observer interface. 39 // Implementation of the Chromium NetLog observer interface.
34 class NetLogObserver : public net::NetLog::ThreadSafeObserver { 40 class NetLogObserver : public net::NetLog::ThreadSafeObserver {
35 public: 41 public:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Initializes |context_| on the Network thread. 98 // Initializes |context_| on the Network thread.
93 void InitRequestContextOnNetworkThread(); 99 void InitRequestContextOnNetworkThread();
94 100
95 // Helper function to start writing NetLog data to file. This should only be 101 // Helper function to start writing NetLog data to file. This should only be
96 // run after context is initialized. 102 // run after context is initialized.
97 void StartNetLogToFileHelper(const std::string& file_name, bool log_all); 103 void StartNetLogToFileHelper(const std::string& file_name, bool log_all);
98 // Helper function to stop writing NetLog data to file. This should only be 104 // Helper function to stop writing NetLog data to file. This should only be
99 // run after context is initialized. 105 // run after context is initialized.
100 void StopNetLogHelper(); 106 void StopNetLogHelper();
101 107
108 #if defined(CRONET_TEST)
109 // Additionally configures |builder| for testing.
110 void ConfigureURLRequestContextBuilderForTesting(
111 net::URLRequestContextBuilder* builder);
112 #endif
113
102 scoped_refptr<URLRequestContextAdapterDelegate> delegate_; 114 scoped_refptr<URLRequestContextAdapterDelegate> delegate_;
103 scoped_ptr<net::URLRequestContext> context_; 115 scoped_ptr<net::URLRequestContext> context_;
104 std::string user_agent_; 116 std::string user_agent_;
105 bool load_disable_cache_; 117 bool load_disable_cache_;
106 base::Thread* network_thread_; 118 base::Thread* network_thread_;
107 scoped_ptr<NetLogObserver> net_log_observer_; 119 scoped_ptr<NetLogObserver> net_log_observer_;
108 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; 120 scoped_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_;
109 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 121 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
110 scoped_ptr<net::SdchOwner> sdch_owner_; 122 scoped_ptr<net::SdchOwner> sdch_owner_;
111 scoped_ptr<URLRequestContextConfig> config_; 123 scoped_ptr<URLRequestContextConfig> config_;
112 124
125 #if defined(CRONET_TEST)
126 // Used in testing to trust certs.
127 scoped_ptr<net::MockCertVerifier> mock_cert_verifier_;
128 #endif
129
113 // A queue of tasks that need to be run after context has been initialized. 130 // A queue of tasks that need to be run after context has been initialized.
114 std::queue<RunAfterContextInitTask> tasks_waiting_for_context_; 131 std::queue<RunAfterContextInitTask> tasks_waiting_for_context_;
115 bool is_context_initialized_; 132 bool is_context_initialized_;
116 133
117 DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter); 134 DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter);
118 }; 135 };
119 136
120 } // namespace cronet 137 } // namespace cronet
121 138
122 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_ 139 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698