| 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/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 base::PLATFORM_FILE_ASYNC, | 55 base::PLATFORM_FILE_ASYNC, |
| 56 NULL, NULL); | 56 NULL, NULL); |
| 57 write_file_ = base::CreatePlatformFile( | 57 write_file_ = base::CreatePlatformFile( |
| 58 write_file, | 58 write_file, |
| 59 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE | | 59 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE | |
| 60 base::PLATFORM_FILE_ASYNC, | 60 base::PLATFORM_FILE_ASYNC, |
| 61 NULL, NULL); | 61 NULL, NULL); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void Launch(const std::string& native_host_name, | 64 virtual void Launch(const std::string& native_host_name, |
| 65 LaunchedCallback callback) const { | 65 LaunchedCallback callback) const OVERRIDE { |
| 66 callback.Run(base::GetCurrentProcessHandle(), read_file_, write_file_); | 66 callback.Run(base::GetCurrentProcessHandle(), read_file_, write_file_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 base::PlatformFile read_file_; | 70 base::PlatformFile read_file_; |
| 71 base::PlatformFile write_file_; | 71 base::PlatformFile write_file_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class NativeMessagingTest : public ::testing::Test, | 74 class NativeMessagingTest : public ::testing::Test, |
| 75 public NativeMessageProcessHost::Client, | 75 public NativeMessageProcessHost::Client, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 read_message_run_loop_.Run(); | 201 read_message_run_loop_.Run(); |
| 202 EXPECT_EQ("{\"id\": 1, \"echo\": {\"text\": \"Hello.\"}}", | 202 EXPECT_EQ("{\"id\": 1, \"echo\": {\"text\": \"Hello.\"}}", |
| 203 last_posted_message_); | 203 last_posted_message_); |
| 204 | 204 |
| 205 native_message_process_host_->Send("{\"foo\": \"bar\"}"); | 205 native_message_process_host_->Send("{\"foo\": \"bar\"}"); |
| 206 read_message_run_loop_.Run(); | 206 read_message_run_loop_.Run(); |
| 207 EXPECT_EQ("{\"id\": 2, \"echo\": {\"foo\": \"bar\"}}", last_posted_message_); | 207 EXPECT_EQ("{\"id\": 2, \"echo\": {\"foo\": \"bar\"}}", last_posted_message_); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace extensions | 210 } // namespace extensions |
| OLD | NEW |