| 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/it2me/it2me_native_messaging_host.h" | 5 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // contain a single response from the first good request. | 185 // contain a single response from the first good request. |
| 186 void TestBadRequest(const base::Value& message, bool expect_error_response); | 186 void TestBadRequest(const base::Value& message, bool expect_error_response); |
| 187 void TestConnect(); | 187 void TestConnect(); |
| 188 | 188 |
| 189 private: | 189 private: |
| 190 void StartHost(); | 190 void StartHost(); |
| 191 void StopHost(); | 191 void StopHost(); |
| 192 void ExitTest(); | 192 void ExitTest(); |
| 193 | 193 |
| 194 // Each test creates two unidirectional pipes: "input" and "output". | 194 // Each test creates two unidirectional pipes: "input" and "output". |
| 195 // NativeMessagingHost reads from input_read_handle and writes to | 195 // It2MeNativeMessagingHost reads from input_read_handle and writes to |
| 196 // output_write_handle. The unittest supplies data to input_write_handle, and | 196 // output_write_handle. The unittest supplies data to input_write_handle, and |
| 197 // verifies output from output_read_handle. | 197 // verifies output from output_read_handle. |
| 198 // | 198 // |
| 199 // unittest -> [input] -> NativeMessagingHost -> [output] -> unittest | 199 // unittest -> [input] -> It2MeNativeMessagingHost -> [output] -> unittest |
| 200 base::PlatformFile input_write_handle_; | 200 base::PlatformFile input_write_handle_; |
| 201 base::PlatformFile output_read_handle_; | 201 base::PlatformFile output_read_handle_; |
| 202 | 202 |
| 203 // Message loop of the test thread. | 203 // Message loop of the test thread. |
| 204 scoped_ptr<base::MessageLoop> test_message_loop_; | 204 scoped_ptr<base::MessageLoop> test_message_loop_; |
| 205 scoped_ptr<base::RunLoop> test_run_loop_; | 205 scoped_ptr<base::RunLoop> test_run_loop_; |
| 206 | 206 |
| 207 scoped_ptr<base::Thread> host_thread_; | 207 scoped_ptr<base::Thread> host_thread_; |
| 208 scoped_ptr<base::RunLoop> host_run_loop_; | 208 scoped_ptr<base::RunLoop> host_run_loop_; |
| 209 | 209 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 } | 545 } |
| 546 | 546 |
| 547 // Verify rejection if type is unrecognized. | 547 // Verify rejection if type is unrecognized. |
| 548 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { | 548 TEST_F(It2MeNativeMessagingHostTest, InvalidType) { |
| 549 base::DictionaryValue message; | 549 base::DictionaryValue message; |
| 550 message.SetString("type", "xxx"); | 550 message.SetString("type", "xxx"); |
| 551 TestBadRequest(message, true); | 551 TestBadRequest(message, true); |
| 552 } | 552 } |
| 553 | 553 |
| 554 } // namespace remoting | 554 } // namespace remoting |
| OLD | NEW |