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::kNullProcessHandle, | 85 base::Process(), read_file_.Pass(), write_file_.Pass()); |
86 read_file_.Pass(), write_file_.Pass()); | |
87 } | 86 } |
88 | 87 |
89 private: | 88 private: |
90 mutable base::File read_file_; | 89 mutable base::File read_file_; |
91 mutable base::File write_file_; | 90 mutable base::File write_file_; |
92 }; | 91 }; |
93 | 92 |
94 class NativeMessagingTest : public ::testing::Test, | 93 class NativeMessagingTest : public ::testing::Test, |
95 public NativeMessageHost::Client, | 94 public NativeMessageHost::Client, |
96 public base::SupportsWeakPtr<NativeMessagingTest> { | 95 public base::SupportsWeakPtr<NativeMessagingTest> { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 native_message_host_->Start(this); | 325 native_message_host_->Start(this); |
327 ASSERT_TRUE(native_message_host_.get()); | 326 ASSERT_TRUE(native_message_host_.get()); |
328 run_loop_.reset(new base::RunLoop()); | 327 run_loop_.reset(new base::RunLoop()); |
329 run_loop_->Run(); | 328 run_loop_->Run(); |
330 | 329 |
331 // The host should fail to start. | 330 // The host should fail to start. |
332 ASSERT_TRUE(channel_closed_); | 331 ASSERT_TRUE(channel_closed_); |
333 } | 332 } |
334 | 333 |
335 } // namespace extensions | 334 } // namespace extensions |
OLD | NEW |