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

Side by Side Diff: jingle/notifier/communicator/single_login_attempt_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "jingle/notifier/communicator/single_login_attempt.h" 5 #include "jingle/notifier/communicator/single_login_attempt.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "jingle/notifier/base/const_communicator.h" 12 #include "jingle/notifier/base/const_communicator.h"
13 #include "jingle/notifier/base/fake_base_task.h" 13 #include "jingle/notifier/base/fake_base_task.h"
14 #include "jingle/notifier/communicator/login_settings.h" 14 #include "jingle/notifier/communicator/login_settings.h"
15 #include "net/base/mock_host_resolver.h"
15 #include "net/url_request/url_request_test_util.h" 16 #include "net/url_request/url_request_test_util.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 #include "talk/xmllite/xmlelement.h" 18 #include "talk/xmllite/xmlelement.h"
18 #include "talk/xmpp/constants.h" 19 #include "talk/xmpp/constants.h"
19 #include "talk/xmpp/xmppengine.h" 20 #include "talk/xmpp/xmppengine.h"
20 21
21 namespace buzz { 22 namespace buzz {
22 class XmppTaskParentInterface; 23 class XmppTaskParentInterface;
23 } // namespace buzz 24 } // namespace buzz
24 25
(...skipping 30 matching lines...) Expand all
55 const ServerInformation& redirect_server() const { 56 const ServerInformation& redirect_server() const {
56 return redirect_server_; 57 return redirect_server_;
57 } 58 }
58 59
59 private: 60 private:
60 DelegateState state_; 61 DelegateState state_;
61 base::WeakPtr<buzz::XmppTaskParentInterface> base_task_; 62 base::WeakPtr<buzz::XmppTaskParentInterface> base_task_;
62 ServerInformation redirect_server_; 63 ServerInformation redirect_server_;
63 }; 64 };
64 65
66 class MyTestURLRequestContext : public TestURLRequestContext {
67 public:
68 MyTestURLRequestContext() : TestURLRequestContext(true) {
69 context_storage_.set_host_resolver(new net::HangingHostResolver());
70 Init();
71 }
72 virtual ~MyTestURLRequestContext() {}
73 };
74
65 class SingleLoginAttemptTest : public ::testing::Test { 75 class SingleLoginAttemptTest : public ::testing::Test {
66 protected: 76 protected:
67 SingleLoginAttemptTest() 77 SingleLoginAttemptTest()
68 : login_settings_( 78 : login_settings_(
69 buzz::XmppClientSettings(), 79 buzz::XmppClientSettings(),
70 new TestURLRequestContextGetter(base::MessageLoopProxy::current()), 80 new TestURLRequestContextGetter(
81 base::MessageLoopProxy::current(),
82 scoped_ptr<TestURLRequestContext>(new MyTestURLRequestContext())),
71 ServerList( 83 ServerList(
72 1, 84 1,
73 ServerInformation( 85 ServerInformation(
74 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)), 86 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)),
75 false /* try_ssltcp_first */, 87 false /* try_ssltcp_first */,
76 "auth_mechanism"), 88 "auth_mechanism"),
77 attempt_(login_settings_, &fake_delegate_) {} 89 attempt_(login_settings_, &fake_delegate_) {}
78 90
79 virtual void TearDown() OVERRIDE { 91 virtual void TearDown() OVERRIDE {
80 message_loop_.RunAllPending(); 92 message_loop_.RunAllPending();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 TEST_F(SingleLoginAttemptTest, RedirectMissingSeeOtherHost) { 229 TEST_F(SingleLoginAttemptTest, RedirectMissingSeeOtherHost) {
218 scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError("")); 230 scoped_ptr<buzz::XmlElement> redirect_error(MakeRedirectError(""));
219 redirect_error->RemoveChildAfter(NULL); 231 redirect_error->RemoveChildAfter(NULL);
220 FireRedirect(redirect_error.get()); 232 FireRedirect(redirect_error.get());
221 EXPECT_EQ(IDLE, fake_delegate_.state()); 233 EXPECT_EQ(IDLE, fake_delegate_.state());
222 } 234 }
223 235
224 } // namespace 236 } // namespace
225 237
226 } // namespace notifier 238 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/base/proxy_resolving_client_socket_unittest.cc ('k') | net/proxy/proxy_script_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698