Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
shared_mem_lock_manager_test_base.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc.
16 
17 #ifndef PAGESPEED_KERNEL_SHAREDMEM_SHARED_MEM_LOCK_MANAGER_TEST_BASE_H_
18 #define PAGESPEED_KERNEL_SHAREDMEM_SHARED_MEM_LOCK_MANAGER_TEST_BASE_H_
19 
31 
32 namespace net_instaweb {
33 
34 class SharedMemLockManagerTestBase : public testing::Test {
35  protected:
36  typedef void (SharedMemLockManagerTestBase::*TestMethod)();
37 
39  virtual void SetUp();
40  virtual void TearDown();
41 
42  void TestBasic();
43  void TestDestructorUnlock();
44  void TestSteal();
45 
46  private:
47  bool CreateChild(TestMethod method);
48 
49  SharedMemLockManager* CreateLockManager();
50  SharedMemLockManager* AttachDefault();
51 
52  void TestBasicChild();
53  void TestStealChild();
54 
56  scoped_ptr<AbstractSharedMem> shmem_runtime_;
57  scoped_ptr<ThreadSystem> thread_system_;
58  MockTimer timer_;
59  MockMessageHandler handler_;
63  MockScheduler scheduler_;
64  MD5Hasher hasher_;
65  scoped_ptr<SharedMemLockManager> root_lock_manager_;
66 
67 
68 };
69 
70 template<typename ConcreteTestEnv>
72  public:
74  : SharedMemLockManagerTestBase(new ConcreteTestEnv) {
75  }
76 };
77 
78 TYPED_TEST_CASE_P(SharedMemLockManagerTestTemplate);
79 
80 TYPED_TEST_P(SharedMemLockManagerTestTemplate, TestBasic) {
81  SharedMemLockManagerTestBase::TestBasic();
82 }
83 
84 TYPED_TEST_P(SharedMemLockManagerTestTemplate, TestDestructorUnlock) {
85  SharedMemLockManagerTestBase::TestDestructorUnlock();
86 }
87 
88 TYPED_TEST_P(SharedMemLockManagerTestTemplate, TestSteal) {
89  SharedMemLockManagerTestBase::TestSteal();
90 }
91 
92 REGISTER_TYPED_TEST_CASE_P(SharedMemLockManagerTestTemplate, TestBasic,
93  TestDestructorUnlock, TestSteal);
94 
95 }
96 
97 #endif
Definition: mock_timer.h:33
Definition: md5_hasher.h:28
Definition: mock_scheduler.h:39
namespace SharedMemLockData
Definition: shared_mem_lock_manager.h:49
Definition: mock_message_handler.h:39
Definition: scoped_ptr.h:30
Definition: shared_mem_lock_manager_test_base.h:71
Definition: shared_mem_test_base.h:33
Definition: shared_mem_lock_manager_test_base.h:34