| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "wtf/LinkedHashSet.h" | 28 #include "wtf/LinkedHashSet.h" |
| 29 #include "wtf/ListHashSet.h" | 29 #include "wtf/ListHashSet.h" |
| 30 #include "wtf/PassRefPtr.h" | 30 #include "wtf/PassRefPtr.h" |
| 31 #include "wtf/RefCounted.h" | 31 #include "wtf/RefCounted.h" |
| 32 #include "wtf/RefPtr.h" | 32 #include "wtf/RefPtr.h" |
| 33 #include <gtest/gtest.h> | 33 #include <gtest/gtest.h> |
| 34 | 34 |
| 35 namespace WTF { |
| 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 template<typename Set> | 39 template<typename Set> |
| 38 void removeFirstHelper() | 40 void removeFirstHelper() |
| 39 { | 41 { |
| 40 Set list; | 42 Set list; |
| 41 list.add(-1); | 43 list.add(-1); |
| 42 list.add(0); | 44 list.add(0); |
| 43 list.add(1); | 45 list.add(1); |
| 44 list.add(2); | 46 list.add(2); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 { | 239 { |
| 238 prependOrMoveToLastWithDuplicates<ListHashSet<int>>(); | 240 prependOrMoveToLastWithDuplicates<ListHashSet<int>>(); |
| 239 prependOrMoveToLastWithDuplicates<ListHashSet<int, 1>>(); | 241 prependOrMoveToLastWithDuplicates<ListHashSet<int, 1>>(); |
| 240 } | 242 } |
| 241 | 243 |
| 242 TEST(LinkedHashSetTest, PrependOrMoveToLastWithDuplicates) | 244 TEST(LinkedHashSetTest, PrependOrMoveToLastWithDuplicates) |
| 243 { | 245 { |
| 244 prependOrMoveToLastWithDuplicates<LinkedHashSet<int>>(); | 246 prependOrMoveToLastWithDuplicates<LinkedHashSet<int>>(); |
| 245 } | 247 } |
| 246 | 248 |
| 247 class DummyRefCounted: public WTF::RefCounted<DummyRefCounted> { | 249 class DummyRefCounted : public RefCounted<DummyRefCounted> { |
| 248 public: | 250 public: |
| 249 DummyRefCounted(bool& isDeleted) : m_isDeleted(isDeleted) { m_isDeleted = fa
lse; } | 251 DummyRefCounted(bool& isDeleted) : m_isDeleted(isDeleted) { m_isDeleted = fa
lse; } |
| 250 ~DummyRefCounted() { m_isDeleted = true; } | 252 ~DummyRefCounted() { m_isDeleted = true; } |
| 251 void ref() | 253 void ref() |
| 252 { | 254 { |
| 253 WTF::RefCounted<DummyRefCounted>::ref(); | 255 WTF::RefCounted<DummyRefCounted>::ref(); |
| 254 ++m_refInvokesCount; | 256 ++m_refInvokesCount; |
| 255 } | 257 } |
| 256 | 258 |
| 257 static int m_refInvokesCount; | 259 static int m_refInvokesCount; |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 TEST(ListHashSetTest, Swap) | 713 TEST(ListHashSetTest, Swap) |
| 712 { | 714 { |
| 713 swapTestHelper<ListHashSet<int>>(); | 715 swapTestHelper<ListHashSet<int>>(); |
| 714 } | 716 } |
| 715 | 717 |
| 716 TEST(LinkedHashSetTest, Swap) | 718 TEST(LinkedHashSetTest, Swap) |
| 717 { | 719 { |
| 718 swapTestHelper<LinkedHashSet<int>>(); | 720 swapTestHelper<LinkedHashSet<int>>(); |
| 719 } | 721 } |
| 720 | 722 |
| 721 } // namespace | 723 } // anonymous namespace |
| 724 |
| 725 } // namespace WTF |
| OLD | NEW |