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

Unified Diff: LayoutTests/http/tests/misc/webtiming-buffer-full-no-event.html

Issue 22649003: Have the Performance interface inherit EventTarget (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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/http/tests/misc/webtiming-buffer-full-no-event.html
diff --git a/LayoutTests/http/tests/misc/webtiming-buffer-full-no-event.html b/LayoutTests/http/tests/misc/webtiming-buffer-full-no-event.html
new file mode 100644
index 0000000000000000000000000000000000000000..66cdbf27bf011f9aed7880b2ca8233da36be92c9
--- /dev/null
+++ b/LayoutTests/http/tests/misc/webtiming-buffer-full-no-event.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+<link rel="help" href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#extensions-performance-interface">
+<script src="../resources/js-test-pre.js"></script>
+<script>
+description("This test checks that Performance inherits EventTarget and that addEventListener() works for resourcetimingbufferfull events.");
+window.jsTestIsAsync = true;
+var bufferFullCount = 0;
+var parameter;
+
+function onBufferFull(event) {
+ parameter = event;
+ shouldBe('parameter.__proto__', 'Event.prototype');
+ bufferFullCount++;
+}
+
+shouldBe('Performance.prototype.__proto__', 'EventTarget.prototype');
+
+performance.webkitSetResourceTimingBufferSize(2);
+shouldBeNull('performance.onwebkitresourcetimingbufferfull');
+performance.addEventListener('webkitresourcetimingbufferfull', onBufferFull);
+shouldBeNull('performance.onwebkitresourcetimingbufferfull');
+</script>
+</head>
+<body onload="test()">
arv (Not doing code reviews) 2013/08/08 14:31:01 Or: window.onload = test;
+<script>
+function test() {
+ // Make sure the onBufferFull callback was called exactly 1 time.
+ shouldBe('bufferFullCount', '1');
+ performance.removeEventListener('webkitresourcetimingbufferfull', onBufferFull);
+ finishJSTest();
haraken 2013/08/08 07:29:09 Nit: Why do you need to make the test asynchronous
do-not-use 2013/08/08 07:37:27 I need to complete the test after the onload handl
arv (Not doing code reviews) 2013/08/08 14:31:01 I don't think you need an async test here. js-test
+}
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698