| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // | |
| 5 // A simple wrapper around invalidation::InvalidationClient that | |
| 6 // handles all the startup/shutdown details and hookups. | |
| 7 | 4 |
| 8 #include "base/message_loop.h" | |
| 9 #include "jingle/notifier/base/fake_base_task.h" | 5 #include "jingle/notifier/base/fake_base_task.h" |
| 10 #include "jingle/notifier/base/weak_xmpp_client.h" | 6 #include "jingle/notifier/base/weak_xmpp_client.h" |
| 11 #include "talk/xmpp/asyncsocket.h" | 7 #include "talk/xmpp/asyncsocket.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 13 | 9 |
| 14 namespace notifier { | 10 namespace notifier { |
| 15 | 11 |
| 16 using ::testing::_; | 12 using ::testing::_; |
| 17 using ::testing::Return; | 13 using ::testing::Return; |
| 18 | 14 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 notifier::WeakXmppClient* weak_xmpp_client = | 31 notifier::WeakXmppClient* weak_xmpp_client = |
| 36 new notifier::WeakXmppClient(&task_pump_); | 32 new notifier::WeakXmppClient(&task_pump_); |
| 37 | 33 |
| 38 weak_xmpp_client->Start(); | 34 weak_xmpp_client->Start(); |
| 39 buzz::XmppClientSettings settings; | 35 buzz::XmppClientSettings settings; |
| 40 // Owned by |weak_xmpp_client|. | 36 // Owned by |weak_xmpp_client|. |
| 41 MockAsyncSocket* mock_async_socket = new MockAsyncSocket(); | 37 MockAsyncSocket* mock_async_socket = new MockAsyncSocket(); |
| 42 EXPECT_CALL(*mock_async_socket, Connect(_)).WillOnce(Return(true)); | 38 EXPECT_CALL(*mock_async_socket, Connect(_)).WillOnce(Return(true)); |
| 43 weak_xmpp_client->Connect(settings, "en", mock_async_socket, NULL); | 39 weak_xmpp_client->Connect(settings, "en", mock_async_socket, NULL); |
| 44 // Initialize the XMPP client. | 40 // Initialize the XMPP client. |
| 45 MessageLoop::current()->RunAllPending(); | 41 task_pump_.RunTasks(); |
| 46 | 42 |
| 47 base_task_ = weak_xmpp_client->AsWeakPtr(); | 43 base_task_ = weak_xmpp_client->AsWeakPtr(); |
| 48 } | 44 } |
| 49 | 45 |
| 50 base::WeakPtr<talk_base::Task> FakeBaseTask::AsWeakPtr() { | 46 base::WeakPtr<talk_base::Task> FakeBaseTask::AsWeakPtr() { |
| 51 return base_task_; | 47 return base_task_; |
| 52 } | 48 } |
| 53 | 49 |
| 54 } // namespace notifier | 50 } // namespace notifier |
| OLD | NEW |