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

Unified Diff: LayoutTests/fast/performance/performance-measure-exceptions.html

Issue 22311011: Improve 'performance.{mark,measure} exception messages. (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/fast/performance/performance-measure-exceptions.html
diff --git a/LayoutTests/fast/performance/performance-measure-exceptions.html b/LayoutTests/fast/performance/performance-measure-exceptions.html
new file mode 100644
index 0000000000000000000000000000000000000000..aa2c361d2c147a666bfd9ad03fff9ef8a9fb8ae0
--- /dev/null
+++ b/LayoutTests/fast/performance/performance-measure-exceptions.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+ <script src="../js/resources/js-test-pre.js"></script>
+ <script>
+ description("This tests that 'performance.measure' throws exceptions with reasonable messages.");
+
+ shouldThrow('window.performance.measure("DoesNotExist", "AlsoDoesNotExist")', '"SyntaxError: The mark \'AlsoDoesNotExist\' does not exist."');
+
+ window.performance.mark('mark');
+
+ var allTheExceptionalThings = [
+ 'unloadEventStart',
+ 'unloadEventEnd',
+ 'redirectStart',
+ 'redirectEnd',
+ 'secureConnectionStart',
+ 'domInteractive',
+ 'domContentLoadedEventStart',
+ 'domContentLoadedEventEnd',
+ 'domComplete',
+ 'loadEventStart',
+ 'loadEventEnd',
+ ];
+ allTheExceptionalThings.forEach(function(name) {
+ shouldThrow('window.performance.measure("measuring", \'' + name + '\', "mark")', '"InvalidAccessError: \'' + name + '\' is empty: either the event hasn\'t happened yet, or it would provide cross-origin timing information."');
+ });
+ </script>
+ <script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698