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

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

Issue 1426343002: EDK: Move mutex.*, cond_var.*, and thread_annotations.h to //mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: oops Created 5 years, 1 month 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/raw_channel_posix.cc ('k') | mojo/edk/system/shared_buffer_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 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 "mojo/edk/system/raw_channel.h" 5 #include "mojo/edk/system/raw_channel.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "mojo/edk/embedder/platform_channel_pair.h" 16 #include "mojo/edk/embedder/platform_channel_pair.h"
17 #include "mojo/edk/embedder/platform_handle.h" 17 #include "mojo/edk/embedder/platform_handle.h"
18 #include "mojo/edk/embedder/scoped_platform_handle.h" 18 #include "mojo/edk/embedder/scoped_platform_handle.h"
19 #include "mojo/edk/system/message_in_transit.h" 19 #include "mojo/edk/system/message_in_transit.h"
20 #include "mojo/edk/system/mutex.h"
21 #include "mojo/edk/system/test/random.h" 20 #include "mojo/edk/system/test/random.h"
22 #include "mojo/edk/system/test/scoped_test_dir.h" 21 #include "mojo/edk/system/test/scoped_test_dir.h"
23 #include "mojo/edk/system/test/simple_test_thread.h" 22 #include "mojo/edk/system/test/simple_test_thread.h"
24 #include "mojo/edk/system/test/sleep.h" 23 #include "mojo/edk/system/test/sleep.h"
25 #include "mojo/edk/system/test/test_io_thread.h" 24 #include "mojo/edk/system/test/test_io_thread.h"
26 #include "mojo/edk/system/transport_data.h" 25 #include "mojo/edk/system/transport_data.h"
27 #include "mojo/edk/system/waitable_event.h" 26 #include "mojo/edk/system/waitable_event.h"
28 #include "mojo/edk/test/test_utils.h" 27 #include "mojo/edk/test/test_utils.h"
29 #include "mojo/edk/util/make_unique.h" 28 #include "mojo/edk/util/make_unique.h"
29 #include "mojo/edk/util/mutex.h"
30 #include "mojo/edk/util/scoped_file.h" 30 #include "mojo/edk/util/scoped_file.h"
31 #include "mojo/public/cpp/system/macros.h" 31 #include "mojo/public/cpp/system/macros.h"
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 33
34 using mojo::util::Mutex;
35 using mojo::util::MutexLocker;
36
34 namespace mojo { 37 namespace mojo {
35 namespace system { 38 namespace system {
36 namespace { 39 namespace {
37 40
38 std::unique_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) { 41 std::unique_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
39 std::vector<unsigned char> bytes(num_bytes, 0); 42 std::vector<unsigned char> bytes(num_bytes, 0);
40 for (size_t i = 0; i < num_bytes; i++) 43 for (size_t i = 0; i < num_bytes; i++)
41 bytes[i] = static_cast<unsigned char>(i + num_bytes); 44 bytes[i] = static_cast<unsigned char>(i + num_bytes);
42 return util::MakeUnique<MessageInTransit>( 45 return util::MakeUnique<MessageInTransit>(
43 MessageInTransit::Type::ENDPOINT_CLIENT, 46 MessageInTransit::Type::ENDPOINT_CLIENT,
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 818
816 io_thread()->PostTaskAndWait( 819 io_thread()->PostTaskAndWait(
817 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_read.get()))); 820 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_read.get())));
818 io_thread()->PostTaskAndWait( 821 io_thread()->PostTaskAndWait(
819 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_write.get()))); 822 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_write.get())));
820 } 823 }
821 824
822 } // namespace 825 } // namespace
823 } // namespace system 826 } // namespace system
824 } // namespace mojo 827 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel_posix.cc ('k') | mojo/edk/system/shared_buffer_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698