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