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 <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/message_loop/message_pump_default.h" | 14 #include "base/message_loop/message_pump_default.h" |
14 #include "jingle/glue/mock_task.h" | 15 #include "jingle/glue/mock_task.h" |
15 #include "jingle/glue/task_pump.h" | 16 #include "jingle/glue/task_pump.h" |
16 #include "jingle/notifier/base/weak_xmpp_client.h" | 17 #include "jingle/notifier/base/weak_xmpp_client.h" |
17 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 MOCK_METHOD1(OnConnect, void(base::WeakPtr<buzz::XmppTaskParentInterface>)); | 70 MOCK_METHOD1(OnConnect, void(base::WeakPtr<buzz::XmppTaskParentInterface>)); |
70 MOCK_METHOD3(OnError, | 71 MOCK_METHOD3(OnError, |
71 void(buzz::XmppEngine::Error, int, const buzz::XmlElement*)); | 72 void(buzz::XmppEngine::Error, int, const buzz::XmlElement*)); |
72 }; | 73 }; |
73 | 74 |
74 class XmppConnectionTest : public testing::Test { | 75 class XmppConnectionTest : public testing::Test { |
75 protected: | 76 protected: |
76 XmppConnectionTest() | 77 XmppConnectionTest() |
77 : mock_pre_xmpp_auth_(new MockPreXmppAuth()) { | 78 : mock_pre_xmpp_auth_(new MockPreXmppAuth()) { |
78 scoped_ptr<base::MessagePump> pump(new base::MessagePumpDefault()); | 79 scoped_ptr<base::MessagePump> pump(new base::MessagePumpDefault()); |
79 message_loop_.reset(new base::MessageLoop(pump.Pass())); | 80 message_loop_.reset(new base::MessageLoop(std::move(pump))); |
80 | 81 |
81 url_request_context_getter_ = new net::TestURLRequestContextGetter( | 82 url_request_context_getter_ = new net::TestURLRequestContextGetter( |
82 message_loop_->task_runner()); | 83 message_loop_->task_runner()); |
83 } | 84 } |
84 | 85 |
85 ~XmppConnectionTest() override {} | 86 ~XmppConnectionTest() override {} |
86 | 87 |
87 void TearDown() override { | 88 void TearDown() override { |
88 // Clear out any messages posted by XmppConnection's destructor. | 89 // Clear out any messages posted by XmppConnection's destructor. |
89 message_loop_->RunUntilIdle(); | 90 message_loop_->RunUntilIdle(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 .WillByDefault(Return(TASK_STATE_ERROR)); | 249 .WillByDefault(Return(TASK_STATE_ERROR)); |
249 EXPECT_CALL(*task, ProcessStart()).Times(0); | 250 EXPECT_CALL(*task, ProcessStart()).Times(0); |
250 task->Start(); | 251 task->Start(); |
251 } | 252 } |
252 | 253 |
253 // This should destroy |task_pump|, but |task| still shouldn't run. | 254 // This should destroy |task_pump|, but |task| still shouldn't run. |
254 message_loop_->RunUntilIdle(); | 255 message_loop_->RunUntilIdle(); |
255 } | 256 } |
256 | 257 |
257 } // namespace notifier | 258 } // namespace notifier |
OLD | NEW |