| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ipc/mojo/ipc_mojo_bootstrap.h" | 5 #include "ipc/mojo/ipc_mojo_bootstrap.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ipc/ipc_test_base.h" | 10 #include "ipc/ipc_test_base.h" |
| 11 | 11 |
| 12 #if defined(OS_POSIX) | 12 #if defined(OS_POSIX) |
| 13 #include "base/file_descriptor_posix.h" | 13 #include "base/file_descriptor_posix.h" |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class IPCMojoBootstrapTest : public IPCTestBase { | 18 class IPCMojoBootstrapTest : public IPCTestBase { |
| 19 protected: | 19 protected: |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 class TestingDelegate : public IPC::MojoBootstrap::Delegate { | 22 class TestingDelegate : public IPC::MojoBootstrap::Delegate { |
| 23 public: | 23 public: |
| 24 TestingDelegate() : passed_(false) {} | 24 TestingDelegate() : passed_(false) {} |
| 25 | 25 |
| 26 void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override; | 26 void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle, |
| 27 int32 peer_pid) override; |
| 27 void OnBootstrapError() override; | 28 void OnBootstrapError() override; |
| 28 | 29 |
| 29 bool passed() const { return passed_; } | 30 bool passed() const { return passed_; } |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 bool passed_; | 33 bool passed_; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 void TestingDelegate::OnPipeAvailable( | 36 void TestingDelegate::OnPipeAvailable( |
| 36 mojo::embedder::ScopedPlatformHandle handle) { | 37 mojo::embedder::ScopedPlatformHandle handle, |
| 38 int32 peer_pid) { |
| 37 passed_ = true; | 39 passed_ = true; |
| 38 base::MessageLoop::current()->Quit(); | 40 base::MessageLoop::current()->Quit(); |
| 39 } | 41 } |
| 40 | 42 |
| 41 void TestingDelegate::OnBootstrapError() { | 43 void TestingDelegate::OnBootstrapError() { |
| 42 base::MessageLoop::current()->Quit(); | 44 base::MessageLoop::current()->Quit(); |
| 43 } | 45 } |
| 44 | 46 |
| 45 // Times out on Android; see http://crbug.com/502290 | 47 // Times out on Android; see http://crbug.com/502290 |
| 46 #if defined(OS_ANDROID) | 48 #if defined(OS_ANDROID) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bootstrap->Connect(); | 82 bootstrap->Connect(); |
| 81 | 83 |
| 82 base::MessageLoop::current()->Run(); | 84 base::MessageLoop::current()->Run(); |
| 83 | 85 |
| 84 EXPECT_TRUE(delegate.passed()); | 86 EXPECT_TRUE(delegate.passed()); |
| 85 | 87 |
| 86 return 0; | 88 return 0; |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace | 91 } // namespace |
| OLD | NEW |