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

Side by Side Diff: chrome/browser/sync/glue/tab_node_pool_unittest.cc

Issue 15055003: Do not submit: high level overview patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build. Created 7 years, 7 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
OLDNEW
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 "chrome/browser/sync/glue/tab_node_pool.h" 5 #include "chrome/browser/sync/glue/tab_node_pool.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace browser_sync { 9 namespace browser_sync {
10 10
11 namespace { 11 namespace {
12 12
13 typedef testing::Test SyncTabNodePoolTest; 13 typedef testing::Test SyncTabNodePoolTest;
14 14
15 TEST_F(SyncTabNodePoolTest, Init) { 15 TEST_F(SyncTabNodePoolTest, Init) {
16 TabNodePool pool(NULL); 16 TabNodePool pool(NULL);
17 pool.set_machine_tag("tag"); 17 pool.set_machine_tag("tag");
18 ASSERT_TRUE(pool.empty()); 18 ASSERT_TRUE(pool.empty());
19 ASSERT_TRUE(pool.full()); 19 ASSERT_TRUE(pool.full());
20 } 20 }
21 21
22 TEST_F(SyncTabNodePoolTest, AddGet) { 22 TEST_F(SyncTabNodePoolTest, AddGet) {
23 TabNodePool pool(NULL); 23 TabNodePool pool(NULL);
24 pool.set_machine_tag("tag"); 24 pool.set_machine_tag("tag");
25 25
26 pool.AddTabNode(5); 26 pool.AddTabNode(5, 0);
27 pool.AddTabNode(10); 27 pool.AddTabNode(10, 1);
28 ASSERT_FALSE(pool.empty()); 28 ASSERT_FALSE(pool.empty());
29 ASSERT_TRUE(pool.full()); 29 ASSERT_TRUE(pool.full());
30 30
31 ASSERT_EQ(2U, pool.capacity()); 31 ASSERT_EQ(2U, pool.capacity());
32 ASSERT_EQ(10, pool.GetFreeTabNode()); // Returns last free tab. 32 ASSERT_EQ(10, pool.GetFreeTabNode()); // Returns last free tab.
33 ASSERT_FALSE(pool.empty()); 33 ASSERT_FALSE(pool.empty());
34 ASSERT_FALSE(pool.full()); 34 ASSERT_FALSE(pool.full());
35 ASSERT_EQ(2U, pool.capacity()); 35 ASSERT_EQ(2U, pool.capacity());
36 ASSERT_EQ(5, pool.GetFreeTabNode()); // Returns last free tab. 36 ASSERT_EQ(5, pool.GetFreeTabNode()); // Returns last free tab.
37 } 37 }
38 38
39 TEST_F(SyncTabNodePoolTest, All) { 39 TEST_F(SyncTabNodePoolTest, All) {
40 TabNodePool pool(NULL); 40 TabNodePool pool(NULL);
41 pool.set_machine_tag("tag"); 41 pool.set_machine_tag("tag");
42 ASSERT_TRUE(pool.empty()); 42 ASSERT_TRUE(pool.empty());
43 ASSERT_TRUE(pool.full()); 43 ASSERT_TRUE(pool.full());
44 ASSERT_EQ(0U, pool.capacity()); 44 ASSERT_EQ(0U, pool.capacity());
45 pool.AddTabNode(5); 45 pool.AddTabNode(5, 0);
46 pool.AddTabNode(10); 46 pool.AddTabNode(10, 1);
47 ASSERT_FALSE(pool.empty()); 47 ASSERT_FALSE(pool.empty());
48 ASSERT_TRUE(pool.full()); 48 ASSERT_TRUE(pool.full());
49 ASSERT_EQ(2U, pool.capacity()); 49 ASSERT_EQ(2U, pool.capacity());
50 ASSERT_EQ(10, pool.GetFreeTabNode()); // Returns last free tab. 50 ASSERT_EQ(10, pool.GetFreeTabNode()); // Returns last free tab.
51 ASSERT_FALSE(pool.empty()); 51 ASSERT_FALSE(pool.empty());
52 ASSERT_FALSE(pool.full()); 52 ASSERT_FALSE(pool.full());
53 ASSERT_EQ(2U, pool.capacity()); 53 ASSERT_EQ(2U, pool.capacity());
54 ASSERT_EQ(5, pool.GetFreeTabNode()); // Returns last free tab. 54 ASSERT_EQ(5, pool.GetFreeTabNode()); // Returns last free tab.
55 ASSERT_TRUE(pool.empty()); 55 ASSERT_TRUE(pool.empty());
56 ASSERT_FALSE(pool.full()); 56 ASSERT_FALSE(pool.full());
(...skipping 23 matching lines...) Expand all
80 ASSERT_EQ(2U, pool.capacity()); 80 ASSERT_EQ(2U, pool.capacity());
81 pool.clear(); 81 pool.clear();
82 ASSERT_TRUE(pool.empty()); 82 ASSERT_TRUE(pool.empty());
83 ASSERT_TRUE(pool.full()); 83 ASSERT_TRUE(pool.full());
84 ASSERT_EQ(0U, pool.capacity()); 84 ASSERT_EQ(0U, pool.capacity());
85 } 85 }
86 86
87 } // namespace 87 } // namespace
88 88
89 } // namespace browser_sync 89 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698