| 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/plugin_delegate.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 12 |
| 14 namespace base { | 13 namespace base { |
| 15 class MessageLoop; | 14 class MessageLoop; |
| 16 } | 15 } |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 | 18 |
| 20 class MockPluginDelegate; | |
| 21 class PepperPluginInstanceImpl; | 19 class PepperPluginInstanceImpl; |
| 22 class PluginModule; | 20 class PluginModule; |
| 23 | 21 |
| 24 class PpapiUnittest : public testing::Test { | 22 class PpapiUnittest : public testing::Test { |
| 25 public: | 23 public: |
| 26 PpapiUnittest(); | 24 PpapiUnittest(); |
| 27 virtual ~PpapiUnittest(); | 25 virtual ~PpapiUnittest(); |
| 28 | 26 |
| 29 virtual void SetUp(); | 27 virtual void SetUp(); |
| 30 virtual void TearDown(); | 28 virtual void TearDown(); |
| 31 | 29 |
| 32 MockPluginDelegate* delegate() { return delegate_.get(); } | |
| 33 PluginModule* module() const { return module_.get(); } | 30 PluginModule* module() const { return module_.get(); } |
| 34 PepperPluginInstanceImpl* instance() const { return instance_.get(); } | 31 PepperPluginInstanceImpl* instance() const { return instance_.get(); } |
| 35 | 32 |
| 36 // 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 |
| 37 // implements PPP_INSTANCE. | 34 // implements PPP_INSTANCE. |
| 38 virtual const void* GetMockInterface(const char* interface_name) const; | 35 virtual const void* GetMockInterface(const char* interface_name) const; |
| 39 | 36 |
| 40 // Deletes the instance and module to simulate module shutdown. | 37 // Deletes the instance and module to simulate module shutdown. |
| 41 void ShutdownModule(); | 38 void ShutdownModule(); |
| 42 | 39 |
| 43 // Sets the view size of the plugin instance. | 40 // Sets the view size of the plugin instance. |
| 44 void SetViewSize(int width, int height) const; | 41 void SetViewSize(int width, int height) const; |
| 45 | 42 |
| 46 private: | 43 private: |
| 47 scoped_ptr<MockPluginDelegate> delegate_; | |
| 48 | |
| 49 // 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. |
| 50 scoped_refptr<PluginModule> module_; | 45 scoped_refptr<PluginModule> module_; |
| 51 scoped_refptr<PepperPluginInstanceImpl> instance_; | 46 scoped_refptr<PepperPluginInstanceImpl> instance_; |
| 52 | 47 |
| 53 scoped_ptr<base::MessageLoop> message_loop_; | 48 scoped_ptr<base::MessageLoop> message_loop_; |
| 54 | 49 |
| 55 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest); | 50 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest); |
| 56 }; | 51 }; |
| 57 | 52 |
| 58 } // namespace content | 53 } // namespace content |
| 59 | 54 |
| 60 #endif // CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_ | 55 #endif // CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_ |
| OLD | NEW |