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 ) ;
@@ -174,6 +176,54 @@ function createTimingInfo({
174176 encodedBodySize : 0 ,
175177 decodedBodySize : 0 ,
176178 } ) ;
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+ }` ) ;
177227
178228 assert ( resource instanceof PerformanceEntry ) ;
179229 assert ( resource instanceof PerformanceResourceTiming ) ;
0 commit comments