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 6491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6502 | 6502 |
6503 EXPECT_EQ(1u, vector2.size()); | 6503 EXPECT_EQ(1u, vector2.size()); |
6504 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables | 6504 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
6505 // Vector<>s with inline capacity, remove. | 6505 // Vector<>s with inline capacity, remove. |
6506 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) | 6506 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
6507 EXPECT_EQ(16u, vector1.capacity()); | 6507 EXPECT_EQ(16u, vector1.capacity()); |
6508 EXPECT_EQ(16u, vector2.capacity()); | 6508 EXPECT_EQ(16u, vector2.capacity()); |
6509 #endif | 6509 #endif |
6510 } | 6510 } |
6511 | 6511 |
6512 TEST(HeapTest, TestStaticLocals) | |
6513 { | |
6514 // Sanity check DEFINE_STATIC_LOCAL()s over heap allocated objects and colle
ctions. | |
6515 | |
6516 DEFINE_STATIC_LOCAL(IntWrapper, intWrapper, (new IntWrapper(33))); | |
6517 DEFINE_STATIC_LOCAL(PersistentHeapVector<Member<IntWrapper>>, persistentHeap
VectorIntWrapper, ()); | |
6518 DEFINE_STATIC_LOCAL(HeapVector<Member<IntWrapper>>, heapVectorIntWrapper, (n
ew HeapVector<Member<IntWrapper>>)); | |
6519 | |
6520 EXPECT_EQ(33, intWrapper.value()); | |
6521 EXPECT_EQ(0u, persistentHeapVectorIntWrapper.size()); | |
6522 EXPECT_EQ(0u, heapVectorIntWrapper.size()); | |
6523 | |
6524 persistentHeapVectorIntWrapper.append(&intWrapper); | |
6525 heapVectorIntWrapper.append(&intWrapper); | |
6526 EXPECT_EQ(1u, persistentHeapVectorIntWrapper.size()); | |
6527 EXPECT_EQ(1u, heapVectorIntWrapper.size()); | |
6528 | |
6529 EXPECT_EQ(persistentHeapVectorIntWrapper[0], heapVectorIntWrapper[0]); | |
6530 EXPECT_EQ(33, heapVectorIntWrapper[0]->value()); | |
6531 } | |
6532 | |
6533 } // namespace blink | 6512 } // namespace blink |
OLD | NEW |