OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 explicit DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) { | 168 explicit DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) { |
169 Init(deletion_flag); // Separate function so that we can use ASSERT_* | 169 Init(deletion_flag); // Separate function so that we can use ASSERT_* |
170 } | 170 } |
171 | 171 |
172 void Init(bool* deletion_flag) { | 172 void Init(bool* deletion_flag) { |
173 ASSERT_TRUE(deletion_flag); | 173 ASSERT_TRUE(deletion_flag); |
174 deletion_flag_ = deletion_flag; | 174 deletion_flag_ = deletion_flag; |
175 *deletion_flag_ = false; | 175 *deletion_flag_ = false; |
176 } | 176 } |
177 | 177 |
178 ~DeletionTestValue() { | 178 virtual ~DeletionTestValue() { |
179 *deletion_flag_ = true; | 179 *deletion_flag_ = true; |
180 } | 180 } |
181 | 181 |
182 private: | 182 private: |
183 bool* deletion_flag_; | 183 bool* deletion_flag_; |
184 }; | 184 }; |
185 | 185 |
186 TEST(ValuesTest, ListDeletion) { | 186 TEST(ValuesTest, ListDeletion) { |
187 bool deletion_flag = true; | 187 bool deletion_flag = true; |
188 | 188 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 seen2 = true; | 749 seen2 = true; |
750 } else { | 750 } else { |
751 ADD_FAILURE(); | 751 ADD_FAILURE(); |
752 } | 752 } |
753 } | 753 } |
754 EXPECT_TRUE(seen1); | 754 EXPECT_TRUE(seen1); |
755 EXPECT_TRUE(seen2); | 755 EXPECT_TRUE(seen2); |
756 } | 756 } |
757 | 757 |
758 } // namespace base | 758 } // namespace base |
OLD | NEW |