summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 01:41:04 +0000
committerszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 01:41:04 +0000
commitd5a4dd65f33e42ff766013a4f4ff3cf4a52673e5 (patch)
treef9074959ade9d3f4d39e6b07ce08603dd100bd5b /sync
parent222c84bf2c650b7f7afeaef5bfbd0bc738ac8d81 (diff)
downloadchromium_src-d5a4dd65f33e42ff766013a4f4ff3cf4a52673e5.zip
chromium_src-d5a4dd65f33e42ff766013a4f4ff3cf4a52673e5.tar.gz
chromium_src-d5a4dd65f33e42ff766013a4f4ff3cf4a52673e5.tar.bz2
[net] Switch TestURLRequestContext and other tests to use MockCachingHostResolver or MockHostResolver.
Make explicit when HostResolver::Resolve is expected to never complete in tests. Clean up TestURLRequestContext API. BUG=126016,128745 TEST=net_unittests; jingle_unittests; sync_unit_tests Review URL: https://chromiumcodereview.appspot.com/10408067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/notifier/DEPS1
-rw-r--r--sync/notifier/p2p_notifier_unittest.cc14
2 files changed, 14 insertions, 1 deletions
diff --git a/sync/notifier/DEPS b/sync/notifier/DEPS
index ab55b47..fe689b9 100644
--- a/sync/notifier/DEPS
+++ b/sync/notifier/DEPS
@@ -1,6 +1,7 @@
include_rules = [
"+google/cacheinvalidation",
"+jingle/notifier",
+ "+net/base/mock_host_resolver.h",
"+net/url_request/url_request_context.h",
"+net/url_request/url_request_test_util.h",
diff --git a/sync/notifier/p2p_notifier_unittest.cc b/sync/notifier/p2p_notifier_unittest.cc
index ea85433..6183121 100644
--- a/sync/notifier/p2p_notifier_unittest.cc
+++ b/sync/notifier/p2p_notifier_unittest.cc
@@ -12,6 +12,7 @@
#include "jingle/notifier/base/fake_base_task.h"
#include "jingle/notifier/base/notifier_options.h"
#include "jingle/notifier/listener/push_client.h"
+#include "net/base/mock_host_resolver.h"
#include "net/url_request/url_request_test_util.h"
#include "sync/notifier/mock_sync_notifier_observer.h"
#include "sync/syncable/model_type.h"
@@ -25,11 +26,22 @@ using ::testing::_;
using ::testing::Mock;
using ::testing::StrictMock;
+class MyTestURLRequestContext : public TestURLRequestContext {
+ public:
+ MyTestURLRequestContext() : TestURLRequestContext(true) {
+ context_storage_.set_host_resolver(new net::HangingHostResolver());
+ Init();
+ }
+ virtual ~MyTestURLRequestContext() {}
+};
+
class P2PNotifierTest : public testing::Test {
protected:
P2PNotifierTest() {
notifier_options_.request_context_getter =
- new TestURLRequestContextGetter(message_loop_.message_loop_proxy());
+ new TestURLRequestContextGetter(
+ message_loop_.message_loop_proxy(),
+ scoped_ptr<TestURLRequestContext>(new MyTestURLRequestContext()));
}
virtual ~P2PNotifierTest() {}