Refactor management of overview window copy lifetime into a separate class.
[chromium-blink-merge.git] / content / test / plugin / plugin_delete_plugin_in_stream_test.cc
blobedb2bbef82a0da4ec0e96c1904c7a185a863df97
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
3 // found in the LICENSE file.
5 #include "content/test/plugin/plugin_delete_plugin_in_stream_test.h"
7 #include "content/test/plugin/plugin_client.h"
9 namespace NPAPIClient {
11 #define kUrl "javascript:window.location+\"\""
12 #define kUrlStreamId 1
14 DeletePluginInStreamTest::DeletePluginInStreamTest(NPP id, NPNetscapeFuncs *host_functions)
15 : PluginTest(id, host_functions),
16 test_started_(false) {
19 NPError DeletePluginInStreamTest::SetWindow(NPWindow* pNPWindow) {
20 #if !defined(OS_MACOSX)
21 if (pNPWindow->window == NULL)
22 return NPERR_NO_ERROR;
23 #endif
25 if (!test_started_) {
26 std::string url = "self_delete_plugin_stream.html";
27 HostFunctions()->geturlnotify(id(), url.c_str(), NULL,
28 reinterpret_cast<void*>(kUrlStreamId));
29 test_started_ = true;
31 return NPERR_NO_ERROR;
34 NPError DeletePluginInStreamTest::NewStream(NPMIMEType type, NPStream* stream,
35 NPBool seekable, uint16* stype) {
36 NPIdentifier delete_id = HostFunctions()->getstringidentifier("DeletePluginWithinScript");
38 NPObject *window_obj = NULL;
39 HostFunctions()->getvalue(id(), NPNVWindowNPObject, &window_obj);
41 NPVariant rv;
42 HostFunctions()->invoke(id(), window_obj, delete_id, NULL, 0, &rv);
44 return NPERR_NO_ERROR;
47 } // namespace NPAPIClient