| Differences between
and this patch
- a/Tools/ChangeLog +21 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2012-08-28  Philippe Liard  <pliard@chromium.org>
2
3
        Support LayoutTests on non-rooted devices for Chromium Android.
4
        https://bugs.webkit.org/show_bug.cgi?id=95346
5
6
        We were requiring root permissions to sync resource files with the
7
        device by comparing host and device files' timestamp after we
8
        synchronized the device and host clocks.
9
        We now rely on AndroidCommands.PushIfNeeded() provided by Chromium to
10
        handle data files synchronization. It uses md5 under the hood which
11
        doesn't need root permissions.
12
13
        * Scripts/webkitpy/layout_tests/port/chromium.py:
14
        (ChromiumPort._check_driver_build_up_to_date):
15
        * Scripts/webkitpy/layout_tests/port/chromium_android.py:
16
        (ChromiumAndroidDriver.__init__):
17
        (ChromiumAndroidDriver._setup_test):
18
        (ChromiumAndroidDriver._push_executable):
19
        (ChromiumAndroidDriver._push_test_resources):
20
        (ChromiumAndroidDriver._read_prompt):
21
1
2012-08-28  Andras Becsi  <andras.becsi@nokia.com>
22
2012-08-28  Andras Becsi  <andras.becsi@nokia.com>
2
23
3
        [watchlist] Unreviewed, subscribe to Qt bugs.
24
        [watchlist] Unreviewed, subscribe to Qt bugs.
- a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py -4 / +3 lines
Lines 405-414 class ChromiumPort(Port): a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py_sec1
405
405
406
                if (debug_mtime > release_mtime and configuration == 'Release' or
406
                if (debug_mtime > release_mtime and configuration == 'Release' or
407
                    release_mtime > debug_mtime and configuration == 'Debug'):
407
                    release_mtime > debug_mtime and configuration == 'Debug'):
408
                    _log.warning('You are not running the most '
408
                    most_recent_binary = 'Release' if configuration == 'Debug' else 'Debug'
409
                                 'recent DumpRenderTree binary. You need to '
409
                    _log.warning('You are running the %s binary. However the %s binary appears to be more recent. '
410
                                 'pass --debug or not to select between '
410
                                 'Please pass --%s.', configuration, most_recent_binary, most_recent_binary.lower())
411
                                 'Debug and Release.')
412
                    _log.warning('')
411
                    _log.warning('')
413
            # This will fail if we don't have both a debug and release binary.
412
            # This will fail if we don't have both a debug and release binary.
414
            # That's fine because, in this case, we must already be running the
413
            # That's fine because, in this case, we must already be running the
- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py -41 / +20 lines
Lines 31-36 import copy a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec1
31
import logging
31
import logging
32
import os
32
import os
33
import re
33
import re
34
import sys
34
import threading
35
import threading
35
import time
36
import time
36
37
Lines 39-44 from webkitpy.layout_tests.port import driver a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec2
39
from webkitpy.layout_tests.port import factory
40
from webkitpy.layout_tests.port import factory
40
from webkitpy.layout_tests.port import server_process
41
from webkitpy.layout_tests.port import server_process
41
42
43
sys.path.append(
44
    os.path.join(os.environ['CHROME_SRC'], 'build', 'android', 'pylib'))
45
import android_commands
42
46
43
_log = logging.getLogger(__name__)
47
_log = logging.getLogger(__name__)
44
48
Lines 54-60 COMMAND_LINE_FILE = DEVICE_SOURCE_ROOT_DIR + 'chrome-native-tests-command-line' a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec3
54
# and Chromium's webkit/support/platform_support_android.cc.
58
# and Chromium's webkit/support/platform_support_android.cc.
55
DEVICE_DRT_DIR = DEVICE_SOURCE_ROOT_DIR + 'drt/'
59
DEVICE_DRT_DIR = DEVICE_SOURCE_ROOT_DIR + 'drt/'
56
DEVICE_FORWARDER_PATH = DEVICE_DRT_DIR + 'forwarder'
60
DEVICE_FORWARDER_PATH = DEVICE_DRT_DIR + 'forwarder'
57
DEVICE_DRT_STAMP_PATH = DEVICE_DRT_DIR + 'DumpRenderTree.stamp'
58
61
59
DRT_APP_PACKAGE = 'org.chromium.native_test'
62
DRT_APP_PACKAGE = 'org.chromium.native_test'
60
DRT_ACTIVITY_FULL_NAME = DRT_APP_PACKAGE + '/.ChromeNativeTestActivity'
63
DRT_ACTIVITY_FULL_NAME = DRT_APP_PACKAGE + '/.ChromeNativeTestActivity'
Lines 355-360 class ChromiumAndroidDriver(driver.Driver): a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec4
355
        self._has_setup = False
