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

Side by Side Diff: ipc/ipc_message_utils_unittest.cc

Issue 1322253003: ipc: Convert int types from basictypes.h to the ones from stdint.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 5 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
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | ipc/ipc_perftest_support.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 "ipc/ipc_message_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include <stdint.h>
8
7 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
8 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
9 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
10 12
11 namespace IPC { 13 namespace IPC {
12 namespace { 14 namespace {
13 15
14 // Tests nesting of messages as parameters to other messages. 16 // Tests nesting of messages as parameters to other messages.
15 TEST(IPCMessageUtilsTest, NestedMessages) { 17 TEST(IPCMessageUtilsTest, NestedMessages) {
16 int32 nested_routing = 12; 18 int32_t nested_routing = 12;
17 uint32 nested_type = 78; 19 uint32_t nested_type = 78;
18 int nested_content = 456789; 20 int nested_content = 456789;
19 Message::PriorityValue nested_priority = Message::PRIORITY_HIGH; 21 Message::PriorityValue nested_priority = Message::PRIORITY_HIGH;
20 Message nested_msg(nested_routing, nested_type, nested_priority); 22 Message nested_msg(nested_routing, nested_type, nested_priority);
21 nested_msg.set_sync(); 23 nested_msg.set_sync();
22 ParamTraits<int>::Write(&nested_msg, nested_content); 24 ParamTraits<int>::Write(&nested_msg, nested_content);
23 25
24 // Outer message contains the nested one as its parameter. 26 // Outer message contains the nested one as its parameter.
25 int32 outer_routing = 91; 27 int32_t outer_routing = 91;
26 uint32 outer_type = 88; 28 uint32_t outer_type = 88;
27 Message::PriorityValue outer_priority = Message::PRIORITY_NORMAL; 29 Message::PriorityValue outer_priority = Message::PRIORITY_NORMAL;
28 Message outer_msg(outer_routing, outer_type, outer_priority); 30 Message outer_msg(outer_routing, outer_type, outer_priority);
29 ParamTraits<Message>::Write(&outer_msg, nested_msg); 31 ParamTraits<Message>::Write(&outer_msg, nested_msg);
30 32
31 // Read back the nested message. 33 // Read back the nested message.
32 base::PickleIterator iter(outer_msg); 34 base::PickleIterator iter(outer_msg);
33 IPC::Message result_msg; 35 IPC::Message result_msg;
34 ASSERT_TRUE(ParamTraits<Message>::Read(&outer_msg, &iter, &result_msg)); 36 ASSERT_TRUE(ParamTraits<Message>::Read(&outer_msg, &iter, &result_msg));
35 37
36 // Verify nested message headers. 38 // Verify nested message headers.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 84
83 base::StackVector<double, stack_capacity> output; 85 base::StackVector<double, stack_capacity> output;
84 base::PickleIterator iter(msg); 86 base::PickleIterator iter(msg);
85 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); 87 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output));
86 for (size_t i = 0; i < 2 * stack_capacity; i++) 88 for (size_t i = 0; i < 2 * stack_capacity; i++)
87 EXPECT_EQ(stack_vector[i], output[i]); 89 EXPECT_EQ(stack_vector[i], output[i]);
88 } 90 }
89 91
90 } // namespace 92 } // namespace
91 } // namespace IPC 93 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | ipc/ipc_perftest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698