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

Side by Side Diff: net/url_request/url_fetcher_impl_unittest.cc

Issue 11434009: Ensure that NSS HTTP IO is initialized on iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add chrome/browser/io_thread.cc to the CL. Update OS_MACOSX related tests. Created 8 years 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 | Annotate | Revision Log
OLDNEW
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 "net/url_request/url_fetcher_impl.h" 5 #include "net/url_request/url_fetcher_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "crypto/nss_util.h" 16 #include "crypto/nss_util.h"
17 #include "net/http/http_response_headers.h" 17 #include "net/http/http_response_headers.h"
18 #include "net/test/test_server.h" 18 #include "net/test/test_server.h"
19 #include "net/url_request/url_fetcher_delegate.h" 19 #include "net/url_request/url_fetcher_delegate.h"
20 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
21 #include "net/url_request/url_request_test_util.h" 21 #include "net/url_request/url_request_test_util.h"
22 #include "net/url_request/url_request_throttler_manager.h" 22 #include "net/url_request/url_request_throttler_manager.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 #if defined(USE_NSS) 25 #if defined(USE_NSS) || defined(OS_IOS)
26 #include "net/ocsp/nss_ocsp.h" 26 #include "net/ocsp/nss_ocsp.h"
27 #endif 27 #endif
28 28
29 namespace net { 29 namespace net {
30 30
31 using base::Time; 31 using base::Time;
32 using base::TimeDelta; 32 using base::TimeDelta;
33 33
34 // TODO(eroman): Add a regression test for http://crbug.com/40505. 34 // TODO(eroman): Add a regression test for http://crbug.com/40505.
35 35
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 TestURLRequestContext* request_context() { 104 TestURLRequestContext* request_context() {
105 return context_.get(); 105 return context_.get();
106 } 106 }
107 107
108 protected: 108 protected:
109 virtual void SetUp() OVERRIDE { 109 virtual void SetUp() OVERRIDE {
110 testing::Test::SetUp(); 110 testing::Test::SetUp();
111 111
112 io_message_loop_proxy_ = base::MessageLoopProxy::current(); 112 io_message_loop_proxy_ = base::MessageLoopProxy::current();
113 113
114 #if defined(USE_NSS) 114 #if defined(USE_NSS) || defined(OS_IOS)
115 crypto::EnsureNSSInit(); 115 crypto::EnsureNSSInit();
116 EnsureNSSHttpIOInit(); 116 EnsureNSSHttpIOInit();
117 #endif 117 #endif
118 } 118 }
119 119
120 virtual void TearDown() OVERRIDE { 120 virtual void TearDown() OVERRIDE {
121 #if defined(USE_NSS) 121 #if defined(USE_NSS) || defined(OS_IOS)
122 ShutdownNSSHttpIO(); 122 ShutdownNSSHttpIO();
123 #endif 123 #endif
124 } 124 }
125 125
126 // URLFetcher is designed to run on the main UI thread, but in our tests 126 // URLFetcher is designed to run on the main UI thread, but in our tests
127 // we assume that the current thread is the IO thread where the URLFetcher 127 // we assume that the current thread is the IO thread where the URLFetcher
128 // dispatches its requests to. When we wish to simulate being used from 128 // dispatches its requests to. When we wish to simulate being used from
129 // a UI thread, we dispatch a worker thread to do so. 129 // a UI thread, we dispatch a worker thread to do so.
130 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 130 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
131 131
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). 1245 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit().
1246 1246
1247 MessageLoop::current()->RunUntilIdle(); 1247 MessageLoop::current()->RunUntilIdle();
1248 ASSERT_FALSE(file_util::PathExists(file_path_)) 1248 ASSERT_FALSE(file_util::PathExists(file_path_))
1249 << file_path_.value() << " not removed."; 1249 << file_path_.value() << " not removed.";
1250 } 1250 }
1251 1251
1252 } // namespace 1252 } // namespace
1253 1253
1254 } // namespace net 1254 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698