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

Unified Diff: base/values_unittest.cc

Issue 149153: Minor Coverity nit: Unit test leaking data if failure occurs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values_unittest.cc
===================================================================
--- base/values_unittest.cc (revision 19850)
+++ base/values_unittest.cc (working copy)
@@ -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 @@
// 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 @@
*deletion_flag_ = true;
}
-private:
+ private:
bool* deletion_flag_;
};
@@ -312,10 +312,10 @@
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 @@
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698