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/files/file.h" | 6 #include "base/files/file.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_file.h" | 9 #include "base/files/scoped_file.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 return scoped_ptr<NativeProcessLauncher>(new FakeLauncher( | 76 return scoped_ptr<NativeProcessLauncher>(new FakeLauncher( |
77 read_pipe.Pass(), | 77 read_pipe.Pass(), |
78 base::File(write_file, write_flags))); | 78 base::File(write_file, write_flags))); |
79 } | 79 } |
80 | 80 |
81 void Launch(const GURL& origin, | 81 void Launch(const GURL& origin, |
82 const std::string& native_host_name, | 82 const std::string& native_host_name, |
83 LaunchedCallback callback) const override { | 83 LaunchedCallback callback) const override { |
84 callback.Run(NativeProcessLauncher::RESULT_SUCCESS, | 84 callback.Run(NativeProcessLauncher::RESULT_SUCCESS, |
85 base::Process(), read_file_.Pass(), write_file_.Pass()); | 85 base::kNullProcessHandle, |
| 86 read_file_.Pass(), write_file_.Pass()); |
86 } | 87 } |
87 | 88 |
88 private: | 89 private: |
89 mutable base::File read_file_; | 90 mutable base::File read_file_; |
90 mutable base::File write_file_; | 91 mutable base::File write_file_; |
91 }; | 92 }; |
92 | 93 |
93 class NativeMessagingTest : public ::testing::Test, | 94 class NativeMessagingTest : public ::testing::Test, |
94 public NativeMessageHost::Client, | 95 public NativeMessageHost::Client, |
95 public base::SupportsWeakPtr<NativeMessagingTest> { | 96 public base::SupportsWeakPtr<NativeMessagingTest> { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 native_message_host_->Start(this); | 326 native_message_host_->Start(this); |
326 ASSERT_TRUE(native_message_host_.get()); | 327 ASSERT_TRUE(native_message_host_.get()); |
327 run_loop_.reset(new base::RunLoop()); | 328 run_loop_.reset(new base::RunLoop()); |
328 run_loop_->Run(); | 329 run_loop_->Run(); |
329 | 330 |
330 // The host should fail to start. | 331 // The host should fail to start. |
331 ASSERT_TRUE(channel_closed_); | 332 ASSERT_TRUE(channel_closed_); |
332 } | 333 } |
333 | 334 |
334 } // namespace extensions | 335 } // namespace extensions |
OLD | NEW |