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
3 // found in the LICENSE file.
5 #ifndef CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_
6 #define CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_
10 #include "base/compiler_specific.h"
11 #include "content/test/plugin/plugin_test.h"
13 namespace NPAPIClient
{
15 // The PluginGetURLTest test functionality of the NPN_GetURL
16 // and NPN_GetURLNotify methods.
18 // This test first discovers it's URL by sending a GetURL request
19 // for 'javascript:top.location'. After receiving that, the
20 // test will request the url itself (again via GetURL).
21 class PluginGetURLTest
: public PluginTest
{
24 PluginGetURLTest(NPP id
, NPNetscapeFuncs
*host_functions
);
25 virtual ~PluginGetURLTest();
30 virtual NPError
New(uint16 mode
, int16 argc
, const char* argn
[],
31 const char* argv
[], NPSavedData
* saved
) OVERRIDE
;
32 virtual NPError
SetWindow(NPWindow
* pNPWindow
) OVERRIDE
;
33 virtual NPError
NewStream(NPMIMEType type
, NPStream
* stream
,
34 NPBool seekable
, uint16
* stype
) OVERRIDE
;
35 virtual int32
WriteReady(NPStream
*stream
) OVERRIDE
;
36 virtual int32
Write(NPStream
*stream
, int32 offset
, int32 len
,
37 void *buffer
) OVERRIDE
;
38 virtual NPError
DestroyStream(NPStream
*stream
, NPError reason
) OVERRIDE
;
39 virtual void StreamAsFile(NPStream
* stream
, const char* fname
) OVERRIDE
;
40 virtual void URLNotify(const char* url
, NPReason reason
,
42 virtual void URLRedirectNotify(const char* url
, int32_t status
,
43 void* notify_data
) OVERRIDE
;
47 int tests_in_progress_
;
48 std::string self_url_
;
50 bool expect_404_response_
;
51 // This flag is set to true in the context of the NPN_Evaluate call.
52 bool npn_evaluate_context_
;
53 // The following two flags handle URL redirect notifications received by
55 bool handle_url_redirects_
;
56 bool received_url_redirect_notification_
;
57 std::string page_not_found_url_
;
58 std::string fail_write_url_
;
59 std::string referrer_target_url_
;
62 } // namespace NPAPIClient
64 #endif // CONTENT_TEST_PLUGIN_PLUGIN_GETURL_TEST_H_