| Index: net/ocsp/nss_ocsp.cc
|
| diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
|
| index cabda31dd046c86ee5ce96dd1e7f2b28cae1673c..5412cba46a7a804beb80c130504cd5d1fc54b4f3 100644
|
| --- a/net/ocsp/nss_ocsp.cc
|
| +++ b/net/ocsp/nss_ocsp.cc
|
| @@ -78,6 +78,20 @@ class OCSPIOLoop {
|
| void AddRequest(OCSPRequestSession* request);
|
| void RemoveRequest(OCSPRequestSession* request);
|
|
|
| + // Clears internal state and calls |StartUsing()|. Should be called only in
|
| + // the context of testing.
|
| + void ReuseForTesting() {
|
| + {
|
| + base::AutoLock autolock(lock_);
|
| + DCHECK(MessageLoopForIO::current());
|
| + thread_checker_.DetachFromThread();
|
| + thread_checker_.CalledOnValidThread();
|
| + shutdown_ = false;
|
| + used_ = false;
|
| + }
|
| + StartUsing();
|
| + }
|
| +
|
| private:
|
| friend struct base::DefaultLazyInstanceTraits<OCSPIOLoop>;
|
|
|
| @@ -934,6 +948,10 @@ void ShutdownNSSHttpIO() {
|
| g_ocsp_io_loop.Get().Shutdown();
|
| }
|
|
|
| +void ResetNSSHttpIOForTesting() {
|
| + g_ocsp_io_loop.Get().ReuseForTesting();
|
| +}
|
| +
|
| // This function would be called before NSS initialization.
|
| void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) {
|
| pthread_mutex_lock(&g_request_context_lock);
|
|
|