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

Side by Side Diff: Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void registerNPShutdownFunction(void (*)()); 103 void registerNPShutdownFunction(void (*)());
104 104
105 static void indicateTestFailure(); 105 static void indicateTestFailure();
106 106
107 template<typename TestClassTy> class Register { 107 template<typename TestClassTy> class Register {
108 public: 108 public:
109 Register(const std::string& identifier) 109 Register(const std::string& identifier)
110 { 110 {
111 registerCreateTestFunction(identifier, Register::create); 111 registerCreateTestFunction(identifier, Register::create);
112 } 112 }
113 113
114 private: 114 private:
115 static PluginTest* create(NPP npp, const std::string& identifier) 115 static PluginTest* create(NPP npp, const std::string& identifier)
116 { 116 {
117 return new TestClassTy(npp, identifier); 117 return new TestClassTy(npp, identifier);
118 } 118 }
119 }; 119 };
120 120
121 protected: 121 protected:
122 PluginTest(NPP npp, const std::string& identifier); 122 PluginTest(NPP npp, const std::string& identifier);
123 123
124 // FIXME: A plug-in test shouldn't need to know about it's NPP. Make this pr ivate. 124 // FIXME: A plug-in test shouldn't need to know about it's NPP. Make this pr ivate.
125 NPP m_npp; 125 NPP m_npp;
126 126
127 const std::string& identifier() const { return m_identifier; } 127 const std::string& identifier() const { return m_identifier; }
128 128
129 static NPNetscapeFuncs* netscapeFuncs(); 129 static NPNetscapeFuncs* netscapeFuncs();
130 130
131 void waitUntilDone(); 131 void waitUntilDone();
132 void notifyDone(); 132 void notifyDone();
133 133
134 // NPObject helper template. 134 // NPObject helper template.
135 template<typename T> struct Object : NPObject { 135 template<typename T> struct Object : NPObject {
136 public: 136 public:
137 static NPObject* create(PluginTest* pluginTest) 137 static NPObject* create(PluginTest* pluginTest)
138 { 138 {
139 Object* object = static_cast<Object*>(pluginTest->NPN_CreateObject(n pClass())); 139 Object* object = static_cast<Object*>(pluginTest->NPN_CreateObject(n pClass()));
140 140
141 object->m_pluginTest = pluginTest; 141 object->m_pluginTest = pluginTest;
142 return object; 142 return object;
143 } 143 }
144 144
145 // These should never be called. 145 // These should never be called.
146 bool hasMethod(NPIdentifier methodName) 146 bool hasMethod(NPIdentifier methodName)
147 { 147 {
148 assert(false); 148 assert(false);
149 return false; 149 return false;
150 } 150 }
151 151
152 bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVaria nt* result) 152 bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVaria nt* result)
153 { 153 {
154 assert(false); 154 assert(false);
155 return false; 155 return false;
156 } 156 }
157 157
158 bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result) 158 bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
159 { 159 {
160 assert(false); 160 assert(false);
161 return false; 161 return false;
162 } 162 }
163 163
164 bool hasProperty(NPIdentifier propertyName) 164 bool hasProperty(NPIdentifier propertyName)
165 { 165 {
166 assert(false); 166 assert(false);
167 return false; 167 return false;
(...skipping 15 matching lines...) Expand all
183 bool identifierIs(NPIdentifier identifier, const char* value) 183 bool identifierIs(NPIdentifier identifier, const char* value)
184 { 184 {
185 return pluginTest()->NPN_GetStringIdentifier(value) == identifier; 185 return pluginTest()->NPN_GetStringIdentifier(value) == identifier;
186 } 186 }
187 187
188 protected: 188 protected:
189 Object() 189 Object()
190 : m_pluginTest(0) 190 : m_pluginTest(0)
191 { 191 {
192 } 192 }
193 193
194 virtual ~Object() 194 virtual ~Object()
195 { 195 {
196 } 196 }
197 197
198 PluginTest* pluginTest() const { return m_pluginTest; } 198 PluginTest* pluginTest() const { return m_pluginTest; }
199 199
200 private: 200 private:
201 static NPObject* NP_Allocate(NPP npp, NPClass* aClass) 201 static NPObject* NP_Allocate(NPP npp, NPClass* aClass)
202 { 202 {
203 return new T; 203 return new T;
204 } 204 }
205 205
(...skipping 28 matching lines...) Expand all
234 } 234 }
235 235
236 static bool NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyN ame) 236 static bool NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyN ame)
237 { 237 {
238 return static_cast<T*>(npObject)->removeProperty(propertyName); 238 return static_cast<T*>(npObject)->removeProperty(propertyName);
239 } 239 }
240 240
241 static NPClass* npClass() 241 static NPClass* npClass()
242 { 242 {
243 static NPClass npClass = { 243 static NPClass npClass = {
244 NP_CLASS_STRUCT_VERSION, 244 NP_CLASS_STRUCT_VERSION,
245 NP_Allocate, 245 NP_Allocate,
246 NP_Deallocate, 246 NP_Deallocate,
247 0, // NPClass::invalidate 247 0, // NPClass::invalidate
248 has_member_hasMethod<T>::value ? NP_HasMethod : 0, 248 has_member_hasMethod<T>::value ? NP_HasMethod : 0,
249 has_member_invoke<T>::value ? NP_Invoke : 0, 249 has_member_invoke<T>::value ? NP_Invoke : 0,
250 has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0, 250 has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0,
251 has_member_hasProperty<T>::value ? NP_HasProperty : 0, 251 has_member_hasProperty<T>::value ? NP_HasProperty : 0,
252 has_member_getProperty<T>::value ? NP_GetProperty : 0, 252 has_member_getProperty<T>::value ? NP_GetProperty : 0,
253 0, // NPClass::setProperty 253 0, // NPClass::setProperty
254 has_member_removeProperty<T>::value ? NP_RemoveProperty : 0, 254 has_member_removeProperty<T>::value ? NP_RemoveProperty : 0,
255 0, // NPClass::enumerate 255 0, // NPClass::enumerate
256 0 // NPClass::construct 256 0 // NPClass::construct
257 }; 257 };
258 258
259 return &npClass; 259 return &npClass;
260 }; 260 };
261 261
262 PluginTest* m_pluginTest; 262 PluginTest* m_pluginTest;
263 }; 263 };
264 264
265 private: 265 private:
266 typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&); 266 typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&);
267 267
268 static void registerCreateTestFunction(const std::string&, CreateTestFunctio n); 268 static void registerCreateTestFunction(const std::string&, CreateTestFunctio n);
269 static std::map<std::string, CreateTestFunction>& createTestFunctions(); 269 static std::map<std::string, CreateTestFunction>& createTestFunctions();
270 270
271 std::string m_identifier; 271 std::string m_identifier;
272 }; 272 };
273 273
274 #endif // PluginTest_h 274 #endif // PluginTest_h
OLDNEW
« no previous file with comments | « Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp ('k') | Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698