Commit 8ab4809b authored by finnur@chromium.org's avatar finnur@chromium.org

Minor Coverity nit: Unit test leaking data if failure occurs.

BUG=None
TEST=Coverity should stop complaining about this leak.

Review URL: http://codereview.chromium.org/149153

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19886 0039d316-1c4b-4281-b951-d872f2087c98
parent fd4e05e8
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -149,7 +149,7 @@ TEST(ValuesTest, StringValue) { ...@@ -149,7 +149,7 @@ TEST(ValuesTest, StringValue) {
// This is a Value object that allows us to tell if it's been // This is a Value object that allows us to tell if it's been
// properly deleted by modifying the value of external flag on destruction. // properly deleted by modifying the value of external flag on destruction.
class DeletionTestValue : public Value { class DeletionTestValue : public Value {
public: public:
DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) { DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) {
Init(deletion_flag); // Separate function so that we can use ASSERT_* Init(deletion_flag); // Separate function so that we can use ASSERT_*
} }
...@@ -164,7 +164,7 @@ public: ...@@ -164,7 +164,7 @@ public:
*deletion_flag_ = true; *deletion_flag_ = true;
} }
private: private:
bool* deletion_flag_; bool* deletion_flag_;
}; };
...@@ -312,10 +312,10 @@ TEST(ValuesTest, DeepCopy) { ...@@ -312,10 +312,10 @@ TEST(ValuesTest, DeepCopy) {
original_list->Append(original_list_element_1); original_list->Append(original_list_element_1);
original_dict.Set(L"list", original_list); original_dict.Set(L"list", original_list);
DictionaryValue* copy_dict = scoped_ptr<DictionaryValue> copy_dict(
static_cast<DictionaryValue*>(original_dict.DeepCopy()); static_cast<DictionaryValue*>(original_dict.DeepCopy()));
ASSERT_TRUE(copy_dict); ASSERT_TRUE(copy_dict.get());
ASSERT_NE(copy_dict, &original_dict); ASSERT_NE(copy_dict.get(), &original_dict);
Value* copy_null = NULL; Value* copy_null = NULL;
ASSERT_TRUE(copy_dict->Get(L"null", &copy_null)); ASSERT_TRUE(copy_dict->Get(L"null", &copy_null));
...@@ -408,8 +408,6 @@ TEST(ValuesTest, DeepCopy) { ...@@ -408,8 +408,6 @@ TEST(ValuesTest, DeepCopy) {
int copy_list_element_1_value; int copy_list_element_1_value;
ASSERT_TRUE(copy_list_element_1->GetAsInteger(&copy_list_element_1_value)); ASSERT_TRUE(copy_list_element_1->GetAsInteger(&copy_list_element_1_value));
ASSERT_EQ(1, copy_list_element_1_value); ASSERT_EQ(1, copy_list_element_1_value);
delete copy_dict;
} }
TEST(ValuesTest, Equals) { TEST(ValuesTest, Equals) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment