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

Side by Side Diff: base/containers/linked_list_unittest.cc

Issue 240873003: Create WebSocketTransportClientSocketPool (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 6 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/containers/linked_list.h" 6 #include "base/containers/linked_list.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace base { 9 namespace base {
10 namespace { 10 namespace {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 const int expected[] = {1, 4, 2, 3}; 250 const int expected[] = {1, 4, 2, 3};
251 ExpectListContents(list, arraysize(expected), expected); 251 ExpectListContents(list, arraysize(expected), expected);
252 } 252 }
253 } 253 }
254 254
255 TEST(LinkedList, MultipleInheritanceNode) { 255 TEST(LinkedList, MultipleInheritanceNode) {
256 MultipleInheritanceNode node; 256 MultipleInheritanceNode node;
257 EXPECT_EQ(&node, node.value()); 257 EXPECT_EQ(&node, node.value());
258 } 258 }
259 259
260 TEST(LinkedList, EmptyListIsEmpty) {
261 LinkedList<Node> list;
262 EXPECT_TRUE(list.empty());
263 }
264
265 TEST(LinkedList, NonEmptyListIsNotEmpty) {
266 LinkedList<Node> list;
267
268 Node n(1);
269 list.Append(&n);
270
271 EXPECT_FALSE(list.empty());
272 }
273
274 TEST(LinkedList, EmptiedListIsEmptyAgain) {
275 LinkedList<Node> list;
276
277 Node n(1);
278 list.Append(&n);
279 n.RemoveFromList();
280
281 EXPECT_TRUE(list.empty());
282 }
283
284 TEST(LinkedList, NodesCanBeReused) {
285 LinkedList<Node> list1;
286 LinkedList<Node> list2;
287
288 Node n(1);
289 list1.Append(&n);
290 n.RemoveFromList();
291 list2.Append(&n);
292
293 EXPECT_EQ(list2.head()->value(), &n);
294 }
295
296 TEST(LinkedList, RemovedNodeHasNullNextPrevious) {
297 LinkedList<Node> list;
298
299 Node n(1);
300 list.Append(&n);
301 n.RemoveFromList();
302
303 EXPECT_EQ(NULL, n.next());
304 EXPECT_EQ(NULL, n.previous());
305 }
306
260 } // namespace 307 } // namespace
261 } // namespace base 308 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698