Add spec for custom uploading parameters.

This commit is contained in:
Cheng Zhao 2013-11-18 18:37:32 +08:00
parent d181ff4e7f
commit ed3358e501
4 changed files with 17 additions and 5 deletions

View file

@ -36,6 +36,9 @@ void CrashReporter::Start(std::string product_name,
void CrashReporter::SetUploadParameters(const StringMap& parameters) {
upload_parameters_ = parameters;
upload_parameters_["process_type"] = is_browser_ ? "browser" : "renderer";
// Setting platform dependent parameters.
SetUploadParameters();
}
} // namespace crash_reporter

View file

@ -53,8 +53,9 @@ struct FromV8Value {
v8::Handle<v8::Object> v8_dict = value_->ToObject();
v8::Handle<v8::Array> v8_keys = v8_dict->GetOwnPropertyNames();
for (uint32_t i = 0; i < v8_keys->Length(); ++i) {
std::string key = FromV8Value(v8_keys->Get(i));
dict[key] = std::string(FromV8Value(v8_dict->Get(i)));
v8::Handle<v8::Value> v8_key = v8_keys->Get(i);
std::string key = FromV8Value(v8_key);
dict[key] = std::string(FromV8Value(v8_dict->Get(v8_key)));
}
return dict;

View file

@ -13,13 +13,17 @@ describe 'crash-reporter module', ->
server = http.createServer (req, res) ->
form = new formidable.IncomingForm()
form.parse req, (error, fields, files) ->
assert.equal fields['prod'], 'Atom-Shell Renderer'
assert.equal fields['ver'], process.versions['atom-shell']
assert.equal fields['process_type'], 'renderer'
assert.equal fields['platform'], process.platform
assert.equal fields['extra1'], 'extra1'
assert.equal fields['extra2'], 'extra2'
assert.equal files['upload_file_minidump']['name'], 'minidump.dmp'
w.destroy()
res.end()
server.close()
done()
server.listen 901007, '127.0.0.1', ->
server.listen 1127, '127.0.0.1', ->
w.loadUrl 'file://' + path.join(fixtures, 'api', 'crash.html')

View file

@ -3,9 +3,13 @@
<script type="text/javascript" charset="utf-8">
var crashReporter = require('crash-reporter');
crashReporter.start({
submitUrl: 'http://127.0.0.1:901007',
submitUrl: 'http://127.0.0.1:1127',
autoSubmit: true,
ignoreSystemCrashHandler: true
ignoreSystemCrashHandler: true,
extra: {
'extra1': 'extra1',
'extra2': 'extra2',
}
});
setImmediate(function() { process.crash(); });