Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
shared_dynamic_string_map_test_base.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc.
16 
17 #ifndef PAGESPEED_KERNEL_SHAREDMEM_SHARED_DYNAMIC_STRING_MAP_TEST_BASE_H_
18 #define PAGESPEED_KERNEL_SHAREDMEM_SHARED_DYNAMIC_STRING_MAP_TEST_BASE_H_
19 
20 #include <vector>
21 
29 
30 namespace net_instaweb {
31 class SharedDynamicStringMap;
32 class ThreadSystem;
33 
34 class SharedDynamicStringMapTestBase : public testing::Test {
35  protected:
36  typedef void (SharedDynamicStringMapTestBase::*TestMethod0)();
37  typedef void (SharedDynamicStringMapTestBase::*TestMethod2)(int, int);
38 
40 
43  bool CreateChild(TestMethod0 method);
44  bool CreateFillChild(TestMethod2 method, int start, int number_of_strings);
45 
47  void TestSimple();
49  void TestCreate();
51  void TestAdd();
54  void TestQuarterFull();
56  void TestFillSingleThread();
64 
65  private:
66  void AddChild();
67  void AddFillChild(int start, int number_of_strings);
68  void AddToFullTable();
69 
71  SharedDynamicStringMap* ChildInit();
73  SharedDynamicStringMap* ParentInit();
74 
75  std::vector<GoogleString> strings_;
76 
78  scoped_ptr<AbstractSharedMem> shmem_runtime_;
79  scoped_ptr<ThreadSystem> thread_system_;
80  MockMessageHandler handler_;
81 
82 
83 };
84 
85 template<typename ConcreteTestEnv>
88  public:
90  : SharedDynamicStringMapTestBase(new ConcreteTestEnv) {
91  }
92 };
93 
94 TYPED_TEST_CASE_P(SharedDynamicStringMapTestTemplate);
95 
96 TYPED_TEST_P(SharedDynamicStringMapTestTemplate, TestSimple) {
98 }
99 
100 TYPED_TEST_P(SharedDynamicStringMapTestTemplate, TestCreate) {
102 }
103 
104 TYPED_TEST_P(SharedDynamicStringMapTestTemplate, TestAdd) {
106 }
107 
108 TYPED_TEST_P(SharedDynamicStringMapTestTemplate, TestQuarterFull) {
110 }
111 
112 TYPED_TEST_P(SharedDynamicStringMapTestTemplate, TestFillSingleThread) {
114 }
115 
116 TYPED_TEST_P(SharedDynamicStringMapTestTemplate,
117  TestFillMultipleNonOverlappingThreads) {
119 }
120 
121 TYPED_TEST_P(SharedDynamicStringMapTestTemplate,
122  TestFillMultipleOverlappingThreads) {
124 }
125 
126 REGISTER_TYPED_TEST_CASE_P(SharedDynamicStringMapTestTemplate, TestSimple,
127  TestCreate, TestAdd, TestQuarterFull,
128  TestFillSingleThread,
129  TestFillMultipleNonOverlappingThreads,
130  TestFillMultipleOverlappingThreads);
131 
132 }
133 
134 #endif
Definition: shared_dynamic_string_map_test_base.h:34
Definition: mock_message_handler.h:39
Definition: scoped_ptr.h:30
Definition: shared_dynamic_string_map.h:46
void TestFillSingleThread()
Test the filling of the string map.
void TestAdd()
Test the creation and use of two child processes.
void TestSimple()
Test simple functionality using Dump(Writer*)
Definition: shared_dynamic_string_map_test_base.h:86
void TestCreate()
Test the creation and use of a child process.
Definition: shared_mem_test_base.h:33