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

Unified Diff: LayoutTests/fast/performance/performance-observer.html

Issue 1198863006: First version of PerformanceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review comments 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
« no previous file with comments | « no previous file | LayoutTests/fast/performance/performance-observer-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/performance/performance-observer.html
diff --git a/LayoutTests/fast/performance/performance-observer.html b/LayoutTests/fast/performance/performance-observer.html
new file mode 100644
index 0000000000000000000000000000000000000000..a0380fffc29c96b698c2c5e35a1ebdacf16f522a
--- /dev/null
+++ b/LayoutTests/fast/performance/performance-observer.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<script>
+
+description("This tests that PerformanceObserver gets called the right number of times.");
+
+window.jsTestIsAsync = true;
+
+var entries = [];
+
+var expectedEntries = [
+ {entryType:'mark', name:'mark_1'},
+ {entryType:'mark', name:'mark_2'},
+ {entryType:'measure', name:'measure_1'}
+];
+
+var observer = new PerformanceObserver(performanceCallback);
+
+function performanceCallback(performanceEntryList)
+{
+ entries = entries.concat(performanceEntryList.getEntries());
+ if (entries.length != expectedEntries.length)
+ return;
+ shouldBe('entries[0].entryType', 'expectedEntries[0].entryType');
+ shouldBe('entries[0].name', 'expectedEntries[0].name');
+ shouldBe('entries[1].entryType', 'expectedEntries[1].entryType');
+ shouldBe('entries[1].name', 'expectedEntries[1].name');
+ shouldBe('entries[2].entryType', 'expectedEntries[2].entryType');
+ shouldBe('entries[2].name', 'expectedEntries[2].name');
+ finishJSTest();
+}
+
+function performMeasure()
+{
+ window.performance.measure('measure_1', 'mark_1', 'mark_2');
+}
+
+var config = { entryTypes: ['mark', 'measure'] };
+observer.observe(config);
+
+window.performance.mark('mark_1');
+window.performance.mark('mark_2');
+
+window.setTimeout(performMeasure, 0);
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/performance/performance-observer-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698