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

Side by Side Diff: tools/json_schema_compiler/test/functions_on_types_unittest.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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 "tools/json_schema_compiler/test/functions_on_types.h"
6
7 #include <utility>
8
5 #include "base/values.h" 9 #include "base/values.h"
6 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
7 #include "tools/json_schema_compiler/test/functions_on_types.h"
8 11
9 using namespace test::api::functions_on_types; 12 using namespace test::api::functions_on_types;
10 13
11 TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) { 14 TEST(JsonSchemaCompilerFunctionsOnTypesTest, StorageAreaGetParamsCreate) {
12 { 15 {
13 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 16 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
14 std::unique_ptr<StorageArea::Get::Params> params( 17 std::unique_ptr<StorageArea::Get::Params> params(
15 StorageArea::Get::Params::Create(*params_value)); 18 StorageArea::Get::Params::Create(*params_value));
16 ASSERT_TRUE(params); 19 ASSERT_TRUE(params);
17 EXPECT_FALSE(params->keys); 20 EXPECT_FALSE(params->keys);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 base::DictionaryValue* item_result = NULL; 60 base::DictionaryValue* item_result = NULL;
58 ASSERT_TRUE(results->GetDictionary(0, &item_result)); 61 ASSERT_TRUE(results->GetDictionary(0, &item_result));
59 EXPECT_TRUE(item_result->Equals(&items.additional_properties)); 62 EXPECT_TRUE(item_result->Equals(&items.additional_properties));
60 } 63 }
61 64
62 TEST(JsonSchemaCompilerFunctionsOnTypesTest, ChromeSettingGetParamsCreate) { 65 TEST(JsonSchemaCompilerFunctionsOnTypesTest, ChromeSettingGetParamsCreate) {
63 std::unique_ptr<base::DictionaryValue> details_value( 66 std::unique_ptr<base::DictionaryValue> details_value(
64 new base::DictionaryValue()); 67 new base::DictionaryValue());
65 details_value->SetBoolean("incognito", true); 68 details_value->SetBoolean("incognito", true);
66 std::unique_ptr<base::ListValue> params_value(new base::ListValue()); 69 std::unique_ptr<base::ListValue> params_value(new base::ListValue());
67 params_value->Append(details_value.release()); 70 params_value->Append(std::move(details_value));
68 std::unique_ptr<ChromeSetting::Get::Params> params( 71 std::unique_ptr<ChromeSetting::Get::Params> params(
69 ChromeSetting::Get::Params::Create(*params_value)); 72 ChromeSetting::Get::Params::Create(*params_value));
70 EXPECT_TRUE(params.get()); 73 EXPECT_TRUE(params.get());
71 EXPECT_TRUE(*params->details.incognito); 74 EXPECT_TRUE(*params->details.incognito);
72 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698