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

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

Issue 852113002: Remove RawChannel::Init() and Channel::Init() failure cases. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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/raw_channel_win.cc » ('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 <vector> 10 #include <vector>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool CheckMessageData(const void* bytes, uint32_t num_bytes) { 52 bool CheckMessageData(const void* bytes, uint32_t num_bytes) {
53 const unsigned char* b = static_cast<const unsigned char*>(bytes); 53 const unsigned char* b = static_cast<const unsigned char*>(bytes);
54 for (uint32_t i = 0; i < num_bytes; i++) { 54 for (uint32_t i = 0; i < num_bytes; i++) {
55 if (b[i] != static_cast<unsigned char>(i + num_bytes)) 55 if (b[i] != static_cast<unsigned char>(i + num_bytes))
56 return false; 56 return false;
57 } 57 }
58 return true; 58 return true;
59 } 59 }
60 60
61 void InitOnIOThread(RawChannel* raw_channel, RawChannel::Delegate* delegate) { 61 void InitOnIOThread(RawChannel* raw_channel, RawChannel::Delegate* delegate) {
62 CHECK(raw_channel->Init(delegate)); 62 raw_channel->Init(delegate);
63 } 63 }
64 64
65 bool WriteTestMessageToHandle(const embedder::PlatformHandle& handle, 65 bool WriteTestMessageToHandle(const embedder::PlatformHandle& handle,
66 uint32_t num_bytes) { 66 uint32_t num_bytes) {
67 scoped_ptr<MessageInTransit> message(MakeTestMessage(num_bytes)); 67 scoped_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
68 68
69 size_t write_size = 0; 69 size_t write_size = 0;
70 mojo::test::BlockingWrite(handle, message->main_buffer(), 70 mojo::test::BlockingWrite(handle, message->main_buffer(),
71 message->main_buffer_size(), &write_size); 71 message->main_buffer_size(), &write_size);
72 return write_size == message->main_buffer_size(); 72 return write_size == message->main_buffer_size();
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 FROM_HERE, 796 FROM_HERE,
797 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_read.get()))); 797 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_read.get())));
798 io_thread()->PostTaskAndWait( 798 io_thread()->PostTaskAndWait(
799 FROM_HERE, 799 FROM_HERE,
800 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_write.get()))); 800 base::Bind(&RawChannel::Shutdown, base::Unretained(rc_write.get())));
801 } 801 }
802 802
803 } // namespace 803 } // namespace
804 } // namespace system 804 } // namespace system
805 } // namespace mojo 805 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel_posix.cc ('k') | mojo/edk/system/raw_channel_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698