OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_TEST_PPAPI_UNITTEST_H_ | 5 #ifndef CONTENT_TEST_PPAPI_UNITTEST_H_ |
6 #define CONTENT_TEST_PPAPI_UNITTEST_H_ | 6 #define CONTENT_TEST_PPAPI_UNITTEST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class MessageLoop; | 14 class MessageLoop; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 class PepperPluginInstanceImpl; | 19 class PepperPluginInstanceImpl; |
20 class PluginModule; | 20 class PluginModule; |
21 | 21 |
22 class PpapiUnittest : public testing::Test { | 22 class PpapiUnittest : public testing::Test { |
23 public: | 23 public: |
24 PpapiUnittest(); | 24 PpapiUnittest(); |
25 virtual ~PpapiUnittest(); | 25 ~PpapiUnittest() override; |
26 | 26 |
27 virtual void SetUp(); | 27 void SetUp() override; |
28 virtual void TearDown(); | 28 void TearDown() override; |
29 | 29 |
30 PluginModule* module() const { return module_.get(); } | 30 PluginModule* module() const { return module_.get(); } |
31 PepperPluginInstanceImpl* instance() const { return instance_.get(); } | 31 PepperPluginInstanceImpl* instance() const { return instance_.get(); } |
32 | 32 |
33 // Provides access to the interfaces implemented by the test. The default one | 33 // Provides access to the interfaces implemented by the test. The default one |
34 // implements PPP_INSTANCE. | 34 // implements PPP_INSTANCE. |
35 virtual const void* GetMockInterface(const char* interface_name) const; | 35 virtual const void* GetMockInterface(const char* interface_name) const; |
36 | 36 |
37 // Deletes the instance and module to simulate module shutdown. | 37 // Deletes the instance and module to simulate module shutdown. |
38 void ShutdownModule(); | 38 void ShutdownModule(); |
39 | 39 |
40 // Sets the view size of the plugin instance. | 40 // Sets the view size of the plugin instance. |
41 void SetViewSize(int width, int height) const; | 41 void SetViewSize(int width, int height) const; |
42 | 42 |
43 private: | 43 private: |
44 // Note: module must be declared first since we want it to get destroyed last. | 44 // Note: module must be declared first since we want it to get destroyed last. |
45 scoped_refptr<PluginModule> module_; | 45 scoped_refptr<PluginModule> module_; |
46 scoped_refptr<PepperPluginInstanceImpl> instance_; | 46 scoped_refptr<PepperPluginInstanceImpl> instance_; |
47 | 47 |
48 scoped_ptr<base::MessageLoop> message_loop_; | 48 scoped_ptr<base::MessageLoop> message_loop_; |
49 | 49 |
50 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest); | 50 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest); |
51 }; | 51 }; |
52 | 52 |
53 } // namespace content | 53 } // namespace content |
54 | 54 |
55 #endif // CONTENT_TEST_PPAPI_UNITTEST_H_ | 55 #endif // CONTENT_TEST_PPAPI_UNITTEST_H_ |
OLD | NEW |