| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "webkit/plugins/ppapi/ppapi_unittest.h" | 5 #include "webkit/plugins/ppapi/ppapi_unittest.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
| 9 #include "ppapi/c/ppp_instance.h" | 9 #include "ppapi/c/ppp_instance.h" |
| 10 #include "ppapi/shared_impl/ppapi_globals.h" | 10 #include "ppapi/shared_impl/ppapi_globals.h" |
| 11 #include "ppapi/shared_impl/ppapi_permissions.h" | 11 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 12 #include "webkit/plugins/ppapi/gfx_conversion.h" | 12 #include "webkit/plugins/ppapi/gfx_conversion.h" |
| 13 #include "webkit/plugins/ppapi/host_globals.h" | 13 #include "webkit/plugins/ppapi/host_globals.h" |
| 14 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" | 14 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" |
| 15 #include "webkit/plugins/ppapi/plugin_module.h" | 15 #include "webkit/plugins/ppapi/plugin_module.h" |
| 16 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" | 16 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" |
| 17 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 17 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
| 18 | 18 |
| 19 namespace webkit { | 19 namespace webkit { |
| 20 namespace ppapi { | 20 namespace ppapi { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 PpapiUnittest* current_unittest = NULL; | 24 PpapiUnittest* current_unittest = NULL; |
| 25 | 25 |
| 26 const void* MockGetInterface(const char* interface_name) { | 26 const void* MockGetInterface(const char* interface_name) { |
| 27 return current_unittest->GetMockInterface(interface_name); | 27 return current_unittest->GetMockInterface(interface_name); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Initialize the mock module. | 83 // Initialize the mock module. |
| 84 module_ = new PluginModule("Mock plugin", base::FilePath(), this, | 84 module_ = new PluginModule("Mock plugin", base::FilePath(), this, |
| 85 ::ppapi::PpapiPermissions()); | 85 ::ppapi::PpapiPermissions()); |
| 86 ::ppapi::PpapiGlobals::Get()->ResetMainThreadMessageLoopForTesting(); | 86 ::ppapi::PpapiGlobals::Get()->ResetMainThreadMessageLoopForTesting(); |
| 87 PluginModule::EntryPoints entry_points; | 87 PluginModule::EntryPoints entry_points; |
| 88 entry_points.get_interface = &MockGetInterface; | 88 entry_points.get_interface = &MockGetInterface; |
| 89 entry_points.initialize_module = &MockInitializeModule; | 89 entry_points.initialize_module = &MockInitializeModule; |
| 90 ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points)); | 90 ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points)); |
| 91 | 91 |
| 92 // Initialize the mock instance. | 92 // Initialize the mock instance. |
| 93 instance_ = PluginInstance::Create(delegate_.get(), NULL, module(), NULL, | 93 instance_ = PluginInstanceImpl::Create( |
| 94 GURL()); | 94 delegate_.get(), NULL, module(), NULL, GURL()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void PpapiUnittest::TearDown() { | 97 void PpapiUnittest::TearDown() { |
| 98 instance_ = NULL; | 98 instance_ = NULL; |
| 99 module_ = NULL; | 99 module_ = NULL; |
| 100 message_loop_.reset(); | 100 message_loop_.reset(); |
| 101 PluginModule::ResetHostGlobalsForTest(); | 101 PluginModule::ResetHostGlobalsForTest(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 MockPluginDelegate* PpapiUnittest::NewPluginDelegate() { | 104 MockPluginDelegate* PpapiUnittest::NewPluginDelegate() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 reset_result(); | 164 reset_result(); |
| 165 PpapiInterfaceFactoryManager::GetInstance()->UnregisterFactory( | 165 PpapiInterfaceFactoryManager::GetInstance()->UnregisterFactory( |
| 166 PpapiCustomInterfaceFactoryTest::InterfaceFactory); | 166 PpapiCustomInterfaceFactoryTest::InterfaceFactory); |
| 167 | 167 |
| 168 (*PluginModule::GetLocalGetInterfaceFunc())("DummyInterface"); | 168 (*PluginModule::GetLocalGetInterfaceFunc())("DummyInterface"); |
| 169 EXPECT_FALSE(result()); | 169 EXPECT_FALSE(result()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace ppapi | 172 } // namespace ppapi |
| 173 } // namespace webkit | 173 } // namespace webkit |
| OLD | NEW |