Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 #include <string.h> 28 #include <string.h>
29 29
30 using namespace std; 30 using namespace std;
31 31
32 class NPRuntimeRemoveProperty : public PluginTest { 32 class NPRuntimeRemoveProperty : public PluginTest {
33 public: 33 public:
34 NPRuntimeRemoveProperty(NPP npp, const string& identifier) 34 NPRuntimeRemoveProperty(NPP npp, const string& identifier)
35 : PluginTest(npp, identifier) 35 : PluginTest(npp, identifier)
36 { 36 {
37 } 37 }
38 38
39 private: 39 private:
40 struct TestObject : Object<TestObject> { 40 struct TestObject : Object<TestObject> {
41 public: 41 public:
42 TestObject() 42 TestObject()
43 : m_lastRemovedProperty(0) 43 : m_lastRemovedProperty(0)
44 { 44 {
45 } 45 }
46 46
47 bool hasProperty(NPIdentifier propertyName) 47 bool hasProperty(NPIdentifier propertyName)
48 { 48 {
49 if (identifierIs(propertyName, "lastRemovedProperty")) 49 if (identifierIs(propertyName, "lastRemovedProperty"))
50 return true; 50 return true;
51 51
52 return false; 52 return false;
53 } 53 }
54 54
55 bool getProperty(NPIdentifier propertyName, NPVariant* result) 55 bool getProperty(NPIdentifier propertyName, NPVariant* result)
56 { 56 {
57 assert(identifierIs(propertyName, "lastRemovedProperty")); 57 assert(identifierIs(propertyName, "lastRemovedProperty"));
58 58
59 if (!m_lastRemovedProperty) 59 if (!m_lastRemovedProperty)
60 return false; 60 return false;
61 61
62 if (pluginTest()->NPN_IdentifierIsString(m_lastRemovedProperty)) { 62 if (pluginTest()->NPN_IdentifierIsString(m_lastRemovedProperty)) {
63 char* lastRemovedPropertyName = pluginTest()->NPN_UTF8FromIdenti fier(m_lastRemovedProperty); 63 char* lastRemovedPropertyName = pluginTest()->NPN_UTF8FromIdenti fier(m_lastRemovedProperty);
64 64
65 STRINGZ_TO_NPVARIANT(lastRemovedPropertyName, *result); 65 STRINGZ_TO_NPVARIANT(lastRemovedPropertyName, *result);
66 return true; 66 return true;
67 } 67 }
68 68
69 int intIdentifier = pluginTest()->NPN_IntFromIdentifier(m_lastRemove dProperty); 69 int intIdentifier = pluginTest()->NPN_IntFromIdentifier(m_lastRemove dProperty);
70 DOUBLE_TO_NPVARIANT(intIdentifier, *result); 70 DOUBLE_TO_NPVARIANT(intIdentifier, *result);
71 return true; 71 return true;
72 } 72 }
73 73
74 bool removeProperty(NPIdentifier propertyName) 74 bool removeProperty(NPIdentifier propertyName)
(...skipping 29 matching lines...) Expand all
104 104
105 bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_ t argumentCount, NPVariant* result) 105 bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_ t argumentCount, NPVariant* result)
106 { 106 {
107 assert(identifierIs(methodName, "testRemoveProperty")); 107 assert(identifierIs(methodName, "testRemoveProperty"));
108 108
109 if (argumentCount != 2) 109 if (argumentCount != 2)
110 return false; 110 return false;
111 111
112 if (!NPVARIANT_IS_OBJECT(arguments[0])) 112 if (!NPVARIANT_IS_OBJECT(arguments[0]))
113 return false; 113 return false;
114 114
115 if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(argum ents[1])) 115 if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(argum ents[1]))
116 return false; 116 return false;
117 117
118 NPIdentifier propertyName; 118 NPIdentifier propertyName;
119 if (NPVARIANT_IS_STRING(arguments[1])) { 119 if (NPVARIANT_IS_STRING(arguments[1])) {
120 string propertyNameString(arguments[1].value.stringValue.UTF8Cha racters, 120 string propertyNameString(arguments[1].value.stringValue.UTF8Cha racters,
121 arguments[1].value.stringValue.UTF8Len gth); 121 arguments[1].value.stringValue.UTF8Len gth);
122 122
123 propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNam eString.c_str()); 123 propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNam eString.c_str());
124 } else { 124 } else {
125 int32_t number = static_cast<int32_t>(arguments[1].value.doubleV alue); 125 int32_t number = static_cast<int32_t>(arguments[1].value.doubleV alue);
126 propertyName = pluginTest()->NPN_GetIntIdentifier(number); 126 propertyName = pluginTest()->NPN_GetIntIdentifier(number);
127 } 127 }
128 128
129 pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName); 129 pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName);
130 130
131 VOID_TO_NPVARIANT(*result); 131 VOID_TO_NPVARIANT(*result);
132 return true; 132 return true;
133 } 133 }
134 134
135 bool hasProperty(NPIdentifier propertyName) 135 bool hasProperty(NPIdentifier propertyName)
136 { 136 {
137 if (identifierIs(propertyName, "testObject")) 137 if (identifierIs(propertyName, "testObject"))
138 return true; 138 return true;
139 139
140 return false; 140 return false;
141 } 141 }
142 142
143 bool getProperty(NPIdentifier propertyName, NPVariant* result) 143 bool getProperty(NPIdentifier propertyName, NPVariant* result)
144 { 144 {
145 assert(identifierIs(propertyName, "testObject")); 145 assert(identifierIs(propertyName, "testObject"));
146 146
147 if (!m_testObject) 147 if (!m_testObject)
148 m_testObject = TestObject::create(pluginTest()); 148 m_testObject = TestObject::create(pluginTest());
149 149
150 OBJECT_TO_NPVARIANT(pluginTest()->NPN_RetainObject(m_testObject), *r esult); 150 OBJECT_TO_NPVARIANT(pluginTest()->NPN_RetainObject(m_testObject), *r esult);
151 return true; 151 return true;
152 } 152 }
153 153
154 private: 154 private:
155 NPObject* m_testObject; 155 NPObject* m_testObject;
156 }; 156 };
157 157
158 virtual NPError NPP_GetValue(NPPVariable variable, void *value) 158 virtual NPError NPP_GetValue(NPPVariable variable, void *value)
159 { 159 {
160 if (variable != NPPVpluginScriptableNPObject) 160 if (variable != NPPVpluginScriptableNPObject)
161 return NPERR_GENERIC_ERROR; 161 return NPERR_GENERIC_ERROR;
162 162
163 *(NPObject**)value = PluginObject::create(this); 163 *(NPObject**)value = PluginObject::create(this);
164 164
165 return NPERR_NO_ERROR; 165 return NPERR_NO_ERROR;
166 } 166 }
167 167
168 }; 168 };
169 169
170 static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("np runtime-remove-property"); 170 static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("np runtime-remove-property");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698