Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
shared_circular_buffer_test_base.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc.
16 
17 #ifndef PAGESPEED_KERNEL_SHAREDMEM_SHARED_CIRCULAR_BUFFER_TEST_BASE_H_
18 #define PAGESPEED_KERNEL_SHAREDMEM_SHARED_CIRCULAR_BUFFER_TEST_BASE_H_
19 
28 
29 namespace net_instaweb {
30 
31 class SharedCircularBuffer;
32 class ThreadSystem;
33 
35 class SharedCircularBufferTestBase : public testing::Test {
36  protected:
37  typedef void (SharedCircularBufferTestBase::*TestMethod)();
38 
40 
41  bool CreateChild(TestMethod method);
42 
44  void TestCreate();
46  void TestAdd();
48  void TestClear();
50  void TestCircular();
51 
52  private:
54  void TestCreateChild();
55  void TestAddChild();
56  void TestClearChild();
58  void TestChildWrite();
60  void TestChildBuff();
61 
63  SharedCircularBuffer* ChildInit();
65  SharedCircularBuffer* ParentInit();
66 
68  scoped_ptr<AbstractSharedMem> shmem_runtime_;
69  scoped_ptr<ThreadSystem> thread_system_;
70  MockMessageHandler handler_;
71  NullMessageHandler null_handler_;
75  StringPiece message_;
78  StringPiece expected_result_;
79 
80 
81 };
82 
83 template<typename ConcreteTestEnv>
85  public:
87  : SharedCircularBufferTestBase(new ConcreteTestEnv) {
88  }
89 };
90 
91 TYPED_TEST_CASE_P(SharedCircularBufferTestTemplate);
92 
93 TYPED_TEST_P(SharedCircularBufferTestTemplate, TestCreate) {
95 }
96 
97 TYPED_TEST_P(SharedCircularBufferTestTemplate, TestAdd) {
99 }
100 
101 TYPED_TEST_P(SharedCircularBufferTestTemplate, TestClear) {
103 }
104 
105 TYPED_TEST_P(SharedCircularBufferTestTemplate, TestCircular) {
107 }
108 
109 REGISTER_TYPED_TEST_CASE_P(SharedCircularBufferTestTemplate, TestCreate,
110  TestAdd, TestClear, TestCircular);
111 
112 }
113 #endif
void TestCreate()
Test basic initialization/writing/cleanup.
Implementation of a message handler that does nothing.
Definition: null_message_handler.h:31
This TestBase is added to pthread_shared_mem_test.
Definition: shared_circular_buffer_test_base.h:35
void TestAdd()
Test writing from child process.
void TestClear()
Test cleanup from child process.
Definition: mock_message_handler.h:39
Definition: shared_circular_buffer_test_base.h:84
void TestCircular()
Test the shared memory circular buffer.
Definition: scoped_ptr.h:30
Definition: shared_circular_buffer.h:43
Definition: shared_mem_test_base.h:33