| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/edk/test/mojo_test_base.h" | 5 #include "mojo/edk/test/mojo_test_base.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "mojo/edk/embedder/embedder.h" | 9 #include "mojo/edk/embedder/embedder.h" |
| 10 #include "mojo/edk/system/handle_signals_state.h" | 10 #include "mojo/edk/system/handle_signals_state.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 MojoTestBase::ClientController& MojoTestBase::StartClient( | 24 MojoTestBase::ClientController& MojoTestBase::StartClient( |
| 25 const std::string& client_name) { | 25 const std::string& client_name) { |
| 26 clients_.push_back( | 26 clients_.push_back( |
| 27 make_scoped_ptr(new ClientController(client_name, this))); | 27 make_scoped_ptr(new ClientController(client_name, this))); |
| 28 return *clients_.back(); | 28 return *clients_.back(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 MojoTestBase::ClientController::ClientController(const std::string& client_name, | 31 MojoTestBase::ClientController::ClientController(const std::string& client_name, |
| 32 MojoTestBase* test) | 32 MojoTestBase* test) |
| 33 : test_(test), | 33 : test_(test) |
| 34 pipe_(helper_.StartChild(client_name)) { | 34 #if !defined(OS_IOS) |
| 35 , |
| 36 pipe_(helper_.StartChild(client_name)) |
| 37 #endif |
| 38 { |
| 35 } | 39 } |
| 36 | 40 |
| 37 MojoTestBase::ClientController::~ClientController() { | 41 MojoTestBase::ClientController::~ClientController() { |
| 38 CHECK(was_shutdown_) | 42 CHECK(was_shutdown_) |
| 39 << "Test clients should be waited on explicitly with WaitForShutdown()."; | 43 << "Test clients should be waited on explicitly with WaitForShutdown()."; |
| 40 } | 44 } |
| 41 | 45 |
| 42 int MojoTestBase::ClientController::WaitForShutdown() { | 46 int MojoTestBase::ClientController::WaitForShutdown() { |
| 43 was_shutdown_ = true; | 47 was_shutdown_ = true; |
| 48 #if !defined(OS_IOS) |
| 44 return helper_.WaitForChildShutdown(); | 49 return helper_.WaitForChildShutdown(); |
| 50 #else |
| 51 NOTREACHED(); |
| 52 return 1; |
| 53 #endif |
| 45 } | 54 } |
| 46 | 55 |
| 47 // static | 56 // static |
| 48 void MojoTestBase::CloseHandle(MojoHandle h) { | 57 void MojoTestBase::CloseHandle(MojoHandle h) { |
| 49 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h)); | 58 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h)); |
| 50 } | 59 } |
| 51 | 60 |
| 52 // static | 61 // static |
| 53 void MojoTestBase::CreateMessagePipe(MojoHandle *p0, MojoHandle* p1) { | 62 void MojoTestBase::CreateMessagePipe(MojoHandle *p0, MojoHandle* p1) { |
| 54 MojoCreateMessagePipe(nullptr, p0, p1); | 63 MojoCreateMessagePipe(nullptr, p0, p1); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 EXPECT_EQ(MOJO_RESULT_OK, | 217 EXPECT_EQ(MOJO_RESULT_OK, |
| 209 MojoMapBuffer(h, offset, s.size(), reinterpret_cast<void**>(&data), | 218 MojoMapBuffer(h, offset, s.size(), reinterpret_cast<void**>(&data), |
| 210 MOJO_MAP_BUFFER_FLAG_NONE)); | 219 MOJO_MAP_BUFFER_FLAG_NONE)); |
| 211 EXPECT_EQ(s, base::StringPiece(data, s.size())); | 220 EXPECT_EQ(s, base::StringPiece(data, s.size())); |
| 212 EXPECT_EQ(MOJO_RESULT_OK, MojoUnmapBuffer(static_cast<void*>(data))); | 221 EXPECT_EQ(MOJO_RESULT_OK, MojoUnmapBuffer(static_cast<void*>(data))); |
| 213 } | 222 } |
| 214 | 223 |
| 215 } // namespace test | 224 } // namespace test |
| 216 } // namespace edk | 225 } // namespace edk |
| 217 } // namespace mojo | 226 } // namespace mojo |
| OLD | NEW |