22
33const common = require ( '../common' ) ;
44const assert = require ( 'assert' ) ;
5+ const util = require ( 'util' ) ;
56const {
67 PerformanceObserver,
78 PerformanceEntry,
@@ -14,6 +15,7 @@ const {
1415
1516assert ( PerformanceObserver ) ;
1617assert ( PerformanceEntry ) ;
18+ assert . throws ( ( ) => new PerformanceEntry ( ) , { code : 'ERR_ILLEGAL_CONSTRUCTOR' } ) ;
1719assert ( PerformanceResourceTiming ) ;
1820assert ( clearResourceTimings ) ;
1921assert ( markResourceTiming ) ;
@@ -173,6 +175,54 @@ function createTimingInfo({
173175 encodedBodySize : 0 ,
174176 decodedBodySize : 0 ,
175177 } ) ;
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+ }` ) ;
176226
177227 assert ( resource instanceof PerformanceEntry ) ;
178228 assert ( resource instanceof PerformanceResourceTiming ) ;
0 commit comments