Home | History | Annotate | Download | only in plugin
      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.
      4 
      5 #include "content/test/plugin/plugin_test_factory.h"
      6 
      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"
     24 #if defined(OS_WIN)
     25 #include "content/test/plugin/plugin_windowed_test.h"
     26 #endif
     27 #include "content/test/plugin/plugin_windowless_test.h"
     28 
     29 namespace NPAPIClient {
     30 
     31 PluginTest* CreatePluginTest(const std::string& test_name,
     32                              NPP instance,
     33                              NPNetscapeFuncs* host_functions) {
     34   PluginTest* new_test = NULL;
     35 
     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     new_test = new PluginGetURLTest(instance, host_functions);
     43   } else if (test_name == "npobject_identity") {
     44     new_test = new NPObjectIdentityTest(instance, host_functions);
     45   } else if (test_name == "npobject_proxy") {
     46     new_test = new NPObjectProxyTest(instance, host_functions);
     47   } else if (test_name == "invoke_js_function_on_create" ||
     48              test_name == "resize_during_paint"
     49 #if defined(OS_WIN) || defined(OS_MACOSX)
     50           // TODO(port): plugin_windowless_test.*.
     51           || test_name == "execute_script_delete_in_paint" ||
     52              test_name == "execute_script_delete_in_mouse_up" ||
     53              test_name == "delete_frame_test" ||
     54              test_name == "multiple_instances_sync_calls" ||
     55              test_name == "no_hang_if_init_crashes" ||
     56              test_name == "convert_point"
     57 #endif
     58              ) {
     59     new_test = new WindowlessPluginTest(instance, host_functions);
     60   } else if (test_name == "getjavascripturl") {
     61     new_test = new ExecuteGetJavascriptUrlTest(instance, host_functions);
     62   } else if (test_name == "getjavascripturl2") {
     63     new_test = new ExecuteGetJavascriptUrl2Test(instance, host_functions);
     64 #if defined(OS_WIN)
     65   // TODO(port): plugin_window_size_test.*.
     66   } else if (test_name == "checkwindowrect") {
     67     new_test = new PluginWindowSizeTest(instance, host_functions);
     68 #endif
     69   } else if (test_name == "self_delete_plugin_stream") {
     70     new_test = new DeletePluginInStreamTest(instance, host_functions);
     71 #if defined(OS_WIN)
     72   // TODO(port): plugin_npobject_lifetime_test.*.
     73   } else if (test_name == "npobject_lifetime_test") {
     74     new_test = new NPObjectLifetimeTest(instance, host_functions);
     75   } else if (test_name == "npobject_lifetime_test_second_instance") {
     76     new_test = new NPObjectLifetimeTestInstance2(instance, host_functions);
     77   } else if (test_name == "new_fails") {
     78     new_test = new NewFailsTest(instance, host_functions);
     79   } else if (test_name == "npobject_delete_plugin_in_evaluate" ||
     80              test_name == "npobject_delete_create_plugin_in_evaluate") {
     81     new_test = new NPObjectDeletePluginInNPN_Evaluate(instance, host_functions);
     82 #endif
     83   } else if (test_name == "plugin_javascript_open_popup_with_plugin") {
     84     new_test = new ExecuteJavascriptOpenPopupWithPluginTest(
     85         instance, host_functions);
     86   } else if (test_name == "plugin_popup_with_plugin_target") {
     87     new_test = new ExecuteJavascriptPopupWindowTargetPluginTest(
     88         instance, host_functions);
     89   } else if (test_name == "plugin_thread_async_call") {
     90     new_test = new PluginThreadAsyncCallTest(instance, host_functions);
     91   } else if (test_name == "private") {
     92     new_test = new PrivateTest(instance, host_functions);
     93   } else if (test_name == "schedule_timer") {
     94     new_test = new ScheduleTimerTest(instance, host_functions);
     95 #if defined(OS_WIN)
     96   // TODO(port): plugin_windowed_test.*.
     97   } else if (test_name == "hidden_plugin" ||
     98              test_name == "create_instance_in_paint" ||
     99              test_name == "alert_in_window_message" ||
    100              test_name == "ensure_scripting_works_in_destroy") {
    101     new_test = new WindowedPluginTest(instance, host_functions);
    102 #endif
    103   } else if (test_name == "setup") {
    104     // "plugin" is the name for plugin documents.
    105     new_test = new PluginSetupTest(instance, host_functions);
    106   } else if (test_name == "delete_plugin_in_deallocate_test") {
    107     new_test = new DeletePluginInDeallocateTest(instance, host_functions);
    108   } else if (test_name == "plugin_request_read_single_range") {
    109     new_test = new PluginRequestReadTest(instance, host_functions);
    110   }
    111 
    112   return new_test;
    113 }
    114 
    115 } // namespace NPAPIClient
    116