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