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

Side by Side Diff: ipc/ipc_message_unittest.cc

Issue 11865015: Move IPC tests into anonymous namespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_utils_unittest.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.h" 5 #include "ipc/ipc_message.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/values.h" 10 #include "base/values.h"
11 #include "ipc/ipc_message_utils.h" 11 #include "ipc/ipc_message_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace {
15
14 TEST(IPCMessageTest, ListValue) { 16 TEST(IPCMessageTest, ListValue) {
15 ListValue input; 17 ListValue input;
16 input.Set(0, Value::CreateDoubleValue(42.42)); 18 input.Set(0, Value::CreateDoubleValue(42.42));
17 input.Set(1, Value::CreateStringValue("forty")); 19 input.Set(1, Value::CreateStringValue("forty"));
18 input.Set(2, Value::CreateNullValue()); 20 input.Set(2, Value::CreateNullValue());
19 21
20 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); 22 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
21 IPC::WriteParam(&msg, input); 23 IPC::WriteParam(&msg, input);
22 24
23 ListValue output; 25 ListValue output;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); 62 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output));
61 63
62 EXPECT_TRUE(input.Equals(&output)); 64 EXPECT_TRUE(input.Equals(&output));
63 65
64 // Also test the corrupt case. 66 // Also test the corrupt case.
65 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); 67 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL);
66 bad_msg.WriteInt(99); 68 bad_msg.WriteInt(99);
67 iter = PickleIterator(bad_msg); 69 iter = PickleIterator(bad_msg);
68 EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output)); 70 EXPECT_FALSE(IPC::ReadParam(&bad_msg, &iter, &output));
69 } 71 }
72
73 } // namespace
OLDNEW
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698