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

Unified Diff: base/json/json_value_converter_unittest.cc

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: base/json/json_value_converter_unittest.cc
diff --git a/base/json/json_value_converter_unittest.cc b/base/json/json_value_converter_unittest.cc
index 56ade24ac3a0089edc81627da799655fc5b47957..6a603d3a92aa5602663f49ecb089527e9e661acf 100644
--- a/base/json/json_value_converter_unittest.cc
+++ b/base/json/json_value_converter_unittest.cc
@@ -9,7 +9,6 @@
#include <vector>
#include "base/json/json_reader.h"
-#include "base/memory/scoped_vector.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,8 +26,8 @@ struct SimpleMessage {
bool baz;
bool bstruct;
SimpleEnum simple_enum;
- ScopedVector<int> ints;
- ScopedVector<std::string> string_values;
+ std::vector<std::unique_ptr<int>> ints;
+ std::vector<std::unique_ptr<std::string>> string_values;
SimpleMessage() : foo(0), baz(false), bstruct(false), simple_enum(FOO) {}
static bool ParseSimpleEnum(const StringPiece& value, SimpleEnum* field) {
@@ -80,7 +79,7 @@ struct SimpleMessage {
struct NestedMessage {
double foo;
SimpleMessage child;
- ScopedVector<SimpleMessage> children;
+ std::vector<std::unique_ptr<SimpleMessage>> children;
NestedMessage() : foo(0) {}
@@ -163,7 +162,7 @@ TEST(JSONValueConverterTest, ParseNestedMessage) {
EXPECT_EQ("value_2", *message.child.string_values[1]);
EXPECT_EQ(2, static_cast<int>(message.children.size()));
- const SimpleMessage* first_child = message.children[0];
+ const SimpleMessage* first_child = message.children[0].get();
ASSERT_TRUE(first_child);
EXPECT_EQ(2, first_child->foo);
EXPECT_EQ("foobar", first_child->bar);
@@ -172,7 +171,7 @@ TEST(JSONValueConverterTest, ParseNestedMessage) {
ASSERT_EQ(1U, first_child->string_values.size());
EXPECT_EQ("value_1", *first_child->string_values[0]);
- const SimpleMessage* second_child = message.children[1];
+ const SimpleMessage* second_child = message.children[1].get();
ASSERT_TRUE(second_child);
EXPECT_EQ(3, second_child->foo);
EXPECT_EQ("barbaz", second_child->bar);

Powered by Google App Engine
This is Rietveld 408576698