@@ -23,6 +23,7 @@ describe('crashReporter module', () => {
2323
2424 let originalTempDirectory = null
2525 let tempDirectory = null
26+ const specTimeout = 180000
2627
2728 before ( ( ) => {
2829 tempDirectory = temp . mkdirSync ( 'electronCrashReporterSpec-' )
@@ -56,7 +57,7 @@ describe('crashReporter module', () => {
5657 } )
5758
5859 it ( 'should send minidump when renderer crashes' , function ( done ) {
59- this . timeout ( 180000 )
60+ this . timeout ( specTimeout )
6061
6162 stopServer = startServer ( {
6263 callback ( port ) {
@@ -68,7 +69,7 @@ describe('crashReporter module', () => {
6869 } )
6970
7071 it ( 'should send minidump when node processes crash' , function ( done ) {
71- this . timeout ( 180000 )
72+ this . timeout ( specTimeout )
7273
7374 stopServer = startServer ( {
7475 callback ( port ) {
@@ -84,7 +85,7 @@ describe('crashReporter module', () => {
8485 } )
8586
8687 it ( 'should not send minidump if uploadToServer is false' , function ( done ) {
87- this . timeout ( 180000 )
88+ this . timeout ( specTimeout )
8889
8990 let dumpFile
9091 let crashesDir = crashReporter . getCrashesDirectory ( )
@@ -149,8 +150,46 @@ describe('crashReporter module', () => {
149150 } )
150151 } )
151152
153+ it ( 'should send minidump with updated extra parameters when node processes crash' , function ( done ) {
154+ if ( process . platform === 'linux' ) {
155+ // FIXME(alexeykuzmin): Skip the test.
156+ // this.skip()
157+ return
158+ }
159+ // TODO(alexeykuzmin): Skip the test instead of marking it as passed.
160+ if ( process . env . APPVEYOR === 'True' ) return done ( )
161+ this . timeout ( specTimeout )
162+ stopServer = startServer ( {
163+ callback ( port ) {
164+ const crashesDir = path . join ( app . getPath ( 'temp' ) , `${ process . platform === 'win32' ? 'Zombies' : app . getName ( ) } Crashes` )
165+ const version = app . getVersion ( )
166+ const crashPath = path . join ( fixtures , 'module' , 'crash.js' )
167+ if ( process . platform === 'win32' ) {
168+ const crashServiceProcess = childProcess . spawn ( process . execPath , [
169+ `--reporter-url=http://127.0.0.1:${ port } ` ,
170+ '--application-name=Zombies' ,
171+ `--crashes-directory=${ crashesDir } `
172+ ] , {
173+ env : {
174+ ELECTRON_INTERNAL_CRASH_SERVICE : 1
175+ } ,
176+ detached : true
177+ } )
178+ remote . process . crashServicePid = crashServiceProcess . pid
179+ }
180+ childProcess . fork ( crashPath , [ port , version , crashesDir ] , { silent : true } )
181+ } ,
182+ processType : 'browser' ,
183+ done : done ,
184+ preAssert : fields => {
185+ expect ( String ( fields . newExtra ) ) . to . equal ( 'newExtra' )
186+ expect ( String ( fields . removeExtra ) ) . to . equal ( undefined )
187+ }
188+ } )
189+ } )
190+
152191 it ( 'should send minidump with updated extra parameters' , function ( done ) {
153- this . timeout ( 180000 )
192+ this . timeout ( specTimeout )
154193
155194 stopServer = startServer ( {
156195 callback ( port ) {
@@ -395,7 +434,7 @@ const waitForCrashReport = () => {
395434 } )
396435}
397436
398- const startServer = ( { callback, processType, done } ) => {
437+ const startServer = ( { callback, processType, done, preAssert , postAssert } ) => {
399438 let called = false
400439 const server = http . createServer ( ( req , res ) => {
401440 const form = new multiparty . Form ( )
@@ -413,10 +452,12 @@ const startServer = ({ callback, processType, done }) => {
413452 expect ( String ( fields . _productName ) ) . to . equal ( 'Zombies' )
414453 expect ( String ( fields . _companyName ) ) . to . equal ( 'Umbrella Corporation' )
415454 expect ( String ( fields . _version ) ) . to . equal ( app . getVersion ( ) )
455+ if ( preAssert ) preAssert ( fields )
416456
417457 const reportId = 'abc-123-def-456-abc-789-abc-123-abcd'
418458 res . end ( reportId , ( ) => {
419459 waitForCrashReport ( ) . then ( ( ) => {
460+ if ( postAssert ) postAssert ( reportId )
420461 expect ( crashReporter . getLastCrashReport ( ) . id ) . to . equal ( reportId )
421462 expect ( crashReporter . getUploadedReports ( ) ) . to . be . an ( 'array' ) . that . is . not . empty ( )
422463 expect ( crashReporter . getUploadedReports ( ) [ 0 ] . id ) . to . equal ( reportId )
0 commit comments