OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium 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 WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_NPOBJECT_LIFETIME_TEST_H__ | |
6 #define WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_NPOBJECT_LIFETIME_TEST_H__ | |
7 | |
8 #include "build/build_config.h" | |
9 #include "webkit/glue/plugins/test/plugin_test.h" | |
10 | |
11 namespace NPAPIClient { | |
12 | |
13 // The NPObjectLifeTime class tests the case where a plugin has an NPObject | |
14 // which points to a different plugin instance on a different frame in the | |
15 // page and whether refcounts on this npobject are valid when the source frame | |
16 // is destroyed. | |
17 class NPObjectLifetimeTest : public PluginTest { | |
18 public: | |
19 // Constructor. | |
20 NPObjectLifetimeTest(NPP id, NPNetscapeFuncs *host_functions); | |
21 | |
22 // NPAPI SetWindow handler. | |
23 virtual NPError SetWindow(NPWindow* pNPWindow); | |
24 | |
25 virtual void URLNotify(const char* url, NPReason reason, void* data); | |
26 | |
27 protected: | |
28 NPObject* other_plugin_instance_object_; | |
29 | |
30 #if defined(OS_WIN) | |
31 static void CALLBACK TimerProc(HWND window, UINT message, UINT timer_id, | |
32 unsigned long elapsed_milli_seconds); | |
33 UINT_PTR timer_id_; | |
34 #endif | |
35 DISALLOW_IMPLICIT_CONSTRUCTORS(NPObjectLifetimeTest); | |
36 }; | |
37 | |
38 // The NPObjectLifetimeTestInstance2 class represents the plugin instance | |
39 // which is deleted by the NPObjectLifeTime class via a javascript function. | |
40 class NPObjectLifetimeTestInstance2 : public PluginTest { | |
41 public: | |
42 // Constructor. | |
43 NPObjectLifetimeTestInstance2(NPP id, NPNetscapeFuncs *host_functions); | |
44 ~NPObjectLifetimeTestInstance2(); | |
45 | |
46 // NPAPI SetWindow handler. | |
47 virtual NPError SetWindow(NPWindow* pNPWindow); | |
48 protected: | |
49 static NPObject* plugin_instance_object_; | |
50 friend class NPObjectLifetimeTest; | |
51 | |
52 DISALLOW_IMPLICIT_CONSTRUCTORS(NPObjectLifetimeTestInstance2); | |
53 }; | |
54 | |
55 // The NPObjectLifeTime class tests the case where a plugin instance is | |
56 // destroyed in NPN_Evaluate | |
57 class NPObjectDeletePluginInNPN_Evaluate : public PluginTest { | |
58 public: | |
59 // Constructor. | |
60 NPObjectDeletePluginInNPN_Evaluate(NPP id, NPNetscapeFuncs *host_functions); | |
61 ~NPObjectDeletePluginInNPN_Evaluate(); | |
62 | |
63 // NPAPI SetWindow handler. | |
64 virtual NPError SetWindow(NPWindow* pNPWindow); | |
65 | |
66 protected: | |
67 NPObject* plugin_instance_object_; | |
68 #if defined(OS_WIN) | |
69 static void CALLBACK TimerProc(HWND window, UINT message, UINT timer_id, | |
70 unsigned long elapsed_milli_seconds); | |
71 UINT_PTR timer_id_; | |
72 #endif | |
73 | |
74 private: | |
75 static NPObjectDeletePluginInNPN_Evaluate* g_npn_evaluate_test_instance_; | |
76 | |
77 DISALLOW_IMPLICIT_CONSTRUCTORS(NPObjectDeletePluginInNPN_Evaluate); | |
78 }; | |
79 | |
80 } // namespace NPAPIClient | |
81 | |
82 #endif // WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_NPOBJECT_LIFETIME_TEST_H__ | |
OLD | NEW |