| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/location.h" | 8 #include "base/location.h" | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 25 | 25 | 
| 26 const uint32_t kSizeOfOptions = | 26 const uint32_t kSizeOfOptions = | 
| 27     static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)); | 27     static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)); | 
| 28 | 28 | 
| 29 // In various places, we have to poll (since, e.g., we can't yet wait for a | 29 // In various places, we have to poll (since, e.g., we can't yet wait for a | 
| 30 // certain amount of data to be available). This is the maximum number of | 30 // certain amount of data to be available). This is the maximum number of | 
| 31 // iterations (separated by a short sleep). | 31 // iterations (separated by a short sleep). | 
| 32 // TODO(vtl): Get rid of this. | 32 // TODO(vtl): Get rid of this. | 
| 33 const size_t kMaxPoll = 100; | 33 const size_t kMaxPoll = 100; | 
| 34 | 34 | 
| 35 class DataPipeTest : public test::MojoSystemTest { | 35 class DataPipeTest : public testing::Test { | 
| 36  public: | 36  public: | 
| 37   DataPipeTest() : producer_(MOJO_HANDLE_INVALID), | 37   DataPipeTest() : producer_(MOJO_HANDLE_INVALID), | 
| 38                    consumer_(MOJO_HANDLE_INVALID) {} | 38                    consumer_(MOJO_HANDLE_INVALID) {} | 
| 39 | 39 | 
| 40   ~DataPipeTest() override { | 40   ~DataPipeTest() override { | 
| 41     if (producer_ != MOJO_HANDLE_INVALID) | 41     if (producer_ != MOJO_HANDLE_INVALID) | 
| 42       CHECK_EQ(MOJO_RESULT_OK, MojoClose(producer_)); | 42       CHECK_EQ(MOJO_RESULT_OK, MojoClose(producer_)); | 
| 43     if (consumer_ != MOJO_HANDLE_INVALID) | 43     if (consumer_ != MOJO_HANDLE_INVALID) | 
| 44       CHECK_EQ(MOJO_RESULT_OK, MojoClose(consumer_)); | 44       CHECK_EQ(MOJO_RESULT_OK, MojoClose(consumer_)); | 
| 45   } | 45   } | 
| (...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1621   ASSERT_EQ(sizeof(read_data), num_bytes); | 1621   ASSERT_EQ(sizeof(read_data), num_bytes); | 
| 1622   ASSERT_EQ(data, read_data); | 1622   ASSERT_EQ(data, read_data); | 
| 1623 | 1623 | 
| 1624   ASSERT_EQ(MOJO_RESULT_OK, MojoClose(pipe0)); | 1624   ASSERT_EQ(MOJO_RESULT_OK, MojoClose(pipe0)); | 
| 1625   ASSERT_EQ(MOJO_RESULT_OK, MojoClose(pipe1)); | 1625   ASSERT_EQ(MOJO_RESULT_OK, MojoClose(pipe1)); | 
| 1626 } | 1626 } | 
| 1627 | 1627 | 
| 1628 }  // namespace | 1628 }  // namespace | 
| 1629 }  // namespace edk | 1629 }  // namespace edk | 
| 1630 }  // namespace mojo | 1630 }  // namespace mojo | 
| OLD | NEW | 
|---|