OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Ginsu Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef C_SALT_INTEGRATION_TESTS_TEST_MODULE_H_ | |
6 #define C_SALT_INTEGRATION_TESTS_TEST_MODULE_H_ | |
7 | |
8 #include <cstdio> | |
9 | |
10 #include "boost/shared_ptr.hpp" | |
11 #include "c_salt/integration_tests/fake_instance.h" | |
12 #include "c_salt/module.h" | |
13 | |
14 // This is the connection to the c_salt Module machinery. The Module singleton | |
15 // calls CreateInstance to make new copies of each in-browser instance of | |
16 // FakeInstance. | |
17 class TestModule : public c_salt::Module { | |
18 public: | |
19 virtual c_salt::Instance* CreateInstance(const NPP& npp_instance) { | |
20 std::printf("Creating instance %p\n", npp_instance); | |
21 boost::shared_ptr<FakeInstance> instance_ptr( | |
22 new FakeInstance(npp_instance)); | |
23 // The ScriptingBridge takes ownership of FakeInstance via the shared_ptr. | |
24 instance_ptr->CreateScriptingBridgeForObject(instance_ptr); | |
25 return instance_ptr.get(); | |
26 } | |
27 }; | |
28 | |
29 #endif // C_SALT_INTEGRATION_TESTS_TEST_MODULE_H_ | |
OLD | NEW |