| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remoting/host/native_messaging/native_messaging_reader.h" | 5 #include "remoting/host/native_messaging/native_messaging_reader.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 scoped_ptr<NativeMessagingReader> reader_; | 41 scoped_ptr<NativeMessagingReader> reader_; |
| 42 base::PlatformFile read_handle_; | 42 base::PlatformFile read_handle_; |
| 43 base::PlatformFile write_handle_; | 43 base::PlatformFile write_handle_; |
| 44 scoped_ptr<base::Value> message_; | 44 scoped_ptr<base::Value> message_; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // MessageLoop declared here, since the NativeMessageReader ctor requires a | 47 // MessageLoop declared here, since the NativeMessageReader ctor requires a |
| 48 // MessageLoop to have been created. | 48 // MessageLoop to have been created. |
| 49 base::MessageLoop message_loop_; | 49 base::MessageLoopForIO message_loop_; |
| 50 base::RunLoop run_loop_; | 50 base::RunLoop run_loop_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 NativeMessagingReaderTest::NativeMessagingReaderTest() | 53 NativeMessagingReaderTest::NativeMessagingReaderTest() { |
| 54 : message_loop_(base::MessageLoop::TYPE_IO) { | |
| 55 } | 54 } |
| 56 | 55 |
| 57 NativeMessagingReaderTest::~NativeMessagingReaderTest() {} | 56 NativeMessagingReaderTest::~NativeMessagingReaderTest() {} |
| 58 | 57 |
| 59 void NativeMessagingReaderTest::SetUp() { | 58 void NativeMessagingReaderTest::SetUp() { |
| 60 ASSERT_TRUE(MakePipe(&read_handle_, &write_handle_)); | 59 ASSERT_TRUE(MakePipe(&read_handle_, &write_handle_)); |
| 61 reader_.reset(new NativeMessagingReader(read_handle_)); | 60 reader_.reset(new NativeMessagingReader(read_handle_)); |
| 62 } | 61 } |
| 63 | 62 |
| 64 void NativeMessagingReaderTest::TearDown() { | 63 void NativeMessagingReaderTest::TearDown() { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 Run(); | 153 Run(); |
| 155 EXPECT_TRUE(message_); | 154 EXPECT_TRUE(message_); |
| 156 base::DictionaryValue* message_dict; | 155 base::DictionaryValue* message_dict; |
| 157 EXPECT_TRUE(message_->GetAsDictionary(&message_dict)); | 156 EXPECT_TRUE(message_->GetAsDictionary(&message_dict)); |
| 158 int result; | 157 int result; |
| 159 EXPECT_TRUE(message_dict->GetInteger("foo", &result)); | 158 EXPECT_TRUE(message_dict->GetInteger("foo", &result)); |
| 160 EXPECT_EQ(42, result); | 159 EXPECT_EQ(42, result); |
| 161 } | 160 } |
| 162 | 161 |
| 163 } // namespace remoting | 162 } // namespace remoting |
| OLD | NEW |