Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: mojo/edk/system/data_pipe_unittest.cc

Issue 1488853002: Add multiplexing of message pipes in the new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez review comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/edk/system/dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/edk/system/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698