OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 6479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6490 | 6490 |
6491 EXPECT_EQ(1u, vector2.size()); | 6491 EXPECT_EQ(1u, vector2.size()); |
6492 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables | 6492 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
6493 // Vector<>s with inline capacity, remove. | 6493 // Vector<>s with inline capacity, remove. |
6494 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) | 6494 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
6495 EXPECT_EQ(16u, vector1.capacity()); | 6495 EXPECT_EQ(16u, vector1.capacity()); |
6496 EXPECT_EQ(16u, vector2.capacity()); | 6496 EXPECT_EQ(16u, vector2.capacity()); |
6497 #endif | 6497 #endif |
6498 } | 6498 } |
6499 | 6499 |
| 6500 TEST(HeapTest, TestStaticLocals) |
| 6501 { |
| 6502 // Sanity check DEFINE_STATIC_LOCAL()s over heap allocated objects and colle
ctions. |
| 6503 |
| 6504 DEFINE_STATIC_LOCAL(IntWrapper, intWrapper, (new IntWrapper(33))); |
| 6505 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<IntWrapper>>, persistentHeap
VectorIntWrapper, ()); |
| 6506 DEFINE_STATIC_LOCAL(HeapVector<Member<IntWrapper>>, heapVectorIntWrapper, (n
ew HeapVector<Member<IntWrapper>>)); |
| 6507 |
| 6508 EXPECT_EQ(33, intWrapper.value()); |
| 6509 EXPECT_EQ(0u, persistentHeapVectorIntWrapper.size()); |
| 6510 EXPECT_EQ(0u, heapVectorIntWrapper.size()); |
| 6511 |
| 6512 persistentHeapVectorIntWrapper.append(&intWrapper); |
| 6513 heapVectorIntWrapper.append(&intWrapper); |
| 6514 EXPECT_EQ(1u, persistentHeapVectorIntWrapper.size()); |
| 6515 EXPECT_EQ(1u, heapVectorIntWrapper.size()); |
| 6516 |
| 6517 EXPECT_EQ(persistentHeapVectorIntWrapper[0], heapVectorIntWrapper[0]); |
| 6518 EXPECT_EQ(33, heapVectorIntWrapper[0]->value()); |
| 6519 } |
| 6520 |
6500 } // namespace blink | 6521 } // namespace blink |
OLD | NEW |