OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/values.h" |
| 7 #include "chrome/common/extensions/value_set.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 class ValueSetUnittest : public testing::Test { |
| 11 }; |
| 12 |
| 13 TEST_F(ValueSetUnittest, TestAddingSameValue) { |
| 14 extensions::ValueSet vs; |
| 15 scoped_ptr<base::Value> value(new ListValue()); |
| 16 ASSERT_EQ(1, vs.Add(value.get())); |
| 17 ASSERT_EQ(2, vs.Add(value.get())); |
| 18 } |
| 19 |
| 20 TEST_F(ValueSetUnittest, TestAddingDifferentValue) { |
| 21 extensions::ValueSet vs; |
| 22 scoped_ptr<base::Value> value1(new ListValue()); |
| 23 scoped_ptr<base::Value> value2(new DictionaryValue()); |
| 24 ASSERT_EQ(1, vs.Add(value1.get())); |
| 25 ASSERT_EQ(1, vs.Add(value2.get())); |
| 26 } |
| 27 |
| 28 TEST_F(ValueSetUnittest, TestRemovingValue) { |
| 29 extensions::ValueSet vs; |
| 30 scoped_ptr<base::Value> value(new ListValue()); |
| 31 ASSERT_EQ(1, vs.Add(value.get())); |
| 32 ASSERT_EQ(2, vs.Add(value.get())); |
| 33 ASSERT_EQ(1, vs.Remove(value.get())); |
| 34 ASSERT_EQ(0, vs.Remove(value.get())); |
| 35 } |
| 36 |
OLD | NEW |