Merge pull request #10175 from electron/fix-more-crashes

Fix a few more crashes in tests
This commit is contained in:
Cheng Zhao 2017-08-02 19:03:13 +09:00 committed by GitHub
commit 5e06ac11e9
8 changed files with 23 additions and 8 deletions

2
.gitignore vendored
View file

@ -14,6 +14,7 @@
*.vcxproj.filters
*.vcxproj.user
*.xcodeproj
node_modules/
/.idea/
/brightray/brightray.opensdf
/brightray/brightray.sdf
@ -25,7 +26,6 @@
/build/
/dist/
/external_binaries/
/node_modules
/out/
/vendor/.gclient
/vendor/debian_jessie_amd64-sysroot/

View file

@ -15,6 +15,7 @@
#include "base/strings/string_util.h"
#include "base/synchronization/lock.h"
#include "base/task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/base/file_stream.h"
#include "net/base/filename_util.h"
#include "net/base/io_buffer.h"
@ -119,8 +120,11 @@ void URLRequestAsarJob::Start() {
weak_ptr_factory_.GetWeakPtr(),
base::Owned(meta_info)));
} else {
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
net::ERR_FILE_NOT_FOUND));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&URLRequestAsarJob::DidOpen,
weak_ptr_factory_.GetWeakPtr(),
net::ERR_FILE_NOT_FOUND));
}
}

View file

@ -89,7 +89,6 @@ class URLRequestAsarJob : public net::URLRequestJob {
// Callback after fetching file info on a background thread.
void DidFetchMetaInfo(const FileMetaInfo* meta_info);
// Callback after opening file on a background thread.
void DidOpen(int result);

View file

@ -81,6 +81,9 @@ def parse_args():
help='Run tests in CI mode',
action='store_true',
required=False)
parser.add_argument('-g',
help='Filter',
required=False)
parser.add_argument('-v', '--verbose',
action='store_true',
help='Prints the output of the subprocesses')

View file

@ -208,7 +208,7 @@ describe('app module', function () {
})
})
describe('app.importCertificate', function () {
xdescribe('app.importCertificate', function () {
if (process.platform !== 'linux') return
var w = null
@ -405,7 +405,7 @@ describe('app module', function () {
})
})
describe('select-client-certificate event', function () {
xdescribe('select-client-certificate event', function () {
let w = null
beforeEach(function () {

View file

@ -1144,13 +1144,16 @@ describe('BrowserWindow module', function () {
w.loadURL('file://' + path.join(fixtures, 'api', 'sandbox.html?window-events'))
})
it('works for web contents events', function (done) {
it('works for stop events', function (done) {
waitForEvents(w.webContents, [
'did-navigate',
'did-fail-load',
'did-stop-loading'
], done)
w.loadURL('file://' + path.join(fixtures, 'api', 'sandbox.html?webcontents-stop'))
})
it('works for web contents events', function (done) {
waitForEvents(w.webContents, [
'did-finish-load',
'did-frame-finish-load',

View file

@ -12,7 +12,7 @@ const {remote} = require('electron')
const {app, BrowserWindow, crashReporter} = remote.require('electron')
describe('crashReporter module', function () {
if (process.mas) {
if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) {
return
}

View file

@ -590,6 +590,12 @@ describe('webContents module', function () {
})
describe('destroy()', () => {
// Destroying webContents in its event listener is going to crash when
// Electron is built in Debug mode.
if (process.platform !== 'darwin') {
return
}
let server
before(function (done) {