2
2
3
3
const common = require ( '../common' ) ;
4
4
const assert = require ( 'assert' ) ;
5
+ const util = require ( 'util' ) ;
5
6
const {
6
7
PerformanceObserver,
7
8
PerformanceEntry,
@@ -14,6 +15,7 @@ const {
14
15
15
16
assert ( PerformanceObserver ) ;
16
17
assert ( PerformanceEntry ) ;
18
+ assert . throws ( ( ) => new PerformanceEntry ( ) , { code : 'ERR_ILLEGAL_CONSTRUCTOR' } ) ;
17
19
assert ( PerformanceResourceTiming ) ;
18
20
assert ( clearResourceTimings ) ;
19
21
assert ( markResourceTiming ) ;
@@ -173,6 +175,54 @@ function createTimingInfo({
173
175
encodedBodySize : 0 ,
174
176
decodedBodySize : 0 ,
175
177
} ) ;
178
+ assert . strictEqual ( util . inspect ( performance . getEntries ( ) ) , `[
179
+ PerformanceResourceTiming {
180
+ name: 'http://localhost:8080',
181
+ entryType: 'resource',
182
+ startTime: 0,
183
+ duration: 0,
184
+ initiatorType: 'fetch',
185
+ nextHopProtocol: [],
186
+ workerStart: 0,
187
+ redirectStart: 0,
188
+ redirectEnd: 0,
189
+ fetchStart: 0,
190
+ domainLookupStart: 0,
191
+ domainLookupEnd: 0,
192
+ connectStart: 0,
193
+ connectEnd: 0,
194
+ secureConnectionStart: 0,
195
+ requestStart: 0,
196
+ responseStart: 0,
197
+ responseEnd: 0,
198
+ transferSize: 0,
199
+ encodedBodySize: 0,
200
+ decodedBodySize: 0
201
+ }
202
+ ]` ) ;
203
+ assert . strictEqual ( util . inspect ( resource ) , `PerformanceResourceTiming {
204
+ name: 'http://localhost:8080',
205
+ entryType: 'resource',
206
+ startTime: 0,
207
+ duration: 0,
208
+ initiatorType: 'fetch',
209
+ nextHopProtocol: [],
210
+ workerStart: 0,
211
+ redirectStart: 0,
212
+ redirectEnd: 0,
213
+ fetchStart: 0,
214
+ domainLookupStart: 0,
215
+ domainLookupEnd: 0,
216
+ connectStart: 0,
217
+ connectEnd: 0,
218
+ secureConnectionStart: 0,
219
+ requestStart: 0,
220
+ responseStart: 0,
221
+ responseEnd: 0,
222
+ transferSize: 0,
223
+ encodedBodySize: 0,
224
+ decodedBodySize: 0
225
+ }` ) ;
176
226
177
227
assert ( resource instanceof PerformanceEntry ) ;
178
228
assert ( resource instanceof PerformanceResourceTiming ) ;
0 commit comments