358
        self._has_setup = False
356
        self._original_governors = {}
359
        self._original_governors = {}
357
        self._adb_command = ['adb', '-s', port._get_device_serial(worker_number)]
360
        self._adb_command = ['adb', '-s', port._get_device_serial(worker_number)]
361
        self._adb = android_commands.AndroidCommands()
362
        self._push_executable()
363
        self._push_fonts()
364
        self._push_test_resources()
358
365
359
    def __del__(self):
366
    def __del__(self):
360
        self._teardown_performance()
367
        self._teardown_performance()
Lines 376-412 class ChromiumAndroidDriver(driver.Driver): a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec5
376
        self._run_adb_command(['shell', 'mkdir', '-p', DEVICE_DRT_DIR])
383
        self._run_adb_command(['shell', 'mkdir', '-p', DEVICE_DRT_DIR])
377
        self._run_adb_command(['shell', 'chmod', '777', DEVICE_DRT_DIR])
384
        self._run_adb_command(['shell', 'chmod', '777', DEVICE_DRT_DIR])
378
385
379
        self._push_executable()
380
        self._push_fonts()
381
        self._synchronize_datetime()
382
383
        # Delete the disk cache if any to ensure a clean test run.
386
        # Delete the disk cache if any to ensure a clean test run.
384
        # This is like what's done in ChromiumPort.setup_test_run but on the device.
387
        # This is like what's done in ChromiumPort.setup_test_run but on the device.
385
        self._run_adb_command(['shell', 'rm', '-r', DRT_APP_CACHE_DIR])
388
        self._run_adb_command(['shell', 'rm', '-r', DRT_APP_CACHE_DIR])
386
389
387
    def _push_executable(self):
390
    def _push_executable(self):
391
        self._adb.PushIfNeeded(self._port._path_to_forwarder(), DEVICE_FORWARDER_PATH)
392
        self._adb.PushIfNeeded(self._port._build_path('DumpRenderTree.pak'), DEVICE_DRT_DIR + 'DumpRenderTree.pak')
393
        self._adb.PushIfNeeded(self._port._build_path('DumpRenderTree_resources'), DEVICE_DRT_DIR + 'DumpRenderTree_resources')
394
        self._adb.PushIfNeeded(self._port._build_path('android_main_fonts.xml'), DEVICE_DRT_DIR + 'android_main_fonts.xml')
395
        self._adb.PushIfNeeded(self._port._build_path('android_fallback_fonts.xml'), DEVICE_DRT_DIR + 'android_fallback_fonts.xml')
396
        _log.debug('Pushing executable')
397
        self._run_adb_command(['uninstall', DRT_APP_PACKAGE])
388
        drt_host_path = self._port._path_to_driver()
398
        drt_host_path = self._port._path_to_driver()
389
        forwarder_host_path = self._port._path_to_forwarder()
399
        install_result = self._run_adb_command(['install', drt_host_path])
390
        host_stamp = int(float(max(os.stat(drt_host_path).st_mtime,
400
        if install_result.find('Success') == -1:
391
                                   os.stat(forwarder_host_path).st_mtime)))
401
            raise AssertionError('Failed to install %s onto device: %s' % (drt_host_path, install_result))
392
        device_stamp = int(float(self._run_adb_command([
393
            'shell', 'cat %s 2>/dev/null || echo 0' % DEVICE_DRT_STAMP_PATH])))
394
        if device_stamp != host_stamp:
395
            _log.debug('Pushing executable')
396
            self._push_to_device(forwarder_host_path, DEVICE_FORWARDER_PATH)
397
            self._run_adb_command(['uninstall', DRT_APP_PACKAGE])
398
            install_result = self._run_adb_command(['install', drt_host_path])
399
            if install_result.find('Success') == -1:
400
                raise AssertionError('Failed to install %s onto device: %s' % (drt_host_path, install_result))
401
            self._push_to_device(self._port._build_path('DumpRenderTree.pak'), DEVICE_DRT_DIR + 'DumpRenderTree.pak')
402
            self._push_to_device(self._port._build_path('DumpRenderTree_resources'), DEVICE_DRT_DIR + 'DumpRenderTree_resources')
403
            self._push_to_device(self._port._build_path('android_main_fonts.xml'), DEVICE_DRT_DIR + 'android_main_fonts.xml')
404
            self._push_to_device(self._port._build_path('android_fallback_fonts.xml'), DEVICE_DRT_DIR + 'android_fallback_fonts.xml')
405
            # Version control of test resources is dependent on executables,
406
            # because we will always rebuild executables when resources are
407
            # updated.
408
            self._push_test_resources()
409
            self._run_adb_command(['shell', 'echo %d >%s' % (host_stamp, DEVICE_DRT_STAMP_PATH)])
410
402
411
    def _push_fonts(self):
403
    def _push_fonts(self):
412
        if not self._check_version(DEVICE_FONTS_DIR, FONT_FILES_VERSION):
404
        if not self._check_version(DEVICE_FONTS_DIR, FONT_FILES_VERSION):
Lines 421-438 class ChromiumAndroidDriver(driver.Driver): a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec6
421
    def _push_test_resources(self):
413
    def _push_test_resources(self):
422
        _log.debug('Pushing test resources')
414
        _log.debug('Pushing test resources')
423
        for resource in TEST_RESOURCES_TO_PUSH:
415
        for resource in TEST_RESOURCES_TO_PUSH:
424
            self._push_to_device(self._port.layout_tests_dir() + '/' + resource, DEVICE_LAYOUT_TESTS_DIR + resource)
416
            self._adb.PushIfNeeded(self._port.layout_tests_dir() + '/' + resource, DEVICE_LAYOUT_TESTS_DIR + resource)
425
426
    def _synchronize_datetime(self):
427
        # The date/time between host and device may not be synchronized.
428
        # We need to make them synchronized, otherwise tests might fail.
429
        try:
430
            # Get seconds since 1970-01-01 00:00:00 UTC.
431
            host_datetime = self._port._executive.run_command(['date', '-u', '+%s'])
432
        except:
433
            # Reset to 1970-01-01 00:00:00 UTC.
434
            host_datetime = 0
435
        self._run_adb_command(['shell', 'date -u %s' % (host_datetime)])
436
417
437
    def _check_version(self, dir, version):
418
    def _check_version(self, dir, version):
438
        assert(dir.endswith('/'))
419
        assert(dir.endswith('/'))
Lines 691-698 class ChromiumAndroidDriver(driver.Driver): a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py_sec7
691
        while True:
672
        while True:
692
            current_char = self._server_process.read_stdout(deadline, 1)
673
            current_char = self._server_process.read_stdout(deadline, 1)
693
            if current_char == ' ':
674
            if current_char == ' ':
694
                if last_char == '#':
675
                if last_char in ['#', '$']:
695
                    return
676
                    return
696
                if last_char == '$':
697
                    raise AssertionError('Adbd is not running as root')
698
            last_char = current_char
677
            last_char = current_char
- a/LayoutTests/ChangeLog +17 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2012-08-28  Philippe Liard  <pliard@chromium.org>
2
3
        Support LayoutTests on non-rooted Android devices.
4
        https://bugs.webkit.org/show_bug.cgi?id=95346
5
6
        http/tests/cache/resources/subresource-test.js was assuming that the
7
        client and server clocks are the same which is no longer true since we
8
        are getting rid of host/device clock synchronization.
9
10
        * http/tests/cache/resources/cache-simulator.cgi:
11
        * http/tests/cache/resources/current-time.cgi: Added.
12
        * http/tests/cache/resources/subresource-test.js:
13
        (getServerDate):
14
        (nextTest):
15
        (testComplete):
16
        (runTests):
17
1
2012-08-28  Kangil Han  <kangil.han@samsung.com>
18
2012-08-28  Kangil Han  <kangil.han@samsung.com>
2
19
3
        [EFL][WK2][WTR] Rebaseline newly added SVG text test cases
20
        [EFL][WK2][WTR] Rebaseline newly added SVG text test cases
- a/LayoutTests/http/tests/cache/resources/current-time.cgi +5 lines
Line 0 a/LayoutTests/http/tests/cache/resources/current-time.cgi_sec1
1
#!/usr/bin/perl -w
2
3
print "Content-type: text/plain\n";
4
print "\n";
5
print time()
- a/LayoutTests/http/tests/cache/resources/subresource-test.js -6 / +21 lines
Lines 25-30 var consoleDiv = document.createElement('div'); a/LayoutTests/http/tests/cache/resources/subresource-test.js_sec1
25
document.body.appendChild(consoleDiv);
25
document.body.appendChild(consoleDiv);
26
frame2.onload = function () { loadedFrameCount++; }
26
frame2.onload = function () { loadedFrameCount++; }
27
27
28
var serverClientTimeDelta = getServerDate().getTime() - new Date().getTime();
29
30
function getServerDate()
31
{
32
    var req = new XMLHttpRequest();
33
    var t0 = new Date().getTime();
34
    req.open('GET', "/cache/resources/current-time.cgi", false /* blocking */);
35
    req.send();
36
    var serverToClientTime = (new Date().getTime() - t0) / 2;
37
    if (req.status != 200) {
38
        console.log("unexpected status code " + req.status + ", expected 200.");
39
        return new Date();
40
    }
41
    return new Date((parseInt(req.responseText) * 1000) + serverToClientTime);
42
}
43
28
function loadTestFrame(frame, testSpec)
44
function loadTestFrame(frame, testSpec)
29
{
45
{
30
    var first = true;
46
    var first = true;
Lines 67-73 function nextTest() a/LayoutTests/http/tests/cache/resources/subresource-test.js_sec2
67
{
83
{
68
    var testSpec = tests[currentTest];
84
    var testSpec = tests[currentTest];
69
    uniqueId = Math.floor(100000000 * Math.random());
85
    uniqueId = Math.floor(100000000 * Math.random());
70
    now = new Date();
86
    now = new Date(new Date().getTime() + serverClientTimeDelta);
71
    if (!testSpec) {
87
    if (!testSpec) {
72
        if (window.testRunner)
88
        if (window.testRunner)
73
            testRunner.notifyDone();
89
            testRunner.notifyDone();
Lines 80-101 function nextTest() a/LayoutTests/http/tests/cache/resources/subresource-test.js_sec3
80
function testComplete(testSpec)
96
function testComplete(testSpec)
81
{
97
{
82
    var line = document.createElement('div');
98
    var line = document.createElement('div');
83
    var result = frame1.contentWindow.randomNumber == frame2.contentWindow.randomNumber ? 'Cached' : 'Uncached';    
99
    var result = frame1.contentWindow.randomNumber == frame2.contentWindow.randomNumber ? 'Cached' : 'Uncached';
84
    var passed = result == testSpec.expectedResult;
100
    var passed = result == testSpec.expectedResult;
85
101
86
    if (testSpec.description)
102
    if (testSpec.description)
87
        line.innerHTML += testSpec.description;
103
        line.innerHTML += testSpec.description;
88
    else {
104
    else {
89
        for (var header in testSpec.testHeaders) 
105
        for (var header in testSpec.testHeaders)
90
            line.innerHTML += header + ": " + testSpec.testHeaders[header] + "; ";
106
            line.innerHTML += header + ": " + testSpec.testHeaders[header] + "; ";
91
    }
107
    }
92
    if (testSpec.delay)
108
    if (testSpec.delay)
93
        line.innerHTML += "[delay=" + testSpec.delay + "s] "
109
        line.innerHTML += "[delay=" + testSpec.delay + "s] "
94
    line.innerHTML += "  (result=" + result + " expected=" + testSpec.expectedResult + ") ";
110
    line.innerHTML += "  (result=" + result + " expected=" + testSpec.expectedResult + ") ";
95
    line.innerHTML += passed ? "<font color=green>PASS</font> " : "<font color=red>FAIL</font> "
111
    line.innerHTML += passed ? "<font color=green>PASS</font> " : "<font color=red>FAIL</font> "
96
        
112
97
    consoleDiv.appendChild(line);
113
    consoleDiv.appendChild(line);
98
    
114
99
    nextTest();
115
    nextTest();
100
}
116
}
101
117
Lines 106-110 function runTests() a/LayoutTests/http/tests/cache/resources/subresource-test.js_sec4
106
        nextTest();
122
        nextTest();
107
    else
123
    else
108
        setTimeout(runTests, 100);
124
        setTimeout(runTests, 100);
109
110
}
125
}

Return to Bug 95346