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 ) ;
@@ -174,6 +176,54 @@ function createTimingInfo({
174
176
encodedBodySize : 0 ,
175
177
decodedBodySize : 0 ,
176
178
} ) ;
179
+ assert . strictEqual ( util . inspect ( performance . getEntries ( ) ) , `[
180
+ PerformanceResourceTiming {
181
+ name: 'http://localhost:8080',
182
+ entryType: 'resource',
183
+ startTime: 0,
184
+ duration: 0,
185
+ initiatorType: 'fetch',
186
+ nextHopProtocol: [],
187
+ workerStart: 0,
188
+ redirectStart: 0,
189
+ redirectEnd: 0,
190
+ fetchStart: 0,
191
+ domainLookupStart: 0,
192
+ domainLookupEnd: 0,
193
+ connectStart: 0,
194
+ connectEnd: 0,
195
+ secureConnectionStart: 0,
196
+ requestStart: 0,
197
+ responseStart: 0,
198
+ responseEnd: 0,
199
+ transferSize: 0,
200
+ encodedBodySize: 0,
201
+ decodedBodySize: 0
202
+ }
203
+ ]` ) ;
204
+ assert . strictEqual ( util . inspect ( resource ) , `PerformanceResourceTiming {
205
+ name: 'http://localhost:8080',
206
+ entryType: 'resource',
207
+ startTime: 0,
208
+ duration: 0,
209
+ initiatorType: 'fetch',
210
+ nextHopProtocol: [],
211
+ workerStart: 0,
212
+ redirectStart: 0,
213
+ redirectEnd: 0,
214
+ fetchStart: 0,
215
+ domainLookupStart: 0,
216
+ domainLookupEnd: 0,
217
+ connectStart: 0,
218
+ connectEnd: 0,
219
+ secureConnectionStart: 0,
220
+ requestStart: 0,
221
+ responseStart: 0,
222
+ responseEnd: 0,
223
+ transferSize: 0,
224
+ encodedBodySize: 0,
225
+ decodedBodySize: 0
226
+ }` ) ;
177
227
178
228
assert ( resource instanceof PerformanceEntry ) ;
179
229
assert ( resource instanceof PerformanceResourceTiming ) ;
0 commit comments