OLD | NEW |
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 /* | 5 /* |
6 * Copyright (C) 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2010 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 class PassDifferentNPPStruct : public PluginTest { | 39 class PassDifferentNPPStruct : public PluginTest { |
40 public: | 40 public: |
41 PassDifferentNPPStruct(NPP npp, const string& identifier) | 41 PassDifferentNPPStruct(NPP npp, const string& identifier) |
42 : PluginTest(npp, identifier) | 42 : PluginTest(npp, identifier) |
43 , m_didReceiveInitialSetWindowCall(false) | 43 , m_didReceiveInitialSetWindowCall(false) |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 virtual NPError NPP_SetWindow(NPWindow* window) OVERRIDE | 48 virtual NPError NPP_SetWindow(NPWindow* window) override |
49 { | 49 { |
50 if (m_didReceiveInitialSetWindowCall) | 50 if (m_didReceiveInitialSetWindowCall) |
51 return NPERR_NO_ERROR; | 51 return NPERR_NO_ERROR; |
52 m_didReceiveInitialSetWindowCall = true; | 52 m_didReceiveInitialSetWindowCall = true; |
53 | 53 |
54 NPP oldNPP = m_npp; | 54 NPP oldNPP = m_npp; |
55 NPP_t differentNPP = *m_npp; | 55 NPP_t differentNPP = *m_npp; |
56 m_npp = &differentNPP; | 56 m_npp = &differentNPP; |
57 | 57 |
58 NPBool privateMode; | 58 NPBool privateMode; |
59 NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode); | 59 NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode); |
60 | 60 |
61 m_npp = oldNPP; | 61 m_npp = oldNPP; |
62 | 62 |
63 if (error != NPERR_NO_ERROR) { | 63 if (error != NPERR_NO_ERROR) { |
64 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct f
ailed with error %d", error); | 64 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct f
ailed with error %d", error); |
65 notifyDone(); | 65 notifyDone(); |
66 return NPERR_GENERIC_ERROR; | 66 return NPERR_GENERIC_ERROR; |
67 } | 67 } |
68 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succe
eded"); | 68 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succe
eded"); |
69 notifyDone(); | 69 notifyDone(); |
70 return NPERR_NO_ERROR; | 70 return NPERR_NO_ERROR; |
71 } | 71 } |
72 | 72 |
73 bool m_didReceiveInitialSetWindowCall; | 73 bool m_didReceiveInitialSetWindowCall; |
74 }; | 74 }; |
75 | 75 |
76 static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass
-different-npp-struct"); | 76 static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass
-different-npp-struct"); |
OLD | NEW |