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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-raf.js

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: unified Created 3 years, 6 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: third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-raf.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-raf.js b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-raf.js
new file mode 100644
index 0000000000000000000000000000000000000000..0880d6942a59b507215e574e1bd8a75e334231b0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-raf.js
@@ -0,0 +1,39 @@
+(async function() {
+ let {page, session, Protocol} = await InspectorTest.startHTML(`
+ <div id='myDiv'>DIV</div>
+ `, '');
+
+
+ function performActions() {
+ var callback;
+ var promise = new Promise((fulfill) => callback = fulfill);
+ var rafId2;
+ var rafId1 = requestAnimationFrame(() => callback({ rafId1: rafId1, rafId2: rafId2 }));
+ rafId2 = requestAnimationFrame(function() { });
+ cancelAnimationFrame(rafId2);
+ return promise;
+ }
+
+ (await InspectorTest.loadScript('../resources/tracing-test.js'))(session);
+ await session.evaluate(performActions.toString());
+ InspectorTest.invokeAsyncWithTracing('performActions', finish);
+
+ function finish(devtoolsEvents, data) {
+ var firedRaf = data.rafId1;
+ var canceledRaf = data.rafId2;
+
+ function hasRafId(id, e) { return e.args.data.id === id }
+
+ var raf1 = InspectorTest.findEvent('RequestAnimationFrame', 'I', hasRafId.bind(this, firedRaf));
+ var raf2 = InspectorTest.findEvent('RequestAnimationFrame', 'I', hasRafId.bind(this, canceledRaf));
+
+ InspectorTest.log('RequestAnimationFrame has frame: ' + !!raf1.args.data.frame);
+ InspectorTest.log('RequestAnimationFrame frames match: ' + (raf1.args.data.frame === raf2.args.data.frame));
+
+ InspectorTest.findEvent('CancelAnimationFrame', 'I', hasRafId.bind(this, canceledRaf));
+ InspectorTest.findEvent('FireAnimationFrame', 'X', hasRafId.bind(this, firedRaf));
+
+ InspectorTest.log('SUCCESS: found all expected events.');
+ InspectorTest.completeTest();
+ }
+})();

Powered by Google App Engine
This is Rietveld 408576698