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

Side by Side Diff: content/shell/tools/plugin/Tests/LeakWindowScriptableObject.cpp

Issue 629143003: Replace OVERRIDE and FINAL with override and final in content/shell/[a-s]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "PluginTest.h" 5 #include "PluginTest.h"
6 6
7 using namespace std; 7 using namespace std;
8 8
9 class LeakWindowScriptableObject : public PluginTest { 9 class LeakWindowScriptableObject : public PluginTest {
10 public: 10 public:
11 LeakWindowScriptableObject(NPP npp, const string& identifier) 11 LeakWindowScriptableObject(NPP npp, const string& identifier)
12 : PluginTest(npp, identifier) 12 : PluginTest(npp, identifier)
13 { 13 {
14 } 14 }
15 15
16 private: 16 private:
17 virtual NPError NPP_New(NPMIMEType pluginType, 17 virtual NPError NPP_New(NPMIMEType pluginType,
18 uint16_t mode, 18 uint16_t mode,
19 int16_t argc, 19 int16_t argc,
20 char* argn[], 20 char* argn[],
21 char* argv[], 21 char* argv[],
22 NPSavedData* saved) OVERRIDE { 22 NPSavedData* saved) override {
23 // Get a new reference to the window script object. 23 // Get a new reference to the window script object.
24 NPObject* window; 24 NPObject* window;
25 if (NPN_GetValue(NPNVWindowNPObject, &window) != NPERR_NO_ERROR) { 25 if (NPN_GetValue(NPNVWindowNPObject, &window) != NPERR_NO_ERROR) {
26 log("Fail: Cannot fetch window script object"); 26 log("Fail: Cannot fetch window script object");
27 return NPERR_NO_ERROR; 27 return NPERR_NO_ERROR;
28 } 28 }
29 29
30 // Get another reference to the same object via window.self. 30 // Get another reference to the same object via window.self.
31 NPIdentifier self_name = NPN_GetStringIdentifier("self"); 31 NPIdentifier self_name = NPN_GetStringIdentifier("self");
32 NPVariant window_self_variant; 32 NPVariant window_self_variant;
33 if (!NPN_GetProperty(window, self_name, &window_self_variant)) { 33 if (!NPN_GetProperty(window, self_name, &window_self_variant)) {
34 log("Fail: Cannot query window.self"); 34 log("Fail: Cannot query window.self");
35 return NPERR_NO_ERROR; 35 return NPERR_NO_ERROR;
36 } 36 }
37 if (!NPVARIANT_IS_OBJECT(window_self_variant)) { 37 if (!NPVARIANT_IS_OBJECT(window_self_variant)) {
38 log("Fail: window.self is not an object"); 38 log("Fail: window.self is not an object");
39 return NPERR_NO_ERROR; 39 return NPERR_NO_ERROR;
40 } 40 }
41 41
42 // Leak both references to the window script object. 42 // Leak both references to the window script object.
43 return NPERR_NO_ERROR; 43 return NPERR_NO_ERROR;
44 } 44 }
45 }; 45 };
46 46
47 static PluginTest::Register<LeakWindowScriptableObject> leakWindowScriptableObje ct("leak-window-scriptable-object"); 47 static PluginTest::Register<LeakWindowScriptableObject> leakWindowScriptableObje ct("leak-window-scriptable-object");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698