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) 2011 Apple Inc. All rights reserved. | 6 * Copyright (C) 2011 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 static const char *urlThatFailsToLoad = "foo://bar/"; | 38 static const char *urlThatFailsToLoad = "foo://bar/"; |
39 | 39 |
40 class GetURLNotifyWithURLThatFailsToLoad : public PluginTest { | 40 class GetURLNotifyWithURLThatFailsToLoad : public PluginTest { |
41 public: | 41 public: |
42 GetURLNotifyWithURLThatFailsToLoad(NPP npp, const string& identifier) | 42 GetURLNotifyWithURLThatFailsToLoad(NPP npp, const string& identifier) |
43 : PluginTest(npp, identifier) | 43 : PluginTest(npp, identifier) |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 virtual NPError NPP_New(NPMIMEType pluginType, | 48 NPError NPP_New(NPMIMEType pluginType, |
49 uint16_t mode, | 49 uint16_t mode, |
50 int16_t argc, | 50 int16_t argc, |
51 char* argn[], | 51 char* argn[], |
52 char* argv[], | 52 char* argv[], |
53 NPSavedData* saved) override { | 53 NPSavedData* saved) override { |
54 NPN_GetURLNotify(urlThatFailsToLoad, 0, reinterpret_cast<void*>(0x123456
78)); | 54 NPN_GetURLNotify(urlThatFailsToLoad, 0, reinterpret_cast<void*>(0x123456
78)); |
55 return NPERR_NO_ERROR; | 55 return NPERR_NO_ERROR; |
56 } | 56 } |
57 | 57 |
58 virtual bool NPP_URLNotify(const char* url, NPReason reason, void* notifyDat
a) override | 58 bool NPP_URLNotify(const char* url, |
59 { | 59 NPReason reason, |
| 60 void* notifyData) override { |
60 bool didFail = false; | 61 bool didFail = false; |
61 | 62 |
62 if (strcmp(url, urlThatFailsToLoad)) | 63 if (strcmp(url, urlThatFailsToLoad)) |
63 didFail = true; | 64 didFail = true; |
64 | 65 |
65 if (reason != NPRES_NETWORK_ERR) | 66 if (reason != NPRES_NETWORK_ERR) |
66 didFail = true; | 67 didFail = true; |
67 | 68 |
68 if (notifyData != reinterpret_cast<void*>(0x12345678)) | 69 if (notifyData != reinterpret_cast<void*>(0x12345678)) |
69 didFail = true; | 70 didFail = true; |
70 | 71 |
71 if (!didFail) | 72 if (!didFail) |
72 executeScript("testSucceeded()"); | 73 executeScript("testSucceeded()"); |
73 else | 74 else |
74 executeScript("notifyDone()"); | 75 executeScript("notifyDone()"); |
75 return true; | 76 return true; |
76 } | 77 } |
77 }; | 78 }; |
78 | 79 |
79 static PluginTest::Register<GetURLNotifyWithURLThatFailsToLoad> getURLWithJavaSc
riptURLDestroyingPlugin("get-url-notify-with-url-that-fails-to-load"); | 80 static PluginTest::Register<GetURLNotifyWithURLThatFailsToLoad> getURLWithJavaSc
riptURLDestroyingPlugin("get-url-notify-with-url-that-fails-to-load"); |
OLD | NEW |