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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 6541021: Send fatal proxy errors to the network delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 35573edef15a690487ef6054a719296fd3cda4da..c7b4147aa2cf3c1f7b141144c71e264b7227bdf8 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -27,6 +27,7 @@
#include "net/base/cookie_monster.h"
#include "net/base/cookie_policy.h"
#include "net/base/load_flags.h"
+#include "net/base/mock_host_resolver.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_log_unittest.h"
@@ -2348,6 +2349,34 @@ TEST_F(URLRequestTest, Identifiers) {
ASSERT_NE(req.identifier(), other_req.identifier());
}
+// Check that a failure to connect to the proxy is reported to the network
+// delegate.
+TEST_F(URLRequestTest, NetworkDelegateProxyError) {
+ TestDelegate d;
+ TestURLRequest req(GURL("http://example.com"), &d);
+ req.set_method("GET");
+
+ scoped_ptr<net::MockHostResolverBase> host_resolver(
+ new net::MockHostResolver);
+ host_resolver->rules()->AddSimulatedFailure("*");
+ scoped_refptr<TestURLRequestContext> context(
+ new TestURLRequestContext("myproxy:70", host_resolver.release()));
+ TestHttpNetworkDelegate network_delegate;
+ context->set_network_delegate(&network_delegate);
+ req.set_context(context);
+
+ req.Start();
+ MessageLoop::current()->Run();
+
+ // Check we see a failed request.
+ EXPECT_FALSE(req.status().is_success());
+ EXPECT_EQ(net::URLRequestStatus::FAILED, req.status().status());
+ EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED, req.status().os_error());
+
+ EXPECT_EQ(1, network_delegate.error_count());
+ EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED, network_delegate.last_os_error());
+}
+
class URLRequestTestFTP : public URLRequestTest {
public:
URLRequestTestFTP() : test_server_(net::TestServer::TYPE_FTP, FilePath()) {
« net/url_request/url_request_test_util.h ('K') | « net/url_request/url_request_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698