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

Side by Side Diff: ipc/ipc_message_utils_unittest.cc

Issue 2884933002: Remove raw base::DictionaryValue::SetWithoutPathExpansion (Closed)
Patch Set: Include Created 3 years, 7 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_unittest.cc ('k') | net/http/http_server_properties_manager.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
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::StackVector<double, stack_capacity> output; 91 base::StackVector<double, stack_capacity> output;
92 base::PickleIterator iter(msg); 92 base::PickleIterator iter(msg);
93 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); 93 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output));
94 for (size_t i = 0; i < 2 * stack_capacity; i++) 94 for (size_t i = 0; i < 2 * stack_capacity; i++)
95 EXPECT_EQ(stack_vector[i], output[i]); 95 EXPECT_EQ(stack_vector[i], output[i]);
96 } 96 }
97 97
98 // 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.
99 TEST(IPCMessageUtilsTest, ValueSize) { 99 TEST(IPCMessageUtilsTest, ValueSize) {
100 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue); 100 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue);
101 value->SetWithoutPathExpansion("foo", new base::Value(42)); 101 value->SetIntegerWithoutPathExpansion("foo", 42);
102 value->SetWithoutPathExpansion("bar", new base::Value(3.14)); 102 value->SetDoubleWithoutPathExpansion("bar", 3.14);
103 value->SetWithoutPathExpansion("baz", new base::Value("hello")); 103 value->SetStringWithoutPathExpansion("baz", "hello");
104 value->SetWithoutPathExpansion("qux", base::MakeUnique<base::Value>()); 104 value->SetWithoutPathExpansion("qux", base::MakeUnique<base::Value>());
105 105
106 std::unique_ptr<base::DictionaryValue> nested_dict(new base::DictionaryValue); 106 std::unique_ptr<base::DictionaryValue> nested_dict(new base::DictionaryValue);
107 nested_dict->SetWithoutPathExpansion("foobar", new base::Value(5)); 107 nested_dict->SetIntegerWithoutPathExpansion("foobar", 5);
108 value->SetWithoutPathExpansion("nested", std::move(nested_dict)); 108 value->SetWithoutPathExpansion("nested", std::move(nested_dict));
109 109
110 std::unique_ptr<base::ListValue> list_value(new base::ListValue); 110 std::unique_ptr<base::ListValue> list_value(new base::ListValue);
111 list_value->AppendString("im a string"); 111 list_value->AppendString("im a string");
112 list_value->AppendString("im another string"); 112 list_value->AppendString("im another string");
113 value->SetWithoutPathExpansion("awesome-list", std::move(list_value)); 113 value->SetWithoutPathExpansion("awesome-list", std::move(list_value));
114 114
115 base::Pickle pickle; 115 base::Pickle pickle;
116 IPC::WriteParam(&pickle, *value); 116 IPC::WriteParam(&pickle, *value);
117 117
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 base::PickleIterator iter(pickle); 231 base::PickleIterator iter(pickle);
232 base::flat_map<std::string, int> output; 232 base::flat_map<std::string, int> output;
233 EXPECT_TRUE(IPC::ReadParam(&pickle, &iter, &output)); 233 EXPECT_TRUE(IPC::ReadParam(&pickle, &iter, &output));
234 234
235 EXPECT_EQ(input, output); 235 EXPECT_EQ(input, output);
236 } 236 }
237 237
238 } // namespace 238 } // namespace
239 } // namespace IPC 239 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_message_unittest.cc ('k') | net/http/http_server_properties_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698