OLD | NEW |
---|---|
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/base/xmpp_connection.h" | 5 #include "jingle/notifier/base/xmpp_connection.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 scoped_ptr<MockPreXmppAuth> mock_pre_xmpp_auth_; | 96 scoped_ptr<MockPreXmppAuth> mock_pre_xmpp_auth_; |
97 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; | 97 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; |
98 }; | 98 }; |
99 | 99 |
100 TEST_F(XmppConnectionTest, CreateDestroy) { | 100 TEST_F(XmppConnectionTest, CreateDestroy) { |
101 XmppConnection xmpp_connection(buzz::XmppClientSettings(), | 101 XmppConnection xmpp_connection(buzz::XmppClientSettings(), |
102 url_request_context_getter_, | 102 url_request_context_getter_, |
103 &mock_xmpp_connection_delegate_, NULL); | 103 &mock_xmpp_connection_delegate_, NULL); |
104 } | 104 } |
105 | 105 |
106 #if !defined(_MSC_VER) || _MSC_VER < 1700 // http://crbug.com/158570 | 106 #if !defined(_MSC_VER) // http://crbug.com/158570 |
scottmg
2014/12/13 20:11:02
These are just buggy. :( I guess add 158570 to the
Mostyn Bramley-Moore
2014/12/13 20:22:45
Done.
| |
107 TEST_F(XmppConnectionTest, ImmediateFailure) { | 107 TEST_F(XmppConnectionTest, ImmediateFailure) { |
108 // ChromeAsyncSocket::Connect() will always return false since we're | 108 // ChromeAsyncSocket::Connect() will always return false since we're |
109 // not setting a valid host, but this gets bubbled up as ERROR_NONE | 109 // not setting a valid host, but this gets bubbled up as ERROR_NONE |
110 // due to XmppClient's inconsistent error-handling. | 110 // due to XmppClient's inconsistent error-handling. |
111 EXPECT_CALL(mock_xmpp_connection_delegate_, | 111 EXPECT_CALL(mock_xmpp_connection_delegate_, |
112 OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL)); | 112 OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL)); |
113 | 113 |
114 XmppConnection xmpp_connection(buzz::XmppClientSettings(), | 114 XmppConnection xmpp_connection(buzz::XmppClientSettings(), |
115 url_request_context_getter_, | 115 url_request_context_getter_, |
116 &mock_xmpp_connection_delegate_, NULL); | 116 &mock_xmpp_connection_delegate_, NULL); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 SignalStateChange(buzz::XmppEngine::STATE_OPEN); | 203 SignalStateChange(buzz::XmppEngine::STATE_OPEN); |
204 for (int i = 0; i < 3; ++i) { | 204 for (int i = 0; i < 3; ++i) { |
205 xmpp_connection.weak_xmpp_client_-> | 205 xmpp_connection.weak_xmpp_client_-> |
206 SignalStateChange(buzz::XmppEngine::STATE_OPEN); | 206 SignalStateChange(buzz::XmppEngine::STATE_OPEN); |
207 } | 207 } |
208 | 208 |
209 EXPECT_EQ(xmpp_connection.weak_xmpp_client_.get(), weak_ptr.get()); | 209 EXPECT_EQ(xmpp_connection.weak_xmpp_client_.get(), weak_ptr.get()); |
210 }, "more than once"); | 210 }, "more than once"); |
211 } | 211 } |
212 | 212 |
213 #if !defined(_MSC_VER) || _MSC_VER < 1700 // http://crbug.com/158570 | 213 #if !defined(_MSC_VER) // http://crbug.com/158570 |
214 TEST_F(XmppConnectionTest, ConnectThenError) { | 214 TEST_F(XmppConnectionTest, ConnectThenError) { |
215 base::WeakPtr<rtc::Task> weak_ptr; | 215 base::WeakPtr<rtc::Task> weak_ptr; |
216 EXPECT_CALL(mock_xmpp_connection_delegate_, OnConnect(_)). | 216 EXPECT_CALL(mock_xmpp_connection_delegate_, OnConnect(_)). |
217 WillOnce(SaveArg<0>(&weak_ptr)); | 217 WillOnce(SaveArg<0>(&weak_ptr)); |
218 EXPECT_CALL(mock_xmpp_connection_delegate_, | 218 EXPECT_CALL(mock_xmpp_connection_delegate_, |
219 OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL)); | 219 OnError(buzz::XmppEngine::ERROR_NONE, 0, NULL)); |
220 | 220 |
221 XmppConnection xmpp_connection(buzz::XmppClientSettings(), | 221 XmppConnection xmpp_connection(buzz::XmppClientSettings(), |
222 url_request_context_getter_, | 222 url_request_context_getter_, |
223 &mock_xmpp_connection_delegate_, NULL); | 223 &mock_xmpp_connection_delegate_, NULL); |
(...skipping 25 matching lines...) Expand all Loading... | |
249 .WillByDefault(Return(TASK_STATE_ERROR)); | 249 .WillByDefault(Return(TASK_STATE_ERROR)); |
250 EXPECT_CALL(*task, ProcessStart()).Times(0); | 250 EXPECT_CALL(*task, ProcessStart()).Times(0); |
251 task->Start(); | 251 task->Start(); |
252 } | 252 } |
253 | 253 |
254 // This should destroy |task_pump|, but |task| still shouldn't run. | 254 // This should destroy |task_pump|, but |task| still shouldn't run. |
255 message_loop_->RunUntilIdle(); | 255 message_loop_->RunUntilIdle(); |
256 } | 256 } |
257 | 257 |
258 } // namespace notifier | 258 } // namespace notifier |
OLD | NEW |