| 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/weak_xmpp_client.h" | 5 #include "jingle/notifier/base/weak_xmpp_client.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 OnOutputLog(kOutputLog, arraysize(kOutputLog))); | 53 OnOutputLog(kOutputLog, arraysize(kOutputLog))); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RaiseSignals(buzz::XmppClient* xmpp_client) { | 56 void RaiseSignals(buzz::XmppClient* xmpp_client) { |
| 57 xmpp_client->SignalStateChange(kState); | 57 xmpp_client->SignalStateChange(kState); |
| 58 xmpp_client->SignalLogInput(kInputLog, arraysize(kInputLog)); | 58 xmpp_client->SignalLogInput(kInputLog, arraysize(kInputLog)); |
| 59 xmpp_client->SignalLogOutput(kOutputLog, arraysize(kOutputLog)); | 59 xmpp_client->SignalLogOutput(kOutputLog, arraysize(kOutputLog)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Needed by TaskPump. | 62 // Needed by TaskPump. |
| 63 MessageLoop message_loop_; | 63 base::MessageLoop message_loop_; |
| 64 | 64 |
| 65 scoped_ptr<jingle_glue::TaskPump> task_pump_; | 65 scoped_ptr<jingle_glue::TaskPump> task_pump_; |
| 66 MockXmppDelegate mock_xmpp_delegate_; | 66 MockXmppDelegate mock_xmpp_delegate_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 TEST_F(WeakXmppClientTest, InvalidationViaInvalidate) { | 69 TEST_F(WeakXmppClientTest, InvalidationViaInvalidate) { |
| 70 ExpectSignalCalls(); | 70 ExpectSignalCalls(); |
| 71 | 71 |
| 72 WeakXmppClient* weak_xmpp_client = new WeakXmppClient(task_pump_.get()); | 72 WeakXmppClient* weak_xmpp_client = new WeakXmppClient(task_pump_.get()); |
| 73 ConnectSignals(weak_xmpp_client); | 73 ConnectSignals(weak_xmpp_client); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 task_pump_.reset(); | 116 task_pump_.reset(); |
| 117 EXPECT_FALSE(weak_ptr.get()); | 117 EXPECT_FALSE(weak_ptr.get()); |
| 118 // |weak_xmpp_client| is truly invalid at this point so we can't | 118 // |weak_xmpp_client| is truly invalid at this point so we can't |
| 119 // RaiseSignals() with it. | 119 // RaiseSignals() with it. |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace | 122 } // namespace |
| 123 | 123 |
| 124 } // namespace notifier | 124 } // namespace notifier |
| OLD | NEW |