OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_ | 5 #ifndef CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_ |
6 #define CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_ | 6 #define CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "content/test/plugin/plugin_test.h" | 11 #include "content/test/plugin/plugin_test.h" |
12 | 12 |
13 namespace NPAPIClient { | 13 namespace NPAPIClient { |
14 | 14 |
15 // The PluginGetURLTest test functionality of the NPN_GetURL | 15 // The PluginGetURLTest test functionality of the NPN_GetURL |
16 // and NPN_GetURLNotify methods. | 16 // and NPN_GetURLNotify methods. |
17 // | 17 // |
18 // This test first discovers it's URL by sending a GetURL request | 18 // This test first discovers it's URL by sending a GetURL request |
19 // for 'javascript:top.location'. After receiving that, the | 19 // for 'javascript:top.location'. After receiving that, the |
20 // test will request the url itself (again via GetURL). | 20 // test will request the url itself (again via GetURL). |
21 class PluginGetURLTest : public PluginTest { | 21 class PluginGetURLTest : public PluginTest { |
22 public: | 22 public: |
23 // Constructor. | 23 // Constructor. |
24 PluginGetURLTest(NPP id, NPNetscapeFuncs *host_functions); | 24 PluginGetURLTest(NPP id, NPNetscapeFuncs *host_functions); |
25 virtual ~PluginGetURLTest(); | 25 ~PluginGetURLTest() override; |
26 | 26 |
27 // | 27 // |
28 // NPAPI functions | 28 // NPAPI functions |
29 // | 29 // |
30 virtual NPError New(uint16 mode, int16 argc, const char* argn[], | 30 NPError New(uint16 mode, |
31 const char* argv[], NPSavedData* saved) override; | 31 int16 argc, |
32 virtual NPError SetWindow(NPWindow* pNPWindow) override; | 32 const char* argn[], |
33 virtual NPError NewStream(NPMIMEType type, NPStream* stream, | 33 const char* argv[], |
34 NPBool seekable, uint16* stype) override; | 34 NPSavedData* saved) override; |
35 virtual int32 WriteReady(NPStream *stream) override; | 35 NPError SetWindow(NPWindow* pNPWindow) override; |
36 virtual int32 Write(NPStream *stream, int32 offset, int32 len, | 36 NPError NewStream(NPMIMEType type, |
37 void *buffer) override; | 37 NPStream* stream, |
38 virtual NPError DestroyStream(NPStream *stream, NPError reason) override; | 38 NPBool seekable, |
39 virtual void StreamAsFile(NPStream* stream, const char* fname) override; | 39 uint16* stype) override; |
40 virtual void URLNotify(const char* url, NPReason reason, | 40 int32 WriteReady(NPStream* stream) override; |
41 void* data) override; | 41 int32 Write(NPStream* stream, int32 offset, int32 len, void* buffer) override; |
42 virtual void URLRedirectNotify(const char* url, int32_t status, | 42 NPError DestroyStream(NPStream* stream, NPError reason) override; |
43 void* notify_data) override; | 43 void StreamAsFile(NPStream* stream, const char* fname) override; |
| 44 void URLNotify(const char* url, NPReason reason, void* data) override; |
| 45 void URLRedirectNotify(const char* url, |
| 46 int32_t status, |
| 47 void* notify_data) override; |
44 | 48 |
45 private: | 49 private: |
46 bool tests_started_; | 50 bool tests_started_; |
47 int tests_in_progress_; | 51 int tests_in_progress_; |
48 std::string self_url_; | 52 std::string self_url_; |
49 FILE* test_file_; | 53 FILE* test_file_; |
50 bool expect_404_response_; | 54 bool expect_404_response_; |
51 // This flag is set to true in the context of the NPN_Evaluate call. | 55 // This flag is set to true in the context of the NPN_Evaluate call. |
52 bool npn_evaluate_context_; | 56 bool npn_evaluate_context_; |
53 // The following two flags handle URL redirect notifications received by | 57 // The following two flags handle URL redirect notifications received by |
54 // plugins. | 58 // plugins. |
55 bool handle_url_redirects_; | 59 bool handle_url_redirects_; |
56 bool received_url_redirect_cancel_notification_; | 60 bool received_url_redirect_cancel_notification_; |
57 bool received_url_redirect_allow_notification_; | 61 bool received_url_redirect_allow_notification_; |
58 std::string page_not_found_url_; | 62 std::string page_not_found_url_; |
59 std::string fail_write_url_; | 63 std::string fail_write_url_; |
60 std::string referrer_target_url_; | 64 std::string referrer_target_url_; |
61 bool check_cookies_; | 65 bool check_cookies_; |
62 }; | 66 }; |
63 | 67 |
64 } // namespace NPAPIClient | 68 } // namespace NPAPIClient |
65 | 69 |
66 #endif // CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_ | 70 #endif // CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_ |
OLD | NEW |