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

Side by Side Diff: ipc/ipc_message_utils_unittest.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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') | media/base/video_frame_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_utils.h" 5 #include "ipc/ipc_message_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/unguessable_token.h" 14 #include "base/unguessable_token.h"
14 #include "ipc/ipc_channel_handle.h" 15 #include "ipc/ipc_channel_handle.h"
15 #include "ipc/ipc_message.h" 16 #include "ipc/ipc_message.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace IPC { 19 namespace IPC {
19 namespace { 20 namespace {
20 21
21 // Tests nesting of messages as parameters to other messages. 22 // Tests nesting of messages as parameters to other messages.
22 TEST(IPCMessageUtilsTest, NestedMessages) { 23 TEST(IPCMessageUtilsTest, NestedMessages) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 for (size_t i = 0; i < 2 * stack_capacity; i++) 94 for (size_t i = 0; i < 2 * stack_capacity; i++)
94 EXPECT_EQ(stack_vector[i], output[i]); 95 EXPECT_EQ(stack_vector[i], output[i]);
95 } 96 }
96 97
97 // Tests that PickleSizer and Pickle agree on the size of a complex base::Value. 98 // Tests that PickleSizer and Pickle agree on the size of a complex base::Value.
98 TEST(IPCMessageUtilsTest, ValueSize) { 99 TEST(IPCMessageUtilsTest, ValueSize) {
99 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue); 100 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue);
100 value->SetWithoutPathExpansion("foo", new base::Value(42)); 101 value->SetWithoutPathExpansion("foo", new base::Value(42));
101 value->SetWithoutPathExpansion("bar", new base::Value(3.14)); 102 value->SetWithoutPathExpansion("bar", new base::Value(3.14));
102 value->SetWithoutPathExpansion("baz", new base::Value("hello")); 103 value->SetWithoutPathExpansion("baz", new base::Value("hello"));
103 value->SetWithoutPathExpansion("qux", base::Value::CreateNullValue()); 104 value->SetWithoutPathExpansion("qux", base::MakeUnique<base::Value>());
104 105
105 std::unique_ptr<base::DictionaryValue> nested_dict(new base::DictionaryValue); 106 std::unique_ptr<base::DictionaryValue> nested_dict(new base::DictionaryValue);
106 nested_dict->SetWithoutPathExpansion("foobar", new base::Value(5)); 107 nested_dict->SetWithoutPathExpansion("foobar", new base::Value(5));
107 value->SetWithoutPathExpansion("nested", std::move(nested_dict)); 108 value->SetWithoutPathExpansion("nested", std::move(nested_dict));
108 109
109 std::unique_ptr<base::ListValue> list_value(new base::ListValue); 110 std::unique_ptr<base::ListValue> list_value(new base::ListValue);
110 list_value->AppendString("im a string"); 111 list_value->AppendString("im a string");
111 list_value->AppendString("im another string"); 112 list_value->AppendString("im another string");
112 value->SetWithoutPathExpansion("awesome-list", std::move(list_value)); 113 value->SetWithoutPathExpansion("awesome-list", std::move(list_value));
113 114
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 EXPECT_EQ(token.ToString(), log); 210 EXPECT_EQ(token.ToString(), log);
210 211
211 base::UnguessableToken deserialized_token; 212 base::UnguessableToken deserialized_token;
212 base::PickleIterator iter(pickle); 213 base::PickleIterator iter(pickle);
213 EXPECT_TRUE(IPC::ReadParam(&pickle, &iter, &deserialized_token)); 214 EXPECT_TRUE(IPC::ReadParam(&pickle, &iter, &deserialized_token));
214 EXPECT_EQ(token, deserialized_token); 215 EXPECT_EQ(token, deserialized_token);
215 } 216 }
216 217
217 } // namespace 218 } // namespace
218 } // namespace IPC 219 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | media/base/video_frame_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698