| 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 NPError NPP_SetWindow(NPWindow* window) override { |
| 49 { | |
| 50 if (m_didReceiveInitialSetWindowCall) | 49 if (m_didReceiveInitialSetWindowCall) |
| 51 return NPERR_NO_ERROR; | 50 return NPERR_NO_ERROR; |
| 52 m_didReceiveInitialSetWindowCall = true; | 51 m_didReceiveInitialSetWindowCall = true; |
| 53 | 52 |
| 54 NPP oldNPP = m_npp; | 53 NPP oldNPP = m_npp; |
| 55 NPP_t differentNPP = *m_npp; | 54 NPP_t differentNPP = *m_npp; |
| 56 m_npp = &differentNPP; | 55 m_npp = &differentNPP; |
| 57 | 56 |
| 58 NPBool privateMode; | 57 NPBool privateMode; |
| 59 NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode); | 58 NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode); |
| 60 | 59 |
| 61 m_npp = oldNPP; | 60 m_npp = oldNPP; |
| 62 | 61 |
| 63 if (error != NPERR_NO_ERROR) { | 62 if (error != NPERR_NO_ERROR) { |
| 64 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct f
ailed with error %d", error); | 63 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct f
ailed with error %d", error); |
| 65 notifyDone(); | 64 notifyDone(); |
| 66 return NPERR_GENERIC_ERROR; | 65 return NPERR_GENERIC_ERROR; |
| 67 } | 66 } |
| 68 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succe
eded"); | 67 log("NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succe
eded"); |
| 69 notifyDone(); | 68 notifyDone(); |
| 70 return NPERR_NO_ERROR; | 69 return NPERR_NO_ERROR; |
| 71 } | 70 } |
| 72 | 71 |
| 73 bool m_didReceiveInitialSetWindowCall; | 72 bool m_didReceiveInitialSetWindowCall; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass
-different-npp-struct"); | 75 static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass
-different-npp-struct"); |
| OLD | NEW |