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 #include "webkit/plugins/ppapi/ppapi_unittest.h" | 5 #include "webkit/plugins/ppapi/ppapi_unittest.h" |
6 | 6 |
7 #include "ppapi/c/pp_var.h" | 7 #include "ppapi/c/pp_var.h" |
8 #include "ppapi/c/ppp_instance.h" | 8 #include "ppapi/c/ppp_instance.h" |
9 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" | 9 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" |
10 #include "webkit/plugins/ppapi/plugin_module.h" | 10 #include "webkit/plugins/ppapi/plugin_module.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 delegate_.reset(new MockPluginDelegate); | 83 delegate_.reset(new MockPluginDelegate); |
84 | 84 |
85 // Initialize the mock module. | 85 // Initialize the mock module. |
86 module_ = new PluginModule("Mock plugin", FilePath(), this); | 86 module_ = new PluginModule("Mock plugin", FilePath(), this); |
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_ = new PluginInstance(delegate_.get(), module(), | 93 instance_ = PluginInstance::Create0_5( |
94 PluginInstance::new_instance_interface<PPP_Instance>( | 94 delegate_.get(), |
95 GetMockInterface(PPP_INSTANCE_INTERFACE))); | 95 module(), |
| 96 GetMockInterface(PPP_INSTANCE_INTERFACE_0_5)); |
| 97 |
96 } | 98 } |
97 | 99 |
98 void PpapiUnittest::TearDown() { | 100 void PpapiUnittest::TearDown() { |
99 instance_ = NULL; | 101 instance_ = NULL; |
100 module_ = NULL; | 102 module_ = NULL; |
101 } | 103 } |
102 | 104 |
103 const void* PpapiUnittest::GetMockInterface(const char* interface_name) const { | 105 const void* PpapiUnittest::GetMockInterface(const char* interface_name) const { |
104 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) | 106 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE_0_5) == 0) |
105 return &mock_instance_interface; | 107 return &mock_instance_interface; |
106 return NULL; | 108 return NULL; |
107 } | 109 } |
108 | 110 |
109 void PpapiUnittest::ShutdownModule() { | 111 void PpapiUnittest::ShutdownModule() { |
110 DCHECK(instance_->HasOneRef()); | 112 DCHECK(instance_->HasOneRef()); |
111 instance_ = NULL; | 113 instance_ = NULL; |
112 DCHECK(module_->HasOneRef()); | 114 DCHECK(module_->HasOneRef()); |
113 module_ = NULL; | 115 module_ = NULL; |
114 } | 116 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 reset_result(); | 160 reset_result(); |
159 PpapiInterfaceFactoryManager::GetInstance()->UnregisterFactory( | 161 PpapiInterfaceFactoryManager::GetInstance()->UnregisterFactory( |
160 PpapiCustomInterfaceFactoryTest::InterfaceFactory); | 162 PpapiCustomInterfaceFactoryTest::InterfaceFactory); |
161 | 163 |
162 (*PluginModule::GetLocalGetInterfaceFunc())("DummyInterface"); | 164 (*PluginModule::GetLocalGetInterfaceFunc())("DummyInterface"); |
163 EXPECT_FALSE(result()); | 165 EXPECT_FALSE(result()); |
164 } | 166 } |
165 | 167 |
166 } // namespace ppapi | 168 } // namespace ppapi |
167 } // namespace webkit | 169 } // namespace webkit |
OLD | NEW |