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

Unified Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 10408067: [net] Switch TestURLRequestContext to use MockCachingHostResolver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to trunk. Created 8 years, 7 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
« no previous file with comments | « no previous file | jingle/notifier/base/proxy_resolving_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index f2e94be246c4df285695ae7eb14e3b67bc3d374b..d9ccb9cf071781c2a306b44c4eec05c1457ea608 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -28,6 +28,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/test/test_browser_thread.h"
#include "net/base/auth.h"
+#include "net/base/mock_host_resolver.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -127,8 +128,9 @@ class ExtensionWebRequestTest : public testing::Test {
network_delegate_.reset(new ChromeNetworkDelegate(
event_router_.get(), NULL, NULL, &profile_,
CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_));
- context_.reset(new TestURLRequestContext());
+ context_.reset(new TestURLRequestContext(true));
context_->set_network_delegate(network_delegate_.get());
+ context_->Init();
}
MessageLoopForIO message_loop_;
@@ -444,8 +446,12 @@ class ExtensionWebRequestHeaderModificationTest :
network_delegate_.reset(new ChromeNetworkDelegate(
event_router_.get(), NULL, NULL, &profile_,
CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_));
- context_.reset(new TestURLRequestContext());
+ context_.reset(new TestURLRequestContext(true));
+ host_resolver_.reset(new net::MockHostResolver());
+ host_resolver_->rules()->AddSimulatedFailure("doesnotexist");
+ context_->set_host_resolver(host_resolver_.get());
context_->set_network_delegate(network_delegate_.get());
+ context_->Init();
}
MessageLoopForIO message_loop_;
@@ -458,6 +464,7 @@ class ExtensionWebRequestHeaderModificationTest :
scoped_refptr<ExtensionEventRouterForwarder> event_router_;
scoped_refptr<ExtensionInfoMap> extension_info_map_;
scoped_ptr<ChromeNetworkDelegate> network_delegate_;
+ scoped_ptr<net::MockHostResolver> host_resolver_;
scoped_ptr<TestURLRequestContext> context_;
};
« no previous file with comments | « no previous file | jingle/notifier/base/proxy_resolving_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698