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_RENDERER_PEPPER_PPAPI_UNITTEST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_ | 6 #define CONTENT_RENDERER_PEPPER_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 "content/renderer/pepper/unittest_instance_util.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class MessageLoop; | 15 class MessageLoop; |
15 } | 16 } |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 class PepperPluginInstanceImpl; | 20 class PepperPluginInstanceImpl; |
20 class PluginModule; | 21 class PluginModule; |
21 | 22 |
22 class PpapiUnittest : public testing::Test { | 23 class PpapiUnittest : public testing::Test { |
23 public: | 24 public: |
24 PpapiUnittest(); | 25 PpapiUnittest(); |
25 virtual ~PpapiUnittest(); | 26 virtual ~PpapiUnittest(); |
26 | 27 |
27 virtual void SetUp(); | 28 virtual void SetUp(); |
28 virtual void TearDown(); | 29 virtual void TearDown(); |
29 | 30 |
30 PluginModule* module() const { return module_.get(); } | 31 PluginModule* module() const { return instance_util_.module(); } |
31 PepperPluginInstanceImpl* instance() const { return instance_.get(); } | 32 PepperPluginInstanceImpl* instance() const { |
32 | 33 return instance_util_.instance(); |
33 // Provides access to the interfaces implemented by the test. The default one | 34 } |
34 // implements PPP_INSTANCE. | |
35 virtual const void* GetMockInterface(const char* interface_name) const; | |
36 | |
37 // Deletes the instance and module to simulate module shutdown. | |
38 void ShutdownModule(); | |
39 | |
40 // Sets the view size of the plugin instance. | |
41 void SetViewSize(int width, int height) const; | |
42 | 35 |
43 private: | 36 private: |
44 // Note: module must be declared first since we want it to get destroyed last. | 37 // Note: instance_util_ must be declared first since we want it to get |
45 scoped_refptr<PluginModule> module_; | 38 // destroyed last. |
46 scoped_refptr<PepperPluginInstanceImpl> instance_; | 39 UnittestInstanceUtil instance_util_; |
47 | 40 |
48 scoped_ptr<base::MessageLoop> message_loop_; | 41 scoped_ptr<base::MessageLoop> message_loop_; |
49 | 42 |
50 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest); | 43 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest); |
51 }; | 44 }; |
52 | 45 |
53 } // namespace content | 46 } // namespace content |
54 | 47 |
55 #endif // CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_ | 48 #endif // CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_ |
OLD | NEW |