| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/blimp_message_thread_pipe.h" | 5 #include "blimp/net/blimp_message_thread_pipe.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public: | 25 public: |
| 26 BlimpMessageThreadPipeTest() : thread_("PipeThread") {} | 26 BlimpMessageThreadPipeTest() : thread_("PipeThread") {} |
| 27 | 27 |
| 28 ~BlimpMessageThreadPipeTest() override {} | 28 ~BlimpMessageThreadPipeTest() override {} |
| 29 | 29 |
| 30 void SetUp() override { | 30 void SetUp() override { |
| 31 // Start the target processor thread and initialize the pipe & proxy. | 31 // Start the target processor thread and initialize the pipe & proxy. |
| 32 // Note that none of this will "touch" the target processor, so it's | 32 // Note that none of this will "touch" the target processor, so it's |
| 33 // safe to do here, before EXPECT_CALL() expectations are set up. | 33 // safe to do here, before EXPECT_CALL() expectations are set up. |
| 34 ASSERT_TRUE(thread_.Start()); | 34 ASSERT_TRUE(thread_.Start()); |
| 35 pipe_ = base::WrapUnique(new BlimpMessageThreadPipe(thread_.task_runner())); | 35 pipe_ = base::MakeUnique<BlimpMessageThreadPipe>(thread_.task_runner()); |
| 36 proxy_ = pipe_->CreateProxy(); | 36 proxy_ = pipe_->CreateProxy(); |
| 37 | 37 |
| 38 thread_.task_runner()->PostTask( | 38 thread_.task_runner()->PostTask( |
| 39 FROM_HERE, base::Bind(&BlimpMessageThreadPipe::set_target_processor, | 39 FROM_HERE, base::Bind(&BlimpMessageThreadPipe::set_target_processor, |
| 40 base::Unretained(pipe_.get()), &null_processor_)); | 40 base::Unretained(pipe_.get()), &null_processor_)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void TearDown() override { | 43 void TearDown() override { |
| 44 // If |pipe_| is still active, tear it down safely on |thread_|. | 44 // If |pipe_| is still active, tear it down safely on |thread_|. |
| 45 if (pipe_) | 45 if (pipe_) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 TEST_F(BlimpMessageThreadPipeTest, NullCompletionCallback) { | 113 TEST_F(BlimpMessageThreadPipeTest, NullCompletionCallback) { |
| 114 // Don't expect the mock to be called, but do expect not to crash. | 114 // Don't expect the mock to be called, but do expect not to crash. |
| 115 EXPECT_CALL(*this, MockCompletionCallback(_)).Times(0); | 115 EXPECT_CALL(*this, MockCompletionCallback(_)).Times(0); |
| 116 | 116 |
| 117 proxy_->ProcessMessage(base::WrapUnique(new BlimpMessage), | 117 proxy_->ProcessMessage(base::WrapUnique(new BlimpMessage), |
| 118 net::CompletionCallback()); | 118 net::CompletionCallback()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace blimp | 121 } // namespace blimp |
| OLD | NEW |