[presubmit] Enable readability/namespace linter checking.
[platform/upstream/v8.git] / test / cctest / heap-tester.h
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef HEAP_TESTER_H_
6 #define HEAP_TESTER_H_
7
8 #include "src/handles.h"
9 #include "src/heap/spaces.h"
10
11 // Tests that should have access to private methods of {v8::internal::Heap}.
12 // Those tests need to be defined using HEAP_TEST(Name) { ... }.
13 #define HEAP_TEST_METHODS(V) \
14   V(GCFlags)                 \
15   V(MarkCompactCollector)    \
16   V(NoPromotion)             \
17   V(NumberStringCacheSize)   \
18   V(ObjectGroups)            \
19   V(Promotion)               \
20   V(Regression39128)         \
21   V(ResetWeakHandle)         \
22   V(StressHandles)           \
23   V(TestSizeOfObjects)       \
24   V(WriteBarriersInCopyJSObject)
25
26
27 #define HEAP_TEST(Name)                                                       \
28   CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \
29                               #Name, NULL, true, true);                       \
30   void v8::internal::HeapTester::Test##Name()
31
32
33 #define THREADED_HEAP_TEST(Name)                                             \
34   RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \
35                                        #Name);                               \
36   /* */ HEAP_TEST(Name)
37
38
39 namespace v8 {
40 namespace internal {
41
42 class HeapTester {
43  public:
44 #define DECLARE_STATIC(Name) static void Test##Name();
45
46   HEAP_TEST_METHODS(DECLARE_STATIC)
47 #undef HEAP_TEST_METHODS
48
49   /* test-alloc.cc */
50   static AllocationResult AllocateAfterFailures();
51   static Handle<Object> TestAllocateAfterFailures();
52
53   /* test-api.cc */
54   static void ResetWeakHandle(bool global_gc);
55 };
56
57 }  // namespace internal
58 }  // namespace v8
59
60 #endif  // HEAP_TESTER_H_