summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authordank@chromium.org <dank@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-26 22:21:17 +0000
committerdank@chromium.org <dank@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-26 22:21:17 +0000
commitab63eccc1f9afea4e4f8587178c40ce1d0799f56 (patch)
treeb2b7438a4d9e73fa7079f2489bd0d846bea5a08b /net/url_request
parente5f659d04a347c41cbd71c918ff0f24448bd0bcc (diff)
downloadchromium_src-ab63eccc1f9afea4e4f8587178c40ce1d0799f56.zip
chromium_src-ab63eccc1f9afea4e4f8587178c40ce1d0799f56.tar.gz
chromium_src-ab63eccc1f9afea4e4f8587178c40ce1d0799f56.tar.bz2
Point nss at root certs so test_shell can talk to mail.google.com without warnings.
(gmail.com's certificate is for mail.google.com, which doesn't match gmail.com, so on some distros, test_shell will now refuse to talk with gmail.com.) Support ciphers needed to talk to testserver.py. Load temporary testing cert needed to run unit tests (can't do it manually like on Windows, since we don't use a writable cert database in the filesystem.) Implement part of GetSSLInfo. Re-enable url_request_unittest.cc, which seems to have been removed from the list of files to compile by mistake. Addresses part of http://code.google.com/p/chromium/issues/detail?id=4510 Later changesets will implement x509 certificates for nss, finish GetSSLInfo support, and update chrome/browser/ssl_uitest.cc to use SSLTestUtil. Review URL: http://codereview.chromium.org/11249 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6063 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_unittest.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 05686e6..df7b98b 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>
@@ -18,10 +22,12 @@
#include "base/process_util.h"
#include "base/string_piece.h"
#include "base/string_util.h"
+#include "base/trace_event.h"
#include "net/base/load_flags.h"
#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 +122,41 @@ TEST_F(URLRequestTest, GetTest) {
#endif
}
+class HTTPSRequestTest : public testing::Test {
+ protected:
+ 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) {
+ base::TraceLog::StartTracing();
+ HTTPSTestServer https_server(util_.kHostName, util_.kOKHTTPSPort,
+ util_.kDocRoot, util_.GetOKCertPath());
+
+ 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;
{