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 #include "content/test/plugin/plugin_test_factory.h"
7 #include "content/test/plugin/plugin_arguments_test.h"
8 #include "content/test/plugin/plugin_delete_plugin_in_stream_test.h"
9 #include "content/test/plugin/plugin_delete_plugin_in_deallocate_test.h"
10 #include "content/test/plugin/plugin_get_javascript_url_test.h"
11 #include "content/test/plugin/plugin_get_javascript_url2_test.h"
12 #include "content/test/plugin/plugin_geturl_test.h"
13 #include "content/test/plugin/plugin_javascript_open_popup.h"
14 #include "content/test/plugin/plugin_new_fails_test.h"
15 #include "content/test/plugin/plugin_npobject_identity_test.h"
16 #include "content/test/plugin/plugin_npobject_lifetime_test.h"
17 #include "content/test/plugin/plugin_npobject_proxy_test.h"
18 #include "content/test/plugin/plugin_private_test.h"
19 #include "content/test/plugin/plugin_request_read_test.h"
20 #include "content/test/plugin/plugin_schedule_timer_test.h"
21 #include "content/test/plugin/plugin_setup_test.h"
22 #include "content/test/plugin/plugin_thread_async_call_test.h"
23 #include "content/test/plugin/plugin_window_size_test.h"
25 #include "content/test/plugin/plugin_windowed_test.h"
27 #include "content/test/plugin/plugin_windowless_test.h"
29 namespace NPAPIClient
{
31 PluginTest
* CreatePluginTest(const std::string
& test_name
,
33 NPNetscapeFuncs
* host_functions
) {
34 PluginTest
* new_test
= NULL
;
36 if (test_name
== "arguments") {
37 new_test
= new PluginArgumentsTest(instance
, host_functions
);
38 } else if (test_name
== "geturl" || test_name
== "geturl_404_response" ||
39 test_name
== "geturl_fail_write" ||
40 test_name
== "plugin_referrer_test" ||
41 test_name
== "geturlredirectnotify" ||
42 test_name
== "cookies") {
43 new_test
= new PluginGetURLTest(instance
, host_functions
);
44 } else if (test_name
== "npobject_identity") {
45 new_test
= new NPObjectIdentityTest(instance
, host_functions
);
46 } else if (test_name
== "npobject_proxy") {
47 new_test
= new NPObjectProxyTest(instance
, host_functions
);
48 } else if (test_name
== "invoke_js_function_on_create" ||
49 test_name
== "resize_during_paint"
50 #if defined(OS_WIN) || defined(OS_MACOSX)
51 // TODO(port): plugin_windowless_test.*.
52 || test_name
== "execute_script_delete_in_paint" ||
53 test_name
== "execute_script_delete_in_mouse_up" ||
54 test_name
== "delete_frame_test" ||
55 test_name
== "multiple_instances_sync_calls" ||
56 test_name
== "no_hang_if_init_crashes" ||
57 test_name
== "convert_point"
60 new_test
= new WindowlessPluginTest(instance
, host_functions
);
61 } else if (test_name
== "getjavascripturl") {
62 new_test
= new ExecuteGetJavascriptUrlTest(instance
, host_functions
);
63 } else if (test_name
== "getjavascripturl2") {
64 new_test
= new ExecuteGetJavascriptUrl2Test(instance
, host_functions
);
66 // TODO(port): plugin_window_size_test.*.
67 } else if (test_name
== "checkwindowrect") {
68 new_test
= new PluginWindowSizeTest(instance
, host_functions
);
70 } else if (test_name
== "self_delete_plugin_stream") {
71 new_test
= new DeletePluginInStreamTest(instance
, host_functions
);
73 // TODO(port): plugin_npobject_lifetime_test.*.
74 } else if (test_name
== "npobject_lifetime_test") {
75 new_test
= new NPObjectLifetimeTest(instance
, host_functions
);
76 } else if (test_name
== "npobject_lifetime_test_second_instance") {
77 new_test
= new NPObjectLifetimeTestInstance2(instance
, host_functions
);
78 } else if (test_name
== "new_fails") {
79 new_test
= new NewFailsTest(instance
, host_functions
);
80 } else if (test_name
== "npobject_delete_plugin_in_evaluate" ||
81 test_name
== "npobject_delete_create_plugin_in_evaluate") {
82 new_test
= new NPObjectDeletePluginInNPN_Evaluate(instance
, host_functions
);
84 } else if (test_name
== "plugin_javascript_open_popup_with_plugin") {
85 new_test
= new ExecuteJavascriptOpenPopupWithPluginTest(
86 instance
, host_functions
);
87 } else if (test_name
== "plugin_popup_with_plugin_target") {
88 new_test
= new ExecuteJavascriptPopupWindowTargetPluginTest(
89 instance
, host_functions
);
90 } else if (test_name
== "plugin_thread_async_call") {
91 new_test
= new PluginThreadAsyncCallTest(instance
, host_functions
);
92 } else if (test_name
== "private") {
93 new_test
= new PrivateTest(instance
, host_functions
);
94 } else if (test_name
== "schedule_timer") {
95 new_test
= new ScheduleTimerTest(instance
, host_functions
);
97 // TODO(port): plugin_windowed_test.*.
98 } else if (test_name
== "hidden_plugin" ||
99 test_name
== "create_instance_in_paint" ||
100 test_name
== "alert_in_window_message" ||
101 test_name
== "ensure_scripting_works_in_destroy" ||
102 test_name
== "set_title_in_paint" ||
103 test_name
== "set_title_in_set_window_and_paint") {
104 new_test
= new WindowedPluginTest(instance
, host_functions
);
106 } else if (test_name
== "setup") {
107 // "plugin" is the name for plugin documents.
108 new_test
= new PluginSetupTest(instance
, host_functions
);
109 } else if (test_name
== "delete_plugin_in_deallocate_test") {
110 new_test
= new DeletePluginInDeallocateTest(instance
, host_functions
);
111 } else if (test_name
== "plugin_request_read_single_range") {
112 new_test
= new PluginRequestReadTest(instance
, host_functions
);
118 } // namespace NPAPIClient