summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-03 02:28:55 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-03 02:28:55 +0000
commit8ab4809b6621f24f84bd462f830210967d9e0bd5 (patch)
tree2cae77dfc972987c6e28b898fdac005ab81d4462
parentfd4e05e8f122771e8d6dc1332d22e63b17812d4f (diff)
downloadchromium_src-8ab4809b6621f24f84bd462f830210967d9e0bd5.zip
chromium_src-8ab4809b6621f24f84bd462f830210967d9e0bd5.tar.gz
chromium_src-8ab4809b6621f24f84bd462f830210967d9e0bd5.tar.bz2
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
-rw-r--r--base/values_unittest.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 2931dd7..5253eca 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -1,4 +1,4 @@
-// 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
// found in the LICENSE file.
@@ -149,7 +149,7 @@ TEST(ValuesTest, StringValue) {
// 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.
class DeletionTestValue : public Value {
-public:
+ public:
DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) {
Init(deletion_flag); // Separate function so that we can use ASSERT_*
}
@@ -164,7 +164,7 @@ public:
*deletion_flag_ = true;
}
-private:
+ private:
bool* deletion_flag_;
};
@@ -312,10 +312,10 @@ TEST(ValuesTest, DeepCopy) {
original_list->Append(original_list_element_1);
original_dict.Set(L"list", original_list);
- DictionaryValue* copy_dict =
- static_cast<DictionaryValue*>(original_dict.DeepCopy());
- ASSERT_TRUE(copy_dict);
- ASSERT_NE(copy_dict, &original_dict);
+ scoped_ptr<DictionaryValue> copy_dict(
+ static_cast<DictionaryValue*>(original_dict.DeepCopy()));
+ ASSERT_TRUE(copy_dict.get());
+ ASSERT_NE(copy_dict.get(), &original_dict);
Value* copy_null = NULL;
ASSERT_TRUE(copy_dict->Get(L"null", &copy_null));
@@ -408,8 +408,6 @@ TEST(ValuesTest, DeepCopy) {
int 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);
-
- delete copy_dict;
}
TEST(ValuesTest, Equals) {