From 902dd29a4b6c5187570f30946d1772513d33e46e Mon Sep 17 00:00:00 2001
From: "evanm@google.com"
 <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Mon, 13 Oct 2008 15:45:20 +0000
Subject: Minimal change to make test_shell_tests link and run zero tests on
 Linux.

Review URL: http://codereview.chromium.org/1603


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3288 0039d316-1c4b-4281-b951-d872f2087c98
---
 webkit/SConscript                        |   2 +-
 webkit/tools/test_shell/SConscript       | 245 +++++++++++++++++--------------
 webkit/tools/test_shell/run_all_tests.cc |   9 ++
 3 files changed, 147 insertions(+), 109 deletions(-)

(limited to 'webkit')

diff --git a/webkit/SConscript b/webkit/SConscript
index a02b097..2b48314 100644
--- a/webkit/SConscript
+++ b/webkit/SConscript
@@ -211,6 +211,7 @@ sconscript_dirs = [
   'glue/SConscript',
   'glue/plugins/test/SConscript',
   'tools/npapi_layout_test_plugin/SConscript',
+  'tools/test_shell/SConscript',
 ]
 if env['PLATFORM'] == 'win32':
   # These extra dirs aren't win32-specific, they're just the dirs that
@@ -222,7 +223,6 @@ if env['PLATFORM'] == 'win32':
     'build/WebCore/SConscript',  # This almost works on linux.  It requires
                                  # some changes to WebKit that we'll get
                                  # in the merge.
