Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: LayoutTests/paint/invalidation/spv2/resources/convert.sh

Issue 1302183007: Convert some text-based-repaint tests for spv2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+

Powered by Google App Engine
This is Rietveld 408576698