Skip to content
Snippets Groups Projects
Commit c99613d0 authored by jianli@chromium.org's avatar jianli@chromium.org
Browse files

Fix bug 23303: ui_tests crash Windows 7's shell when running WorkerHttpLayoutTests.

The crash is caused by lighttpd server starting on the foreground mode and it messed up with the command window host.
To work around this, we start the http server on the background mode if running UI test under Windows 7.

BUG=23303
TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28030 0039d316-1c4b-4281-b951-d872f2087c98
parent 1568d5ec
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,10 @@
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
#if defined(OS_WIN)
#include "base/win_util.h"
#endif
using base::TimeTicks;
......@@ -307,6 +311,15 @@ void UITest::StartHttpServer(const FilePath& root_directory) {
cmd_line->AppendSwitchWithValue(L"server", L"start");
cmd_line->AppendSwitch(L"register_cygwin");
cmd_line->AppendSwitchWithValue(L"root", root_directory.ToWStringHack());
// For Windows 7, if we start the lighttpd server on the foreground mode,
// it will mess up with the command window and cause conhost.exe to crash. To
// work around this, we start the http server on the background mode.
#if defined(OS_WIN)
if (win_util::GetWinVersion() >= win_util::WINVERSION_WIN7)
cmd_line->AppendSwitch(L"run_background");
#endif
RunCommand(*cmd_line.get());
}
......
......@@ -84,7 +84,7 @@ class Lighttpd:
def __init__(self, output_dir, background=False, port=None, root=None,
register_cygwin=None):
register_cygwin=None, run_background=None):
"""Args:
output_dir: the absolute path to the layout test result directory
"""
......@@ -93,6 +93,7 @@ class Lighttpd:
self._port = port
self._root = root
self._register_cygwin = register_cygwin
self._run_background = run_background
if self._port:
self._port = int(self._port)
......@@ -181,9 +182,11 @@ class Lighttpd:
'-f', path_utils.PathFromBase(self._output_dir,
'lighttpd.conf'),
# Where it can find its module dynamic libraries
'-m', module_path,
# Don't background
'-D' ]
'-m', module_path ]
if not self._run_background:
start_cmd.append(# Don't background
'-D')
# Copy liblightcomp.dylib to /tmp/lighttpd/lib to work around the bug that
# mod_alias.so loads it from the hard coded path.
......@@ -278,6 +281,8 @@ if '__main__' == __name__:
help='Absolute path to DocumentRoot (overrides layout test roots)')
option_parser.add_option('--register_cygwin', action="store_true",
dest="register_cygwin", help='Register Cygwin paths (on Win try bots)')
option_parser.add_option('--run_background', action="store_true",
dest="run_background", help='Run on background (for running as UI test)')
options, args = option_parser.parse_args()
if not options.server:
......@@ -292,7 +297,8 @@ if '__main__' == __name__:
httpd = Lighttpd(tempfile.gettempdir(),
port=options.port,
root=options.root,
register_cygwin=options.register_cygwin)
register_cygwin=options.register_cygwin,
run_background=options.run_background)
if 'start' == options.server:
httpd.Start()
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment