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