summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-07 20:25:46 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-07 20:25:46 +0000
commitea224582f14bb849ccab853de7e63e2ffa75994a (patch)
tree696e1da077c7b448f8fed2464a4ce42a88103a9c /net/url_request
parent3d2b7b5f90e42a435b1ef1f55c39e60c3a846485 (diff)
downloadchromium_src-ea224582f14bb849ccab853de7e63e2ffa75994a.zip
chromium_src-ea224582f14bb849ccab853de7e63e2ffa75994a.tar.gz
chromium_src-ea224582f14bb849ccab853de7e63e2ffa75994a.tar.bz2
Third time's a charm?
Fix part of http://code.google.com/p/chromium/issues/detail?id=4510 and improve https support in test shell on linux. This is the same as the earlier ssl cert cl (see http://codereview.chromium.org/11249), but with the certs moved so net can use them without reaching over into chrome's pants and causing test failure on the 'modules' Windows build server, which is set up to test net and base but not chrome. For this to pass, we will need to install the certs on the windows module and try servers. (And make sure tlslite is present.) (A later CL will finish implementing SSLInfo for Linux, and probably reference net/base/ssl_test_util.cc from all three vcproj files that need it, even though that's ugly, because that's less ugly that referencing it from net.lib's vcproj.) Review URL: http://codereview.chromium.org/12930 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_unittest.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index e2197f8..83d5744 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -4,9 +4,13 @@
#include "net/url_request/url_request_unittest.h"
+#include "build/build_config.h"
+
#if defined(OS_WIN)
#include <windows.h>
#include <shlobj.h>
+#elif defined(OS_LINUX)
+#include "base/nss_init.h"
#endif
#include <algorithm>
@@ -21,6 +25,7 @@
#include "net/base/net_errors.h"
#include "net/base/net_module.h"
#include "net/base/net_util.h"
+#include "net/base/ssl_test_util.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_cache.h"
#include "net/http/http_network_layer.h"
@@ -116,6 +121,48 @@ TEST_F(URLRequestTest, GetTest) {
#endif
}
+class HTTPSRequestTest : public testing::Test {
+ protected:
+ HTTPSRequestTest() : util_() {};
+
+ SSLTestUtil util_;
+};
+
+#if defined(OS_MACOSX)
+// TODO(port): support temporary root cert on mac
+#define MAYBE_HTTPSGetTest DISABLED_HTTPSGetTest
+#else
+#define MAYBE_HTTPSGetTest HTTPSGetTest
+#endif
+
+TEST_F(HTTPSRequestTest, MAYBE_HTTPSGetTest) {
+ // Note: tools/testserver/testserver.py does not need
+ // a working document root to server the pages / and /hello.html,
+ // so this test doesn't really need to specify a document root.
+ // But if it did, a good one would be net/data/ssl.
+ HTTPSTestServer https_server(util_.kHostName, util_.kOKHTTPSPort,
+ L"net/data/ssl",
+ util_.GetOKCertPath().ToWStringHack());
+
+ EXPECT_TRUE(util_.CheckCATrusted());
+ TestDelegate d;
+ {
+ TestURLRequest r(https_server.TestServerPage(""), &d);
+
+ r.Start();
+ EXPECT_TRUE(r.is_pending());
+
+ MessageLoop::current()->Run();
+
+ EXPECT_EQ(1, d.response_started_count());
+ EXPECT_FALSE(d.received_data_before_response());
+ EXPECT_NE(0, d.bytes_received());
+ }
+#ifndef NDEBUG
+ DCHECK_EQ(url_request_metrics.object_count,0);
+#endif
+}
+
TEST_F(URLRequestTest, CancelTest) {
TestDelegate d;
{