OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "content/test/plugin/plugin_npobject_lifetime_test.h" | 5 #include "content/test/plugin/plugin_npobject_lifetime_test.h" |
6 | 6 |
7 namespace NPAPIClient { | 7 namespace NPAPIClient { |
8 | 8 |
9 const int kNPObjectLifetimeTimer = 100; | 9 const int kNPObjectLifetimeTimer = 100; |
10 const int kNPObjectLifetimeTimerElapse = 2000; | 10 const int kNPObjectLifetimeTimerElapse = 2000; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 reinterpret_cast<void*>(1)); | 64 reinterpret_cast<void*>(1)); |
65 } | 65 } |
66 | 66 |
67 void NPObjectLifetimeTest::URLNotify(const char* url, NPReason reason, | 67 void NPObjectLifetimeTest::URLNotify(const char* url, NPReason reason, |
68 void* data) { | 68 void* data) { |
69 // Create a "location" identifier. | 69 // Create a "location" identifier. |
70 NPIdentifier identifier = HostFunctions()->getstringidentifier("location"); | 70 NPIdentifier identifier = HostFunctions()->getstringidentifier("location"); |
71 // Declare a local variant value. | 71 // Declare a local variant value. |
72 NPVariant variantValue; | 72 NPVariant variantValue; |
73 // Get the location property from the window object (which is another object). | 73 // Get the location property from the window object (which is another object). |
74 bool b1 = HostFunctions()->getproperty(id(), other_plugin_instance_object_, | 74 HostFunctions()->getproperty(id(), other_plugin_instance_object_, identifier, |
75 identifier, &variantValue ); | 75 &variantValue ); |
76 HostFunctions()->releaseobject(other_plugin_instance_object_); | 76 HostFunctions()->releaseobject(other_plugin_instance_object_); |
77 other_plugin_instance_object_ = NULL; | 77 other_plugin_instance_object_ = NULL; |
78 // If this test failed, then we'd have crashed by now. | 78 // If this test failed, then we'd have crashed by now. |
79 SignalTestCompleted(); | 79 SignalTestCompleted(); |
80 } | 80 } |
81 | 81 |
82 NPObjectLifetimeTestInstance2::NPObjectLifetimeTestInstance2( | 82 NPObjectLifetimeTestInstance2::NPObjectLifetimeTestInstance2( |
83 NPP id, NPNetscapeFuncs *host_functions) | 83 NPP id, NPNetscapeFuncs *host_functions) |
84 : PluginTest(id, host_functions) { | 84 : PluginTest(id, host_functions) { |
85 } | 85 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 return; | 158 return; |
159 } | 159 } |
160 | 160 |
161 std::string script = "javascript:DeletePluginWithinScript()"; | 161 std::string script = "javascript:DeletePluginWithinScript()"; |
162 NPString script_string; | 162 NPString script_string; |
163 script_string.UTF8Characters = script.c_str(); | 163 script_string.UTF8Characters = script.c_str(); |
164 script_string.UTF8Length = | 164 script_string.UTF8Length = |
165 static_cast<unsigned int>(script.length()); | 165 static_cast<unsigned int>(script.length()); |
166 | 166 |
167 NPVariant result_var; | 167 NPVariant result_var; |
168 bool result = g_npn_evaluate_test_instance_->HostFunctions()->evaluate( | 168 g_npn_evaluate_test_instance_->HostFunctions()->evaluate( |
169 g_npn_evaluate_test_instance_->id(), window_obj, | 169 g_npn_evaluate_test_instance_->id(), window_obj, |
170 &script_string, &result_var); | 170 &script_string, &result_var); |
171 // If this test failed we would have crashed by now. | 171 // If this test failed we would have crashed by now. |
172 } | 172 } |
173 | 173 |
174 } // namespace NPAPIClient | 174 } // namespace NPAPIClient |
OLD | NEW |