1 // Copyright 2014 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 "PluginTest.h"
8 extern NPNetscapeFuncs
*browser
;
10 class FormValue
: public PluginTest
{
12 FormValue(NPP npp
, const std::string
& identifier
)
13 : PluginTest(npp
, identifier
)
16 NPError
NPP_GetValue(NPPVariable
, void*) override
;
19 NPError
FormValue::NPP_GetValue(NPPVariable variable
, void *value
)
21 if (variable
== NPPVformValue
) {
22 static const char formValueText
[] = "Plugin form value";
23 *((void**)value
) = browser
->memalloc(sizeof(formValueText
));
24 if (!*((void**)value
))
25 return NPERR_OUT_OF_MEMORY_ERROR
;
26 strncpy(*((char**)value
), formValueText
, sizeof(formValueText
));
27 return NPERR_NO_ERROR
;
29 return NPERR_GENERIC_ERROR
;
32 static PluginTest::Register
<FormValue
> formValue("form-value");