| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 EXPECT_EQ(1, vector[0]->get()); | 199 EXPECT_EQ(1, vector[0]->get()); |
| 200 EXPECT_EQ(1u, vector.size()); | 200 EXPECT_EQ(1u, vector.size()); |
| 201 EXPECT_EQ(1, destructNumber); | 201 EXPECT_EQ(1, destructNumber); |
| 202 | 202 |
| 203 OwnPtr<DestructCounter> ownCounter1 = std::move(vector[0]); | 203 OwnPtr<DestructCounter> ownCounter1 = std::move(vector[0]); |
| 204 vector.remove(0); | 204 vector.remove(0); |
| 205 ASSERT_EQ(counter1, ownCounter1->get()); | 205 ASSERT_EQ(counter1, ownCounter1->get()); |
| 206 ASSERT_EQ(0u, vector.size()); | 206 ASSERT_EQ(0u, vector.size()); |
| 207 ASSERT_EQ(1, destructNumber); | 207 ASSERT_EQ(1, destructNumber); |
| 208 | 208 |
| 209 ownCounter1.clear(); | 209 ownCounter1.reset(); |
| 210 EXPECT_EQ(2, destructNumber); | 210 EXPECT_EQ(2, destructNumber); |
| 211 | 211 |
| 212 size_t count = 1025; | 212 size_t count = 1025; |
| 213 destructNumber = 0; | 213 destructNumber = 0; |
| 214 for (size_t i = 0; i < count; i++) | 214 for (size_t i = 0; i < count; i++) |
| 215 vector.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); | 215 vector.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); |
| 216 | 216 |
| 217 // Vector relocation must not destruct OwnPtr element. | 217 // Vector relocation must not destruct OwnPtr element. |
| 218 EXPECT_EQ(0, destructNumber); | 218 EXPECT_EQ(0, destructNumber); |
| 219 EXPECT_EQ(count, vector.size()); | 219 EXPECT_EQ(count, vector.size()); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 vector3 = {1, 2, 3}; | 685 vector3 = {1, 2, 3}; |
| 686 ASSERT_EQ(3u, vector3.size()); | 686 ASSERT_EQ(3u, vector3.size()); |
| 687 EXPECT_EQ(1, vector3[0]); | 687 EXPECT_EQ(1, vector3[0]); |
| 688 EXPECT_EQ(2, vector3[1]); | 688 EXPECT_EQ(2, vector3[1]); |
| 689 EXPECT_EQ(3, vector3[2]); | 689 EXPECT_EQ(3, vector3[2]); |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // anonymous namespace | 692 } // anonymous namespace |
| 693 | 693 |
| 694 } // namespace WTF | 694 } // namespace WTF |
| OLD | NEW |