summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-timing/idlharness.html
blob: 65a8778f75a403acbd4e0cd60aa3dad8d575bb3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Navigation Timing IDL tests</title>
<link rel="author" title="W3C" href="http://www.w3.org/" />
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"/>
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<h1>Navigation Timing IDL tests</h1>
<div id="log"></div>

<pre id='untested_idl' style='display:none'>

[PrimaryGlobal]
interface Window {
};

callback interface EventListener {
  void handleEvent(Event event);
};

interface Event {
    // PhaseType
    const unsigned short NONE = 0;
    const unsigned short CAPTURING_PHASE = 1;
    const unsigned short AT_TARGET = 2;
    const unsigned short BUBBLING_PHASE = 3;
    readonly    attribute DOMString      type;
    readonly    attribute EventTarget?   target;
    readonly    attribute EventTarget?   currentTarget;
    readonly    attribute unsigned short eventPhase;
    readonly    attribute boolean        bubbles;
    readonly    attribute boolean        cancelable;
    readonly    attribute DOMTimeStamp   timeStamp;
    void stopPropagation ();
    void preventDefault ();
    void initEvent (DOMString eventTypeArg, boolean bubblesArg, boolean cancelableArg);
    // Introduced in DOM Level 3
    void stopImmediatePropagation ();
    readonly    attribute boolean        defaultPrevented;
    readonly    attribute boolean        isTrusted;
};

interface EventTarget {
    // Modified in DOM Level 3
    void    addEventListener (DOMString type, EventListener? listener, optional boolean useCapture = false);
    void    removeEventListener (DOMString type, EventListener? listener, optional boolean useCapture = false);
    boolean dispatchEvent (Event event);
};

</pre>

<pre id='idl'>
interface PerformanceTiming {
  readonly attribute unsigned long long navigationStart;
  readonly attribute unsigned long long unloadEventStart;
  readonly attribute unsigned long long unloadEventEnd;
  readonly attribute unsigned long long redirectStart;
  readonly attribute unsigned long long redirectEnd;
  readonly attribute unsigned long long fetchStart;
  readonly attribute unsigned long long domainLookupStart;
  readonly attribute unsigned long long domainLookupEnd;
  readonly attribute unsigned long long connectStart;
  readonly attribute unsigned long long connectEnd;
  readonly attribute unsigned long long secureConnectionStart;
  readonly attribute unsigned long long requestStart;
  readonly attribute unsigned long long responseStart;
  readonly attribute unsigned long long responseEnd;
  readonly attribute unsigned long long domLoading;
  readonly attribute unsigned long long domInteractive;
  readonly attribute unsigned long long domContentLoadedEventStart;
  readonly attribute unsigned long long domContentLoadedEventEnd;
  readonly attribute unsigned long long domComplete;
  readonly attribute unsigned long long loadEventStart;
  readonly attribute unsigned long long loadEventEnd;
};

interface PerformanceNavigation {
  const unsigned short TYPE_NAVIGATE = 0;
  const unsigned short TYPE_RELOAD = 1;
  const unsigned short TYPE_BACK_FORWARD = 2;
  const unsigned short TYPE_RESERVED = 255;
  readonly attribute unsigned short type;
  readonly attribute unsigned short redirectCount;
};

interface Performance : EventTarget {
  readonly attribute PerformanceTiming timing;
  readonly attribute PerformanceNavigation navigation;
};

partial interface Window {
  [Replaceable] readonly attribute Performance performance;
};
</pre>

<script>
(function() {
  var idl_array = new IdlArray();

  idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
  idl_array.add_idls(document.getElementById("idl").textContent);

  idl_array.add_objects({Window: ["window"],
                         Performance: ["window.performance"],
                         PerformanceNavigation: ["window.performance.navigation"],
                         PerformanceTiming: ["window.performance.timing"]});

  idl_array.test();
})();
</script>
</body>
</html>