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

Side by Side Diff: LayoutTests/paint/invalidation/spv2/resources/paint-invalidation-test.js

Issue 1324763002: Paint invalidation tests for slimming paint v2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Yet another unrelated file mixed from another branch :( 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Asynchronous tests should manually call finishPaintInvalidationTest at the ap propriate time.
2 window.testIsAsync = false;
3
4 // All paint invalidation tests are asynchronous from test-runner's point of vie w.
5 if (window.testRunner)
6 testRunner.waitUntilDone();
7
8 function runPaintInvalidationTest()
9 {
10 if (!window.testRunner || !window.internals) {
11 setTimeout(paintInvalidationTest, 500);
12 return;
13 }
14
15 // TODO(enne): this is a workaround for multiple svg onload events.
16 // See: http://crbug.com/372946
17 if (window.hasRunPaintInvalidationTest)
18 return;
19 window.hasRunPaintInvalidationTest = true;
20
21 testRunner.layoutAndPaintAsyncThen(function()
22 {
23 window.internals.startTrackingPaintInvalidationObjects();
24 paintInvalidationTest();
25 if (!window.testIsAsync)
26 finishPaintInvalidationTest();
27 });
28 }
29
30 function removeAllChildren(element)
31 {
32 while (element.firstChild)
33 element.removeChild(element.firstChild);
34 }
35
36 function finishPaintInvalidationTest()
37 {
38 if (!window.testRunner || !window.internals)
39 return;
40
41 testRunner.layoutAndPaintAsyncThen(function()
42 {
43 document.body.offsetTop;
44 var paintInvalidationObjects = JSON.stringify(internals.trackedPaintInva lidationObjects());
45 var expectedPaintInvalidationObjects = JSON.stringify(window.expectedPai ntInvalidationObjects);
46 internals.stopTrackingPaintInvalidationObjects();
47
48 if (paintInvalidationObjects != expectedPaintInvalidationObjects) {
49 var message = 'Paint invalidation objects mismatch.'
50 + '\nExpected:\n' + expectedPaintInvalidationObjects.replace(/", "/g, '",\n "')
51 + '\nActual:\n' + paintInvalidationObjects.replace(/","/g, '",\n "');
52 testRunner.logToStderr(message);
53 while (document.body.firstChild)
54 document.body.removeChild(document.body.firstChild);
55 var pre = document.createElement('pre');
56 pre.appendChild(document.createTextNode('(To copy results as text, s ee stderr.)\n\n' + message));
57 document.body.appendChild(pre);
58 }
59 testRunner.notifyDone();
60 });
61 }
62
63 setTimeout(function() {
64 testRunner.notifyDone();
65 }, 2000);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698