OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 using namespace std; | 36 using namespace std; |
37 extern NPNetscapeFuncs *browser; | 37 extern NPNetscapeFuncs *browser; |
38 | 38 |
39 static void (*shutdownFunction)(); | 39 static void (*shutdownFunction)(); |
40 | 40 |
41 PluginTest* PluginTest::create(NPP npp, const string& identifier) | 41 PluginTest* PluginTest::create(NPP npp, const string& identifier) |
42 { | 42 { |
43 if (identifier.empty()) | 43 if (identifier.empty()) |
44 return new PluginTest(npp, identifier); | 44 return new PluginTest(npp, identifier); |
45 | 45 |
46 CreateTestFunction createTestFunction = createTestFunctions()[identifier]; | 46 CreateTestFunction createTestFunction = createTestFunctions()[identifier]; |
47 if (createTestFunction) | 47 if (createTestFunction) |
48 return createTestFunction(npp, identifier); | 48 return createTestFunction(npp, identifier); |
49 | 49 |
50 return 0; | 50 return 0; |
51 } | 51 } |
52 | 52 |
53 PluginTest::PluginTest(NPP npp, const string& identifier) | 53 PluginTest::PluginTest(NPP npp, const string& identifier) |
54 : m_npp(npp) | 54 : m_npp(npp) |
55 , m_identifier(identifier) | 55 , m_identifier(identifier) |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 | 200 |
201 int32_t PluginTest::NPN_IntFromIdentifier(NPIdentifier npIdentifier) | 201 int32_t PluginTest::NPN_IntFromIdentifier(NPIdentifier npIdentifier) |
202 { | 202 { |
203 return browser->intfromidentifier(npIdentifier); | 203 return browser->intfromidentifier(npIdentifier); |
204 } | 204 } |
205 | 205 |
206 NPObject* PluginTest::NPN_CreateObject(NPClass* npClass) | 206 NPObject* PluginTest::NPN_CreateObject(NPClass* npClass) |
207 { | 207 { |
208 return browser->createobject(m_npp, npClass); | 208 return browser->createobject(m_npp, npClass); |
209 } | 209 } |
210 | 210 |
211 NPObject* PluginTest::NPN_RetainObject(NPObject* npObject) | 211 NPObject* PluginTest::NPN_RetainObject(NPObject* npObject) |
212 { | 212 { |
213 return browser->retainobject(npObject); | 213 return browser->retainobject(npObject); |
214 } | 214 } |
215 | 215 |
216 void PluginTest::NPN_ReleaseObject(NPObject* npObject) | 216 void PluginTest::NPN_ReleaseObject(NPObject* npObject) |
217 { | 217 { |
218 browser->releaseobject(npObject); | 218 browser->releaseobject(npObject); |
219 } | 219 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 | 279 |
280 void PluginTest::notifyDone() | 280 void PluginTest::notifyDone() |
281 { | 281 { |
282 executeScript("testRunner.notifyDone()"); | 282 executeScript("testRunner.notifyDone()"); |
283 } | 283 } |
284 | 284 |
285 void PluginTest::registerCreateTestFunction(const string& identifier, CreateTest
Function createTestFunction) | 285 void PluginTest::registerCreateTestFunction(const string& identifier, CreateTest
Function createTestFunction) |
286 { | 286 { |
287 assert(!createTestFunctions().count(identifier)); | 287 assert(!createTestFunctions().count(identifier)); |
288 | 288 |
289 createTestFunctions()[identifier] = createTestFunction; | 289 createTestFunctions()[identifier] = createTestFunction; |
290 } | 290 } |
291 | 291 |
292 std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFun
ctions() | 292 std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFun
ctions() |
293 { | 293 { |
294 static std::map<std::string, CreateTestFunction> testFunctions; | 294 static std::map<std::string, CreateTestFunction> testFunctions; |
295 | 295 |
296 return testFunctions; | 296 return testFunctions; |
297 } | 297 } |
OLD | NEW |