Webview should only allow resources loading from the extension that embedded it.
[chromium-blink-merge.git] / chrome / common / extensions / value_counter_unittest.cc
blob1fc0a9b966ef97e482beb7018d7df6fded49f649
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.
5 #include "base/memory/scoped_ptr.h"
6 #include "base/values.h"
7 #include "extensions/common/value_counter.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 class ValueCounterUnittest : public testing::Test {
13 TEST_F(ValueCounterUnittest, TestAddingSameValue) {
14 extensions::ValueCounter vc;
15 base::ListValue value;
16 ASSERT_EQ(1, vc.Add(value));
17 ASSERT_EQ(2, vc.Add(value));
20 TEST_F(ValueCounterUnittest, TestAddingDifferentValue) {
21 extensions::ValueCounter vc;
22 base::ListValue value1;
23 base::DictionaryValue value2;
24 ASSERT_EQ(1, vc.Add(value1));
25 ASSERT_EQ(1, vc.Add(value2));
28 TEST_F(ValueCounterUnittest, TestRemovingValue) {
29 extensions::ValueCounter vc;
30 base::ListValue value;
31 ASSERT_EQ(1, vc.Add(value));
32 ASSERT_EQ(2, vc.Add(value));
33 ASSERT_EQ(1, vc.Remove(value));
34 ASSERT_EQ(0, vc.Remove(value));
37 TEST_F(ValueCounterUnittest, TestAddIfMissing) {
38 extensions::ValueCounter vc;
39 base::ListValue value;
40 ASSERT_EQ(1, vc.AddIfMissing(value));
41 ASSERT_EQ(1, vc.AddIfMissing(value));