add const and other small edits
This commit is contained in:
parent
7b08a93549
commit
93df164485
7 changed files with 24 additions and 18 deletions
|
@ -39,7 +39,7 @@ void RemoveExtraParameter(const std::string& key) {
|
||||||
CrashReporter::GetInstance()->RemoveExtraParameter(key);
|
CrashReporter::GetInstance()->RemoveExtraParameter(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, std::string> GetParameters() {
|
std::map<std::string, std::string> GetParameters() const {
|
||||||
return CrashReporter::GetInstance()->GetParameters();
|
return CrashReporter::GetInstance()->GetParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,16 +80,20 @@ void CrashReporter::InitBreakpad(const std::string& product_name,
|
||||||
const std::string& submit_url,
|
const std::string& submit_url,
|
||||||
const base::FilePath& crashes_dir,
|
const base::FilePath& crashes_dir,
|
||||||
bool auto_submit,
|
bool auto_submit,
|
||||||
bool skip_system_crash_handler) {}
|
bool skip_system_crash_handler) {
|
||||||
|
}
|
||||||
|
|
||||||
void CrashReporter::SetUploadParameters() {}
|
void CrashReporter::SetUploadParameters() {
|
||||||
|
}
|
||||||
|
|
||||||
void CrashReporter::SetExtraParameter(const std::string& key,
|
void CrashReporter::SetExtraParameter(const std::string& key,
|
||||||
const std::string& value) {}
|
const std::string& value) {
|
||||||
|
}
|
||||||
|
|
||||||
void CrashReporter::RemoveExtraParameter(const std::string& key) {}
|
void CrashReporter::RemoveExtraParameter(const std::string& key) {
|
||||||
|
}
|
||||||
|
|
||||||
std::map<std::string, std::string> CrashReporter::GetParameters() {
|
std::map<std::string, std::string> CrashReporter::GetParameters() const {
|
||||||
return upload_parameters_;
|
return upload_parameters_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class CrashReporter {
|
||||||
virtual void SetExtraParameter(const std::string& key,
|
virtual void SetExtraParameter(const std::string& key,
|
||||||
const std::string& value);
|
const std::string& value);
|
||||||
virtual void RemoveExtraParameter(const std::string& key);
|
virtual void RemoveExtraParameter(const std::string& key);
|
||||||
virtual std::map<std::string, std::string> GetParameters();
|
virtual std::map<std::string, std::string> GetParameters() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CrashReporter();
|
CrashReporter();
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CrashReporterMac : public CrashReporter {
|
||||||
void SetExtraParameter(const std::string& key,
|
void SetExtraParameter(const std::string& key,
|
||||||
const std::string& value) override;
|
const std::string& value) override;
|
||||||
void RemoveExtraParameter(const std::string& key) override;
|
void RemoveExtraParameter(const std::string& key) override;
|
||||||
std::map<std::string, std::string> GetParameters() override;
|
std::map<std::string, std::string> GetParameters() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
|
friend struct base::DefaultSingletonTraits<CrashReporterMac>;
|
||||||
|
|
|
@ -121,19 +121,18 @@ void CrashReporterMac::RemoveExtraParameter(const std::string& key) {
|
||||||
upload_parameters_.erase(key);
|
upload_parameters_.erase(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, std::string> CrashReporterMac::GetParameters() {
|
std::map<std::string, std::string> CrashReporterMac::GetParameters() const {
|
||||||
if (simple_string_dictionary_) {
|
if (simple_string_dictionary_) {
|
||||||
std::map<std::string, std::string> ret;
|
std::map<std::string, std::string> ret;
|
||||||
crashpad::SimpleStringDictionary::Iterator iter(*simple_string_dictionary_);
|
crashpad::SimpleStringDictionary::Iterator iter(*simple_string_dictionary_);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
const crashpad::SimpleStringDictionary::Entry* entry = iter.Next();
|
const auto entry = iter.Next();
|
||||||
if (!entry) break;
|
if (!entry) break;
|
||||||
ret[entry->key] = entry->value;
|
ret[entry->key] = entry->value;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
|
||||||
return upload_parameters_;
|
|
||||||
}
|
}
|
||||||
|
return upload_parameters_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CrashReporter::UploadReportResult>
|
std::vector<CrashReporter::UploadReportResult>
|
||||||
|
|
|
@ -20,7 +20,8 @@ class CrashReporter {
|
||||||
uploadToServer
|
uploadToServer
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
if (uploadToServer == null) uploadToServer = options.autoSubmit || true
|
if (uploadToServer == null) uploadToServer = options.autoSubmit
|
||||||
|
if (uploadToServer == null) uploadToServer = true
|
||||||
if (ignoreSystemCrashHandler == null) ignoreSystemCrashHandler = false
|
if (ignoreSystemCrashHandler == null) ignoreSystemCrashHandler = false
|
||||||
if (extra == null) extra = {}
|
if (extra == null) extra = {}
|
||||||
|
|
||||||
|
@ -36,7 +37,9 @@ class CrashReporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const env = { ELECTRON_INTERNAL_CRASH_SERVICE: 1 }
|
const env = {
|
||||||
|
ELECTRON_INTERNAL_CRASH_SERVICE: 1
|
||||||
|
}
|
||||||
const args = [
|
const args = [
|
||||||
'--reporter-url=' + submitURL,
|
'--reporter-url=' + submitURL,
|
||||||
'--application-name=' + this.getProductName(),
|
'--application-name=' + this.getProductName(),
|
||||||
|
|
|
@ -11,7 +11,7 @@ const {closeWindow} = require('./window-helpers')
|
||||||
const {remote} = require('electron')
|
const {remote} = require('electron')
|
||||||
const {app, BrowserWindow, crashReporter} = remote.require('electron')
|
const {app, BrowserWindow, crashReporter} = remote.require('electron')
|
||||||
|
|
||||||
describe('crashReporter module', () => {
|
describe.only('crashReporter module', () => {
|
||||||
if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) return
|
if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) return
|
||||||
|
|
||||||
let originalTempDirectory = null
|
let originalTempDirectory = null
|
||||||
|
@ -197,10 +197,10 @@ describe('crashReporter module', () => {
|
||||||
describe('getProductName', () => {
|
describe('getProductName', () => {
|
||||||
it('returns the product name if one is specified', () => {
|
it('returns the product name if one is specified', () => {
|
||||||
const name = crashReporter.getProductName()
|
const name = crashReporter.getProductName()
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'darwin') {
|
||||||
assert.equal(name, 'Zombies')
|
|
||||||
} else {
|
|
||||||
assert.equal(name, 'Electron Test')
|
assert.equal(name, 'Electron Test')
|
||||||
|
} else {
|
||||||
|
assert.equal(name, 'Zombies')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue