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

Side by Side Diff: jingle/notifier/communicator/single_login_attempt_unittest.cc

Issue 11365227: Reland 167337 - Move url_request_test_util into net namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const ServerInformation& redirect_server() const { 63 const ServerInformation& redirect_server() const {
64 return redirect_server_; 64 return redirect_server_;
65 } 65 }
66 66
67 private: 67 private:
68 DelegateState state_; 68 DelegateState state_;
69 base::WeakPtr<buzz::XmppTaskParentInterface> base_task_; 69 base::WeakPtr<buzz::XmppTaskParentInterface> base_task_;
70 ServerInformation redirect_server_; 70 ServerInformation redirect_server_;
71 }; 71 };
72 72
73 class MyTestURLRequestContext : public TestURLRequestContext { 73 class MyTestURLRequestContext : public net::TestURLRequestContext {
74 public: 74 public:
75 MyTestURLRequestContext() : TestURLRequestContext(true) { 75 MyTestURLRequestContext() : TestURLRequestContext(true) {
76 context_storage_.set_host_resolver( 76 context_storage_.set_host_resolver(
77 scoped_ptr<net::HostResolver>(new net::HangingHostResolver())); 77 scoped_ptr<net::HostResolver>(new net::HangingHostResolver()));
78 Init(); 78 Init();
79 } 79 }
80 virtual ~MyTestURLRequestContext() {} 80 virtual ~MyTestURLRequestContext() {}
81 }; 81 };
82 82
83 class SingleLoginAttemptTest : public ::testing::Test { 83 class SingleLoginAttemptTest : public ::testing::Test {
84 protected: 84 protected:
85 SingleLoginAttemptTest() 85 SingleLoginAttemptTest()
86 : login_settings_( 86 : login_settings_(
87 buzz::XmppClientSettings(), 87 buzz::XmppClientSettings(),
88 new TestURLRequestContextGetter( 88 new net::TestURLRequestContextGetter(
89 base::MessageLoopProxy::current(), 89 base::MessageLoopProxy::current(),
90 scoped_ptr<TestURLRequestContext>(new MyTestURLRequestContext())), 90 scoped_ptr<net::TestURLRequestContext>(
91 new MyTestURLRequestContext())),
91 ServerList( 92 ServerList(
92 1, 93 1,
93 ServerInformation( 94 ServerInformation(
94 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)), 95 net::HostPortPair("example.com", 100), SUPPORTS_SSLTCP)),
95 false /* try_ssltcp_first */, 96 false /* try_ssltcp_first */,
96 "auth_mechanism"), 97 "auth_mechanism"),
97 attempt_(login_settings_, &fake_delegate_) {} 98 attempt_(login_settings_, &fake_delegate_) {}
98 99
99 virtual void TearDown() OVERRIDE { 100 virtual void TearDown() OVERRIDE {
100 message_loop_.RunAllPending(); 101 message_loop_.RunAllPending();
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Fire 'Unauthorized' errors and make sure the delegate gets the 245 // Fire 'Unauthorized' errors and make sure the delegate gets the
245 // OnCredentialsRejected() event. 246 // OnCredentialsRejected() event.
246 TEST_F(SingleLoginAttemptTest, CredentialsRejected) { 247 TEST_F(SingleLoginAttemptTest, CredentialsRejected) {
247 attempt_.OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL); 248 attempt_.OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL);
248 EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state()); 249 EXPECT_EQ(CREDENTIALS_REJECTED, fake_delegate_.state());
249 } 250 }
250 251
251 } // namespace 252 } // namespace
252 253
253 } // namespace notifier 254 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/base/xmpp_connection_unittest.cc ('k') | jingle/notifier/listener/push_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698