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

Side by Side Diff: net/url_request/url_request_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: 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { 1323 TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) {
1324 TestDelegate d; 1324 TestDelegate d;
1325 URLRequest req(GURL("data:,"), &d, &default_context_); 1325 URLRequest req(GURL("data:,"), &d, &default_context_);
1326 req.Start(); 1326 req.Start();
1327 MessageLoop::current()->Run(); 1327 MessageLoop::current()->Run();
1328 EXPECT_EQ("", d.data_received()); 1328 EXPECT_EQ("", d.data_received());
1329 EXPECT_EQ(1, default_network_delegate_.completed_requests()); 1329 EXPECT_EQ(1, default_network_delegate_.completed_requests());
1330 } 1330 }
1331 1331
1332 // TODO(droger): Support TestServer on iOS (see http://crbug.com/148666). 1332 // TODO(droger): Support TestServer on iOS (see http://crbug.com/148666).
1333 #if !defined(OS_IOS) 1333 #if !defined(OS_IOS)
droger 2012/11/29 08:32:26 Disabled tests on iOS.
1334 // A subclass of TestServer that uses a statically-configured hostname. This is 1334 // A subclass of TestServer that uses a statically-configured hostname. This is
1335 // to work around mysterious failures in chrome_frame_net_tests. See: 1335 // to work around mysterious failures in chrome_frame_net_tests. See:
1336 // http://crbug.com/114369 1336 // http://crbug.com/114369
1337 class LocalHttpTestServer : public TestServer { 1337 class LocalHttpTestServer : public TestServer {
1338 public: 1338 public:
1339 explicit LocalHttpTestServer(const FilePath& document_root) 1339 explicit LocalHttpTestServer(const FilePath& document_root)
1340 : TestServer(TestServer::TYPE_HTTP, 1340 : TestServer(TestServer::TYPE_HTTP,
1341 ScopedCustomUrlRequestTestHttpHost::value(), 1341 ScopedCustomUrlRequestTestHttpHost::value(),
1342 document_root) {} 1342 document_root) {}
1343 LocalHttpTestServer() 1343 LocalHttpTestServer()
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4456 4456
4457 virtual void SetUp() OVERRIDE { 4457 virtual void SetUp() OVERRIDE {
4458 SetupContext(&context_); 4458 SetupContext(&context_);
4459 context_.Init(); 4459 context_.Init();
4460 4460
4461 scoped_refptr<net::X509Certificate> root_cert = 4461 scoped_refptr<net::X509Certificate> root_cert =
4462 ImportCertFromFile(GetTestCertsDirectory(), "ocsp-test-root.pem"); 4462 ImportCertFromFile(GetTestCertsDirectory(), "ocsp-test-root.pem");
4463 CHECK_NE(static_cast<X509Certificate*>(NULL), root_cert); 4463 CHECK_NE(static_cast<X509Certificate*>(NULL), root_cert);
4464 test_root_.reset(new ScopedTestRoot(root_cert)); 4464 test_root_.reset(new ScopedTestRoot(root_cert));
4465 4465
4466 #if defined(USE_NSS) 4466 #if defined(USE_NSS) || defined(OS_IOS)
4467 SetURLRequestContextForNSSHttpIO(&context_); 4467 SetURLRequestContextForNSSHttpIO(&context_);
4468 EnsureNSSHttpIOInit(); 4468 EnsureNSSHttpIOInit();
4469 #endif 4469 #endif
4470 } 4470 }
4471 4471
4472 void DoConnection(const TestServer::SSLOptions& ssl_options, 4472 void DoConnection(const TestServer::SSLOptions& ssl_options,
4473 CertStatus* out_cert_status) { 4473 CertStatus* out_cert_status) {
4474 TestServer test_server(TestServer::TYPE_HTTPS, 4474 TestServer test_server(TestServer::TYPE_HTTPS,
4475 ssl_options, 4475 ssl_options,
4476 FilePath(FILE_PATH_LITERAL("net/data/ssl"))); 4476 FilePath(FILE_PATH_LITERAL("net/data/ssl")));
4477 ASSERT_TRUE(test_server.Start()); 4477 ASSERT_TRUE(test_server.Start());
4478 4478
4479 TestDelegate d; 4479 TestDelegate d;
4480 d.set_allow_certificate_errors(true); 4480 d.set_allow_certificate_errors(true);
4481 URLRequest r(test_server.GetURL(""), &d, &context_); 4481 URLRequest r(test_server.GetURL(""), &d, &context_);
4482 r.Start(); 4482 r.Start();
4483 4483
4484 MessageLoop::current()->Run(); 4484 MessageLoop::current()->Run();
4485 4485
4486 EXPECT_EQ(1, d.response_started_count()); 4486 EXPECT_EQ(1, d.response_started_count());
4487 *out_cert_status = r.ssl_info().cert_status; 4487 *out_cert_status = r.ssl_info().cert_status;
4488 } 4488 }
4489 4489
4490 ~HTTPSOCSPTest() { 4490 ~HTTPSOCSPTest() {
4491 #if defined(USE_NSS) 4491 #if defined(USE_NSS) || defined(OS_IOS)
4492 ShutdownNSSHttpIO(); 4492 ShutdownNSSHttpIO();
4493 #endif 4493 #endif
Ryan Sleevi 2012/11/28 21:56:13 Are these tests somehow disabled on iOS? I suspect
droger 2012/11/29 08:32:26 Some tests in this file are disabled on iOS becaus
wtc 2012/11/29 19:24:33 I don't know what you meant by "the OS_MACOSX rule
4494 } 4494 }
4495 4495
4496 protected: 4496 protected:
4497 // SetupContext configures the URLRequestContext that will be used for making 4497 // SetupContext configures the URLRequestContext that will be used for making
4498 // connetions to testserver. This can be overridden in test subclasses for 4498 // connetions to testserver. This can be overridden in test subclasses for
4499 // different behaviour. 4499 // different behaviour.
4500 virtual void SetupContext(URLRequestContext* context) { 4500 virtual void SetupContext(URLRequestContext* context) {
4501 context->set_ssl_config_service( 4501 context->set_ssl_config_service(
4502 new TestSSLConfigService(true /* check for EV */, 4502 new TestSSLConfigService(true /* check for EV */,
4503 true /* online revocation checking */)); 4503 true /* online revocation checking */));
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
5113 5113
5114 EXPECT_FALSE(r.is_pending()); 5114 EXPECT_FALSE(r.is_pending());
5115 EXPECT_EQ(1, d->response_started_count()); 5115 EXPECT_EQ(1, d->response_started_count());
5116 EXPECT_FALSE(d->received_data_before_response()); 5116 EXPECT_FALSE(d->received_data_before_response());
5117 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 5117 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
5118 } 5118 }
5119 } 5119 }
5120 #endif // !defined(DISABLE_FTP_SUPPORT) 5120 #endif // !defined(DISABLE_FTP_SUPPORT)
5121 5121
5122 } // namespace net 5122 } // namespace net
OLDNEW
« net/url_request/url_fetcher_impl_unittest.cc ('K') | « net/url_request/url_fetcher_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698