Commit f89aa933 authored by jochen@chromium.org's avatar jochen@chromium.org

When showing results.html pass a correct URL to webbrowser.open

https://bugs.webkit.org/show_bug.cgi?id=75438

Reviewed by Adam Barth.

* Scripts/webkitpy/common/system/filesystem.py:
(file_path_as_url):
* Scripts/webkitpy/common/system/filesystem_mock.py:
(file_path_as_url):
* Scripts/webkitpy/common/system/filesystem_unittest.py:
(test_file_path_as_url):
* Scripts/webkitpy/layout_tests/port/base.py:
(show_results_html_file):
* Scripts/webkitpy/layout_tests/port/win_unittest.py:
(test_show_results_html_file):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(test_results_directory_relative):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9045a7f2
2012-01-03 Jochen Eisinger <jochen@chromium.org>
When showing results.html pass a correct URL to webbrowser.open
https://bugs.webkit.org/show_bug.cgi?id=75438
Reviewed by Adam Barth.
* Scripts/webkitpy/common/system/filesystem.py:
(file_path_as_url):
* Scripts/webkitpy/common/system/filesystem_mock.py:
(file_path_as_url):
* Scripts/webkitpy/common/system/filesystem_unittest.py:
(test_file_path_as_url):
* Scripts/webkitpy/layout_tests/port/base.py:
(show_results_html_file):
* Scripts/webkitpy/layout_tests/port/win_unittest.py:
(test_show_results_html_file):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(test_results_directory_relative):
2012-01-03 Ojan Vafai <ojan@chromium.org>
shrink the header on the flakiness dashboard
......@@ -40,6 +40,7 @@ import shutil
import sys
import tempfile
import time
from urllib import pathname2url
from webkitpy.common.system import ospath
......@@ -82,6 +83,9 @@ class FileSystem(object):
def exists(self, path):
return os.path.exists(path)
def file_path_as_url(self, path):
return 'file://' + pathname2url(path)
def files_under(self, path, dirs_to_skip=[], file_filter=None):
"""Return the list of all files under the given path in topdown order.
......
......@@ -31,6 +31,7 @@ import errno
import hashlib
import os
import re
from urllib import pathname2url
from webkitpy.common.system import path
from webkitpy.common.system import ospath
......@@ -117,6 +118,9 @@ class MockFileSystem(object):
def exists(self, path):
return self.isfile(path) or self.isdir(path)
def file_path_as_url(self, path):
return 'file://' + pathname2url(path)
def files_under(self, path, dirs_to_skip=[], file_filter=None):
def filter_all(fs, dirpath, basename):
return True
......
......@@ -60,6 +60,11 @@ class GenericFileSystemTests(object):
self.fs.chdir(self.orig_cwd)
self.generic_test_dir = None
def test_file_path_as_url(self):
fs = FileSystem()
self.assertEqual(fs.file_path_as_url('/foo'),
'file:///foo')
def test_glob__trailing_asterisk(self):
self.fs.chdir(self.generic_test_dir)
self.assertEquals(set(self.fs.glob('fo*')), set(['foo.txt', 'foobar', 'foodir']))
......
......@@ -751,7 +751,7 @@ class Port(object):
def show_results_html_file(self, results_filename):
"""This routine should display the HTML file pointed at by
results_filename in a users' browser."""
return self.host.user.open_url(results_filename)
return self.host.user.open_url(self._filesystem.file_path_as_url(results_filename))
def create_driver(self, worker_number):
"""Return a newly created Driver subclass for starting/stopping the test driver."""
......
......@@ -46,7 +46,7 @@ class WinPortTest(port_testcase.PortTestCase):
def test_show_results_html_file(self):
port = self.make_port()
port._executive = MockExecutive(should_log=True)
expected_stderr = "MOCK: user.open_url: test.html\n"
expected_stderr = "MOCK: user.open_url: file://...\n"
OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr)
def test_detect_version(self):
......
......@@ -431,7 +431,7 @@ class MainTest(unittest.TestCase):
self.assertEqual(res, unexpected_tests_count)
self.assertFalse(out.empty())
self.assertFalse(err.empty())
self.assertEqual(user.opened_urls, ['/tmp/layout-test-results/results.html'])
self.assertEqual(user.opened_urls, ['file:///tmp/layout-test-results/results.html'])
def test_missing_and_unexpected_results(self):
# Test that we update expectations in place. If the expectation
......@@ -604,7 +604,7 @@ class MainTest(unittest.TestCase):
with host.filesystem.mkdtemp() as tmpdir:
res, out, err, user = logging_run(['--results-directory=' + str(tmpdir)],
tests_included=True, host=host)
self.assertEqual(user.opened_urls, [host.filesystem.join(tmpdir, 'results.html')])
self.assertEqual(user.opened_urls, [host.filesystem.file_path_as_url(host.filesystem.join(tmpdir, 'results.html'))])
def test_results_directory_default(self):
# We run a configuration that should fail, to generate output, then
......@@ -612,7 +612,7 @@ class MainTest(unittest.TestCase):
# This is the default location.
res, out, err, user = logging_run(tests_included=True)
self.assertEqual(user.opened_urls, ['/tmp/layout-test-results/results.html'])
self.assertEqual(user.opened_urls, ['file:///tmp/layout-test-results/results.html'])
def test_results_directory_relative(self):
# We run a configuration that should fail, to generate output, then
......@@ -622,7 +622,7 @@ class MainTest(unittest.TestCase):
host.filesystem.chdir('/tmp/cwd')
res, out, err, user = logging_run(['--results-directory=foo'],
tests_included=True, host=host)
self.assertEqual(user.opened_urls, ['/tmp/cwd/foo/results.html'])
self.assertEqual(user.opened_urls, ['file:///tmp/cwd/foo/results.html'])
def test_retries_directory(self):
host = MockHost()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment