Chromium Code Reviews| Index: LayoutTests/paint/invalidation/spv2/resources/convert.sh |
| diff --git a/LayoutTests/paint/invalidation/spv2/resources/convert.sh b/LayoutTests/paint/invalidation/spv2/resources/convert.sh |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..7aa4738b0c7c8ef5d4bdb7ddfe6134bd447860ba |
| --- /dev/null |
| +++ b/LayoutTests/paint/invalidation/spv2/resources/convert.sh |
| @@ -0,0 +1,49 @@ |
| +#!/bin/bash |
| + |
|
pdr.
2015/09/02 05:25:48
This is a little rough to check in. WDYT about jus
|
| +if [ "$#" != "1" ]; then |
| + echo "Convert a text-based-repaint test into a spv2 paint invalidation test." |
| + echo "Usage: convert.sh <relative-path-of-repaint-test-under-LayoutTests" |
| + echo "Need to manually edit the generated -expected.html." |
| + exit 1 |
| +fi |
| + |
| +cd `dirname $0`/../../../.. |
| + |
| +newfile=`echo $1 | sed 's#.*/#paint/invalidation/spv2/#'` |
| +echo New file: $newfile |
| + |
| +expectedtxt=`echo $1 | sed 's/\.html/-expected.txt/'` |
| +expectedtxt=`ls $expectedtxt* platform/{win,linux,mac}/$expectedtxt 2>/dev/null | head -1` |
| +if [ ! -f "$expectedtxt" ]; then |
| + echo "No -expected.txt for the test" |
| + exit 1 |
| +fi |
| + |
| +indent=`grep 'repaintTest()' $1|sed 's/\(^ *\).*$/\1/'` |
| +expectedobj=/tmp/expected-paint-invalidation-objects |
| +grep '^ *"[^"]*",\?$' $expectedtxt | sed "s/^ */$indent /;s/\$/,/;s/,,\$/,/" >$expectedobj |
| +testdir=`dirname $1` |
| + |
| +sed "s#\\([(='\"]\\)\\([-_\\.a-zA-Z0-9/]*resources/\)#\\1../../../$testdir/\\2# |
| + / repaintTest()/ { |
| + i\\${indent}window.expectedPaintInvalidationObjects = [ |
| + h |
| + r $expectedobj |
| + g |
| + N |
| + i\\${indent}]; |
| + } |
| + s/ repaintTest()/ paintInvalidationTest()/ |
| + s/runRepaintTest/runPaintInvalidationTest/ |
| + s/finishRepaintTest/finishPaintInvalidationTest/ |
| + s/src=.*\/text-based-repaint.js/src=\"resources\/paint-invalidation-test.js/ |
| + 1i\<\!-- Based on $1 --\> |
| + " $1 > $newfile |
| + |
| +expected=`echo $newfile | sed 's/\.html/-expected.html/'` |
| +echo Expected: $expected |
| +sed "s#\\([(='\"]\\)\\([-_\\.a-zA-Z0-9/]*resources/\)#\\1../../../$testdir/\\2# |
| + s/ onload=.runRepaintTest();\\?.// |
| + /text-based-repaint.js/d |
| + " $1 > $expected |
| + |