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