OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 { } | 156 { } |
157 | 157 |
158 ~DestructCounter() { ++(*m_destructNumber); } | 158 ~DestructCounter() { ++(*m_destructNumber); } |
159 int get() const { return m_i; } | 159 int get() const { return m_i; } |
160 | 160 |
161 private: | 161 private: |
162 int m_i; | 162 int m_i; |
163 int* m_destructNumber; | 163 int* m_destructNumber; |
164 }; | 164 }; |
165 | 165 |
166 typedef WTF::Deque<OwnPtr<DestructCounter> > OwnPtrDeque; | 166 typedef WTF::Deque<OwnPtr<DestructCounter>> OwnPtrDeque; |
167 | 167 |
168 TEST(DequeTest, OwnPtr) | 168 TEST(DequeTest, OwnPtr) |
169 { | 169 { |
170 int destructNumber = 0; | 170 int destructNumber = 0; |
171 OwnPtrDeque deque; | 171 OwnPtrDeque deque; |
172 deque.append(adoptPtr(new DestructCounter(0, &destructNumber))); | 172 deque.append(adoptPtr(new DestructCounter(0, &destructNumber))); |
173 deque.append(adoptPtr(new DestructCounter(1, &destructNumber))); | 173 deque.append(adoptPtr(new DestructCounter(1, &destructNumber))); |
174 EXPECT_EQ(2u, deque.size()); | 174 EXPECT_EQ(2u, deque.size()); |
175 | 175 |
176 OwnPtr<DestructCounter>& counter0 = deque.first(); | 176 OwnPtr<DestructCounter>& counter0 = deque.first(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 ASSERT_EQ(1u, dequeA.size()); | 308 ASSERT_EQ(1u, dequeA.size()); |
309 EXPECT_EQ(1, dequeA.first().get()); | 309 EXPECT_EQ(1, dequeA.first().get()); |
310 ASSERT_EQ(3u, dequeB.size()); | 310 ASSERT_EQ(3u, dequeB.size()); |
311 EXPECT_EQ(2, dequeB.first().get()); | 311 EXPECT_EQ(2, dequeB.first().get()); |
312 | 312 |
313 dequeB.swap(dequeA); | 313 dequeB.swap(dequeA); |
314 } | 314 } |
315 | 315 |
316 } // namespace | 316 } // namespace |
OLD | NEW |