bfa0a6d5ea17646970f39b51f43e903ae8809489
[test/tct/web/api.git] /
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <meta charset="utf-8" />
5         <title>exception test of performance.mark</title>
6         <link rel="author" title="Intel" href="http://www.intel.com/" />
7         <link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
8         <script src="../../resources/testharness.js"></script>
9         <script src="../../resources/testharnessreport.js"></script>
10         <script src="resources/webperftestharness.js"></script>
11         <script src="resources/webperftestharnessextension.js"></script>
12         <script>
13         setup({explicit_done: true});
14         test_namespace();
15
16         function onload_test() {
17             if (window.performance !== undefined && window.performance.timing !== undefined && window.performance.timing.secureConnectionStart !== undefined)
18             {
19                 var context = new PerformanceContext(window.performance);                
20                 var optionalAttribute = "secureConnectionStart";
21                 try
22                 {
23                     context.mark(optionalAttribute);
24                     test_true(false, 
25                               "window.performance.mark(\"" + optionalAttribute + "\") threw an exception when " +
26                               optinalAttribute + " attribute of Navigation Timing is supported.");
27                 }
28                 catch(e)
29                 {
30                     test_true(true, 
31                               "window.performance.mark(\"" + optionalAttribute + "\") threw an exception when " +
32                               optionalAttribute + " attribute of Navigation Timing is supported.");
33                 
34                     // confirm that a SYNTAX_ERR exception is thrown and not any other exception
35                     test_equals(e.code,
36                                 e.SYNTAX_ERR,
37                                 "window.performance.mark(\"" + optionalAttribute + "\") threw a SYNTAX_ERR when " + 
38                               optionalAttribute + " attribute of Navigation Timing is supported.");
39                 }
40             }
41             else
42             {
43                 test_true(true,
44                           "This test is ignored when secureConnectionStart attribute of Navigation Timing is not supported.");
45             }
46             done();
47         }
48         </script>
49     </head>
50     <body onload=onload_test()>
51         <h1>Description</h1>
52         <p>This test validates exception scenarios of invoking performance.mark() with param of "secureConnectionStart".</p>
53         <div id="log"></div>
54     </body>
55 </html>