Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: webkit/plugins/ppapi/ppapi_unittest.cc

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_unittest.h ('k') | webkit/plugins/ppapi/ppb_audio_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/glue/plugins/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/glue/plugins/mock_plugin_delegate.h" 9 #include "webkit/plugins/ppapi/mock_plugin_delegate.h"
10 #include "webkit/glue/plugins/pepper_plugin_instance.h" 10 #include "webkit/plugins/ppapi/plugin_instance.h"
11 #include "webkit/glue/plugins/pepper_plugin_module.h" 11 #include "webkit/plugins/ppapi/plugin_module.h"
12 12
13 namespace pepper { 13 namespace webkit {
14 namespace ppapi {
14 15
15 namespace { 16 namespace {
16 17
17 PpapiUnittest* current_unittest = NULL; 18 PpapiUnittest* current_unittest = NULL;
18 19
19 const void* MockGetInterface(const char* interface_name) { 20 const void* MockGetInterface(const char* interface_name) {
20 return current_unittest->GetMockInterface(interface_name); 21 return current_unittest->GetMockInterface(interface_name);
21 } 22 }
22 23
23 int MockInitializeModule(PP_Module, PPB_GetInterface) { 24 int MockInitializeModule(PP_Module, PPB_GetInterface) {
24 return PP_OK; 25 return PP_OK;
25 } 26 }
26 27
27 // PepperPluginDelegate -------------------------------------
28
29 // PPP_Instance implementation ------------------------------------------------ 28 // PPP_Instance implementation ------------------------------------------------
30 29
31 PP_Bool Instance_DidCreate(PP_Instance pp_instance, 30 PP_Bool Instance_DidCreate(PP_Instance pp_instance,
32 uint32_t argc, 31 uint32_t argc,
33 const char* argn[], 32 const char* argn[],
34 const char* argv[]) { 33 const char* argv[]) {
35 return PP_TRUE; 34 return PP_TRUE;
36 } 35 }
37 36
38 void Instance_DidDestroy(PP_Instance instance) { 37 void Instance_DidDestroy(PP_Instance instance) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 current_unittest = this; 78 current_unittest = this;
80 } 79 }
81 80
82 PpapiUnittest::~PpapiUnittest() { 81 PpapiUnittest::~PpapiUnittest() {
83 DCHECK(current_unittest == this); 82 DCHECK(current_unittest == this);
84 current_unittest = NULL; 83 current_unittest = NULL;
85 } 84 }
86 85
87 void PpapiUnittest::SetUp() { 86 void PpapiUnittest::SetUp() {
88 delegate_.reset(new MockPluginDelegate); 87 delegate_.reset(new MockPluginDelegate);
89 88
90 // Initialize the mock module. 89 // Initialize the mock module.
91 module_ = new PluginModule; 90 module_ = new PluginModule;
92 PluginModule::EntryPoints entry_points; 91 PluginModule::EntryPoints entry_points;
93 entry_points.get_interface = &MockGetInterface; 92 entry_points.get_interface = &MockGetInterface;
94 entry_points.initialize_module = &MockInitializeModule; 93 entry_points.initialize_module = &MockInitializeModule;
95 ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points)); 94 ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points));
96 95
97 // Initialize the mock instance. 96 // Initialize the mock instance.
98 instance_ = new PluginInstance(delegate_.get(), module(), 97 instance_ = new PluginInstance(delegate_.get(), module(),
99 static_cast<const PPP_Instance*>( 98 static_cast<const PPP_Instance*>(
100 GetMockInterface(PPP_INSTANCE_INTERFACE))); 99 GetMockInterface(PPP_INSTANCE_INTERFACE)));
101 } 100 }
102 101
103 void PpapiUnittest::TearDown() { 102 void PpapiUnittest::TearDown() {
104 } 103 }
105 104
106 const void* PpapiUnittest::GetMockInterface(const char* interface_name) const { 105 const void* PpapiUnittest::GetMockInterface(const char* interface_name) const {
107 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) 106 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
108 return &mock_instance_interface; 107 return &mock_instance_interface;
109 return NULL; 108 return NULL;
110 } 109 }
111 110
112 } // namespace pepper 111 } // namespace ppapi
112 } // namespace webkit
113 113
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_unittest.h ('k') | webkit/plugins/ppapi/ppb_audio_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698