| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "jingle/glue/thread_wrapper.h" | 9 #include "jingle/glue/thread_wrapper.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 MatchMessage(&handler, kTestMessage2, data))) | 73 MatchMessage(&handler, kTestMessage2, data))) |
| 74 .WillOnce(DeleteMessageData()); | 74 .WillOnce(DeleteMessageData()); |
| 75 thread_->Send(&handler, kTestMessage2, data); | 75 thread_->Send(&handler, kTestMessage2, data); |
| 76 } | 76 } |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 ThreadWrapperTest() | 79 ThreadWrapperTest() |
| 80 : thread_(NULL) { | 80 : thread_(NULL) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void SetUp() OVERRIDE { | 83 virtual void SetUp() override { |
| 84 JingleThreadWrapper::EnsureForCurrentMessageLoop(); | 84 JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| 85 thread_ = rtc::Thread::Current(); | 85 thread_ = rtc::Thread::Current(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 // ThreadWrapper destroyes itself when |message_loop_| is destroyed. | 88 // ThreadWrapper destroyes itself when |message_loop_| is destroyed. |
| 89 base::MessageLoop message_loop_; | 89 base::MessageLoop message_loop_; |
| 90 rtc::Thread* thread_; | 90 rtc::Thread* thread_; |
| 91 MockMessageHandler handler1_; | 91 MockMessageHandler handler1_; |
| 92 MockMessageHandler handler2_; | 92 MockMessageHandler handler2_; |
| 93 }; | 93 }; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 TEST_F(ThreadWrapperTest, Dispose) { | 300 TEST_F(ThreadWrapperTest, Dispose) { |
| 301 bool deleted_ = false; | 301 bool deleted_ = false; |
| 302 thread_->Dispose(new DeletableObject(&deleted_)); | 302 thread_->Dispose(new DeletableObject(&deleted_)); |
| 303 EXPECT_FALSE(deleted_); | 303 EXPECT_FALSE(deleted_); |
| 304 message_loop_.RunUntilIdle(); | 304 message_loop_.RunUntilIdle(); |
| 305 EXPECT_TRUE(deleted_); | 305 EXPECT_TRUE(deleted_); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace jingle_glue | 308 } // namespace jingle_glue |
| OLD | NEW |