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