-    'tools/test_shell/SConscript',
   ])
 
   env.Append(
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript
index 93fb762..7491670 100644
--- a/webkit/tools/test_shell/SConscript
+++ b/webkit/tools/test_shell/SConscript
@@ -7,16 +7,17 @@ Import('env', 'env_res')
 env = env.Clone()
 env_res = env_res.Clone()
 
-env_res.Append(
-    CPPPATH = [
-        '.',
-        '#/..',
-        '$NET_DIR',
-    ],
-    RCFLAGS = [
-        ['/l', '0x409'],
-    ],
-)
+if env['PLATFORM'] == 'win32':
+  env_res.Append(
+      CPPPATH = [
+          '.',
+          '#/..',
+          '$NET_DIR',
+      ],
+      RCFLAGS = [
+          ['/l', '0x409'],
+      ],
+  )
 
 env.Append(
     CPPPATH = [
@@ -29,7 +30,6 @@ env.Append(
         'base',
         'base_gfx',
         'breakpad_handler',
-        'breakpad_sender',
         'googleurl',
         'net',
         'sdch',
@@ -46,124 +46,153 @@ env.Append(
         'v8',
         'JavaScriptCore_pcre',
         'port',
-        'activex_shim',
         'WTF',
         'V8Bindings',
-        'WebCore',
         'default_plugin',
         'glue',
     ],
 )
 
-env.Append(
-    LIBS = [
-        'comctl32.lib',
-        'rpcrt4.lib',
-        'shlwapi.lib',
-        'winmm.lib',
-    ],
-
-    LINKFLAGS = [
-        '/DELAYLOAD:"ws2_32.dll"',
-        '/DELAYLOAD:"dwmapi.dll"',
-        '/DELAYLOAD:"uxtheme.dll"',
-        '/FIXED:No',
-        '/SUBSYSTEM:CONSOLE',
-        '/MACHINE:X86',
-        '/safeseh',
-        '/dynamicbase',
-        '/ignore:4199',
-        '/nxcompat',
-    ],
-)
-
-input_files = [
-    'drag_delegate.cc',
-    'drop_delegate.cc',
-    'event_sending_controller.cc',
-    'layout_test_controller.cc',
-    'simple_resource_loader_bridge.cc',
-    'test_navigation_controller.cc',
-    'test_shell.cc',
-    'test_shell_switches.cc',
-    'test_shell_request_context.cc',
-    'test_webview_delegate.cc',
-    'text_input_controller.cc',
-    'webview_host.cc',
-    'webwidget_host.cc',
-]
+if env['PLATFORM'] == 'win32':
+  # TODO(port): put portable libs in above declaration.
+  env.Append(
+      LIBS = [
+          'activex_shim',
+          'breakpad_sender',
+          'WebCore',
+      ]
+  )
+
+if env['PLATFORM'] == 'win32':
+  env.Append(
+      LIBS = [
+          'comctl32.lib',
+          'rpcrt4.lib',
+          'shlwapi.lib',
+          'winmm.lib',
+      ],
+
+      LINKFLAGS = [
+          '/DELAYLOAD:"ws2_32.dll"',
+          '/DELAYLOAD:"dwmapi.dll"',
+          '/DELAYLOAD:"uxtheme.dll"',
+          '/FIXED:No',
+          '/SUBSYSTEM:CONSOLE',
+          '/MACHINE:X86',
+          '/safeseh',
+          '/dynamicbase',
+          '/ignore:4199',
+          '/nxcompat',
+      ],
+  )
+elif env['PLATFORM'] in ('posix', 'darwin'):
+  env.Append(
+      LIBS = [
+          'event',
+      ]
+  )
+
+input_files = []
+
+if env['PLATFORM'] == 'win32':
+  # TODO(port): put portable files in above test_files declaration.
+  input_files = [
+      'drag_delegate.cc',
+      'drop_delegate.cc',
+      'event_sending_controller.cc',
+      'layout_test_controller.cc',
+      'simple_resource_loader_bridge.cc',
+      'test_navigation_controller.cc',
+      'test_shell.cc',
+      'test_shell_switches.cc',
+      'test_shell_request_context.cc',
+      'test_webview_delegate.cc',
+      'text_input_controller.cc',
+      'webview_host.cc',
+      'webwidget_host.cc',
+  ]
 
 lib = env.ChromeStaticLibrary('test_shell', input_files)
 
 
 
-resources = [
-    env_res.RES('resources/test_shell.rc'),
-    '$NET_DIR/net_resources.res',
-    '$WEBKIT_DIR/build/localized_strings/webkit_strings_en-US.res',
-]
+resources = []
+if env['PLATFORM'] == 'win32':
+  # TODO(port): figure out what to do with resources.
+  resources = [
+      env_res.RES('resources/test_shell.rc'),
+      '$NET_DIR/net_resources.res',
+      '$WEBKIT_DIR/build/localized_strings/webkit_strings_en-US.res',
+  ]
 
 
-exe_input_files = [
-    'test_shell_main.cc',
-    '$V8_DIR/snapshot-empty$OBJSUFFIX'
-]
+if env['PLATFORM'] == 'win32':
+  exe_input_files = [
+      'test_shell_main.cc',
+      '$V8_DIR/snapshot-empty$OBJSUFFIX'
+  ]
 
-test_shell = env.ChromeProgram('test_shell', resources + exe_input_files)
-i = env.Install('$TARGET_ROOT', test_shell)
-env.Alias('webkit', i)
+  test_shell = env.ChromeProgram('test_shell', resources + exe_input_files)
 
-env.Depends(test_shell, '$V8_DIR/vc80.pdb')
+  i = env.Install('$TARGET_ROOT', test_shell)
+  env.Alias('webkit', i)
 
+  env.Depends(test_shell, '$V8_DIR/vc80.pdb')
 
 test_files = [
-    'drag_delegate.cc',
-    'drop_delegate.cc',
-    'event_sending_controller.cc',
-    'image_decoder_unittest.cc',
-    'keyboard_unittest.cc',
-    'layout_test_controller.cc',
-    'layout_test_controller_unittest.cc',
-    'node_leak_test.cc',
-    'plugin_tests.cc',
-    'run_all_tests.cc',
-    'simple_resource_loader_bridge.cc',
-    'test_navigation_controller.cc',
-    'test_shell.cc',
-    'test_shell_request_context.cc',
-    'test_shell_switches.cc',
-    'test_shell_test.cc',
-    'test_webview_delegate.cc',
-    'text_input_controller.cc',
-    'text_input_controller_unittest.cc',
-    'webview_host.cc',
-    'webwidget_host.cc',
-    '$WEBKIT_DIR/glue/autocomplete_input_listener_unittest.cc',
-    '$WEBKIT_DIR/glue/bookmarklet_unittest.cc',
-    '$WEBKIT_DIR/glue/context_menu_unittest.cc',
-    '$WEBKIT_DIR/glue/cpp_bound_class_unittest.cc',
-    '$WEBKIT_DIR/glue/cpp_variant_unittest.cc',
-    '$WEBKIT_DIR/glue/dom_operations_unittest.cc',
-    '$WEBKIT_DIR/glue/dom_serializer_unittest.cc',
-    '$WEBKIT_DIR/glue/glue_serialize_unittest.cc',
-    '$WEBKIT_DIR/glue/iframe_redirect_unittest.cc',
-    '$WEBKIT_DIR/glue/mimetype_unittest.cc',
-    '$WEBKIT_DIR/glue/multipart_response_delegate_unittest.cc',
-    '$WEBKIT_DIR/glue/password_autocomplete_listener_unittest.cc',
-    '$WEBKIT_DIR/glue/regular_expression_unittest.cc',
-    '$WEBKIT_DIR/glue/resource_fetcher_unittest.cc',
-    # Commented out until a regression is fixed and this file is restored.
-    #'$WEBKIT_DIR/glue/stringimpl_unittest.cc',
-    '$WEBKIT_DIR/glue/webframe_unittest.cc',
-    '$WEBKIT_DIR/glue/webplugin_impl_unittest.cc',
-    '$WEBKIT_DIR/port/platform/GKURL_unittest.cpp',
-    '$WEBKIT_DIR/port/platform/image-decoders/bmp/BMPImageDecoder_unittest.cpp',
-    '$WEBKIT_DIR/port/platform/image-decoders/ico/ICOImageDecoder_unittest.cpp',
-    '$WEBKIT_DIR/port/platform/image-decoders/xbm/XBMImageDecoder_unittest.cpp',
-
-    '$V8_DIR/snapshot-empty$OBJSUFFIX',
+   'run_all_tests.cc',
 ]
 
+if env['PLATFORM'] == 'win32':
+  # TODO(port): put portable files in above test_files declaration.
+  test_files.extend([
+      'drag_delegate.cc',
+      'drop_delegate.cc',
+      'event_sending_controller.cc',
+      'image_decoder_unittest.cc',
+      'keyboard_unittest.cc',
+      'layout_test_controller.cc',
+      'layout_test_controller_unittest.cc',
+      'node_leak_test.cc',
+      'plugin_tests.cc',
+      'run_all_tests.cc',
+      'simple_resource_loader_bridge.cc',
+      'test_navigation_controller.cc',
+      'test_shell.cc',
+      'test_shell_request_context.cc',
+      'test_shell_switches.cc',
+      'test_shell_test.cc',
+      'test_webview_delegate.cc',
+      'text_input_controller.cc',
+      'text_input_controller_unittest.cc',
+      'webview_host.cc',
+      'webwidget_host.cc',
+      '$WEBKIT_DIR/glue/autocomplete_input_listener_unittest.cc',
+      '$WEBKIT_DIR/glue/bookmarklet_unittest.cc',
+      '$WEBKIT_DIR/glue/context_menu_unittest.cc',
+      '$WEBKIT_DIR/glue/cpp_bound_class_unittest.cc',
+      '$WEBKIT_DIR/glue/cpp_variant_unittest.cc',
+      '$WEBKIT_DIR/glue/dom_operations_unittest.cc',
+      '$WEBKIT_DIR/glue/dom_serializer_unittest.cc',
+      '$WEBKIT_DIR/glue/glue_serialize_unittest.cc',
+      '$WEBKIT_DIR/glue/iframe_redirect_unittest.cc',
+      '$WEBKIT_DIR/glue/mimetype_unittest.cc',
+      '$WEBKIT_DIR/glue/multipart_response_delegate_unittest.cc',
+      '$WEBKIT_DIR/glue/password_autocomplete_listener_unittest.cc',
+      '$WEBKIT_DIR/glue/regular_expression_unittest.cc',
+      '$WEBKIT_DIR/glue/resource_fetcher_unittest.cc',
+      # Commented out until a regression is fixed and this file is restored.
+      #'$WEBKIT_DIR/glue/stringimpl_unittest.cc',
+      '$WEBKIT_DIR/glue/webframe_unittest.cc',
+      '$WEBKIT_DIR/glue/webplugin_impl_unittest.cc',
+      '$WEBKIT_DIR/port/platform/GKURL_unittest.cpp',
+      '$WEBKIT_DIR/port/platform/image-decoders/bmp/BMPImageDecoder_unittest.cpp',
+      '$WEBKIT_DIR/port/platform/image-decoders/ico/ICOImageDecoder_unittest.cpp',
+      '$WEBKIT_DIR/port/platform/image-decoders/xbm/XBMImageDecoder_unittest.cpp',
+
+      '$V8_DIR/snapshot-empty$OBJSUFFIX',
+  ])
+
 test_shell_tests = env.ChromeTestProgram('test_shell_tests',
                                          resources + test_files)
 i = env.Install('$TARGET_ROOT', test_shell_tests)
diff --git a/webkit/tools/test_shell/run_all_tests.cc b/webkit/tools/test_shell/run_all_tests.cc
index 8eaa0c5..0b3abe6 100644
--- a/webkit/tools/test_shell/run_all_tests.cc
+++ b/webkit/tools/test_shell/run_all_tests.cc
@@ -5,8 +5,10 @@
 // Run all of our test shell tests.  This is just an entry point
 // to kick off gTest's RUN_ALL_TESTS().
 
+#if defined(OS_WIN)
 #include <windows.h>
 #include <commctrl.h>
+#endif
 
 #include "base/at_exit.h"
 #include "base/icu_util.h"
@@ -32,6 +34,7 @@ int main(int argc, char* argv[]) {
   // the AtExitManager or else we will leak objects.
   base::AtExitManager at_exit_manager;  
 
+#if defined(OS_WIN)
   TestShell::InitLogging(true);  // suppress error dialogs
 
   // Initialize test shell in non-interactive mode, which will let us load one
@@ -43,6 +46,7 @@ int main(int argc, char* argv[]) {
   // so just set it to be a really large number.  This is necessary because
   // when running under Purify, we were hitting those timeouts.
   TestShell::SetFileTestTimeout(USER_TIMER_MAXIMUM);
+#endif
 
   // Allocate a message loop for this thread.  Although it is not used
   // directly, its constructor sets up some necessary state.
@@ -51,18 +55,23 @@ int main(int argc, char* argv[]) {
   // Load ICU data tables
   icu_util::Initialize();
 
+#if defined(OS_WIN)
   INITCOMMONCONTROLSEX InitCtrlEx;
 
   InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
   InitCtrlEx.dwICC  = ICC_STANDARD_CLASSES;
   InitCommonControlsEx(&InitCtrlEx);
+#endif
 
   // Run the actual tests
   testing::InitGoogleTest(&argc, argv);
   int result = RUN_ALL_TESTS();
 
+#if defined(OS_WIN)
   TestShell::ShutdownTestShell();
   TestShell::CleanupLogging();
+#endif
+
   return result;
 }
 
-- 
cgit v1.1