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

Side by Side Diff: chrome/common/extensions/value_counter_unittest.cc

Issue 10514013: Filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, reland Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/value_counter.cc ('k') | chrome/renderer/extensions/event_bindings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_counter.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 class ValueCounterUnittest : public testing::Test {
11 };
12
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));
18 }
19
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));
26 }
27
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));
35 }
36
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));
42 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/value_counter.cc ('k') | chrome/renderer/extensions/event_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698