| OLD | NEW |
| 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 <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 explicit DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) { | 170 explicit DeletionTestValue(bool* deletion_flag) : Value(TYPE_NULL) { |
| 171 Init(deletion_flag); // Separate function so that we can use ASSERT_* | 171 Init(deletion_flag); // Separate function so that we can use ASSERT_* |
| 172 } | 172 } |
| 173 | 173 |
| 174 void Init(bool* deletion_flag) { | 174 void Init(bool* deletion_flag) { |
| 175 ASSERT_TRUE(deletion_flag); | 175 ASSERT_TRUE(deletion_flag); |
| 176 deletion_flag_ = deletion_flag; | 176 deletion_flag_ = deletion_flag; |
| 177 *deletion_flag_ = false; | 177 *deletion_flag_ = false; |
| 178 } | 178 } |
| 179 | 179 |
| 180 virtual ~DeletionTestValue() { | 180 ~DeletionTestValue() override { *deletion_flag_ = true; } |
| 181 *deletion_flag_ = true; | |
| 182 } | |
| 183 | 181 |
| 184 private: | 182 private: |
| 185 bool* deletion_flag_; | 183 bool* deletion_flag_; |
| 186 }; | 184 }; |
| 187 | 185 |
| 188 TEST(ValuesTest, ListDeletion) { | 186 TEST(ValuesTest, ListDeletion) { |
| 189 bool deletion_flag = true; | 187 bool deletion_flag = true; |
| 190 | 188 |
| 191 { | 189 { |
| 192 ListValue list; | 190 ListValue list; |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 EXPECT_FALSE(main_list.GetList(1, NULL)); | 1086 EXPECT_FALSE(main_list.GetList(1, NULL)); |
| 1089 EXPECT_FALSE(main_list.GetList(2, NULL)); | 1087 EXPECT_FALSE(main_list.GetList(2, NULL)); |
| 1090 EXPECT_FALSE(main_list.GetList(3, NULL)); | 1088 EXPECT_FALSE(main_list.GetList(3, NULL)); |
| 1091 EXPECT_FALSE(main_list.GetList(4, NULL)); | 1089 EXPECT_FALSE(main_list.GetList(4, NULL)); |
| 1092 EXPECT_FALSE(main_list.GetList(5, NULL)); | 1090 EXPECT_FALSE(main_list.GetList(5, NULL)); |
| 1093 EXPECT_TRUE(main_list.GetList(6, NULL)); | 1091 EXPECT_TRUE(main_list.GetList(6, NULL)); |
| 1094 EXPECT_FALSE(main_list.GetList(7, NULL)); | 1092 EXPECT_FALSE(main_list.GetList(7, NULL)); |
| 1095 } | 1093 } |
| 1096 | 1094 |
| 1097 } // namespace base | 1095 } // namespace base |
| OLD | NEW |