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

Side by Side Diff: chrome/nacl/nacl_ipc_adapter_unittest.cc

Issue 10919023: Add async trace events to trace progress of IPC messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix NaClIPCAdapterTest.SimpleReceiveRewriting Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ipc/ipc_channel_nacl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/nacl/nacl_ipc_adapter.h" 5 #include "chrome/nacl/nacl_ipc_adapter.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 int bytes_read = BlockingReceive(buf, kBufSize); 86 int bytes_read = BlockingReceive(buf, kBufSize);
87 EXPECT_EQ(sizeof(NaClIPCAdapter::NaClMessageHeader) + sizeof(int), 87 EXPECT_EQ(sizeof(NaClIPCAdapter::NaClMessageHeader) + sizeof(int),
88 static_cast<size_t>(bytes_read)); 88 static_cast<size_t>(bytes_read));
89 89
90 const NaClIPCAdapter::NaClMessageHeader* output_header = 90 const NaClIPCAdapter::NaClMessageHeader* output_header =
91 reinterpret_cast<const NaClIPCAdapter::NaClMessageHeader*>(buf); 91 reinterpret_cast<const NaClIPCAdapter::NaClMessageHeader*>(buf);
92 EXPECT_EQ(sizeof(int), output_header->payload_size); 92 EXPECT_EQ(sizeof(int), output_header->payload_size);
93 EXPECT_EQ(routing_id, output_header->routing); 93 EXPECT_EQ(routing_id, output_header->routing);
94 EXPECT_EQ(type, output_header->type); 94 EXPECT_EQ(type, output_header->type);
95 uint32 flags_mask =
96 IPC::Message::PRIORITY_MASK |
Mark Seaborn 2012/09/04 18:39:31 If someone adds a flag (maybe after removing a fla
jbates 2012/09/04 20:02:18 It looks like this test just needs to verify that
97 IPC::Message::SYNC_BIT |
98 IPC::Message::REPLY_BIT |
99 IPC::Message::REPLY_ERROR_BIT |
100 IPC::Message::UNBLOCK_BIT |
101 IPC::Message::PUMPING_MSGS_BIT |
102 IPC::Message::HAS_SENT_TIME_BIT;
95 EXPECT_EQ(static_cast<uint32>(IPC::Message::PRIORITY_NORMAL), 103 EXPECT_EQ(static_cast<uint32>(IPC::Message::PRIORITY_NORMAL),
96 output_header->flags); 104 static_cast<uint32>(output_header->flags & flags_mask));
97 EXPECT_EQ(0u, output_header->num_fds); 105 EXPECT_EQ(0u, output_header->num_fds);
98 EXPECT_EQ(0u, output_header->pad); 106 EXPECT_EQ(0u, output_header->pad);
99 107
100 // Validate the payload. 108 // Validate the payload.
101 EXPECT_EQ(value, 109 EXPECT_EQ(value,
102 *reinterpret_cast<const int*>(&buf[ 110 *reinterpret_cast<const int*>(&buf[
103 sizeof(NaClIPCAdapter::NaClMessageHeader)])); 111 sizeof(NaClIPCAdapter::NaClMessageHeader)]));
104 } 112 }
105 113
106 // Tests a simple message getting rewritten sent from NaCl to native code. 114 // Tests a simple message getting rewritten sent from NaCl to native code.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 EXPECT_EQ(-1, result); 307 EXPECT_EQ(-1, result);
300 308
301 // Test the "previously had an error" case. BlockingReceive should return 309 // Test the "previously had an error" case. BlockingReceive should return
302 // immediately if there was an error. 310 // immediately if there was an error.
303 result = BlockingReceive(buf, kBufSize); 311 result = BlockingReceive(buf, kBufSize);
304 EXPECT_EQ(-1, result); 312 EXPECT_EQ(-1, result);
305 313
306 thread.Join(); 314 thread.Join();
307 } 315 }
308 316
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_channel_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698