Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9374)

Unified Diff: chrome/test/data/third_party/spaceport/server/index.js

Issue 10134041: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/third_party/spaceport/results/raw/1330415380941_10.0.1.187.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/third_party/spaceport/server/index.js
diff --git a/chrome/test/data/third_party/spaceport/server/index.js b/chrome/test/data/third_party/spaceport/server/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee5cd365d0b94fe8f3138b775d9552c874bde1f5
--- /dev/null
+++ b/chrome/test/data/third_party/spaceport/server/index.js
@@ -0,0 +1,50 @@
+var express = require('express');
+var app = express.createServer();
+
+app.configure(function () {
+ app.use(express.static(__dirname + '/../'));
+ app.use(express.logger());
+ app.use(app.router);
+});
+
+app.configure('development', function(){
+ app.use(express.errorHandler({
+ dumpExceptions: true,
+ showStack: true
+ }));
+});
+
+app.configure('production', function(){
+ app.use(express.errorHandler());
+});
+
+var UPLOAD_DIRECTORY = __dirname + '/uploads';
+
+function saveUpload(data) {
+ var filename = UPLOAD_DIRECTORY + '/' + (data.date + '_' + data.ip).replace(/[^A-Za-z0-9_.-]/g, '_') + '.json';
+ require('fs').writeFile(filename, JSON.stringify(data) + '\n', 'utf8');
+}
+
+app.post('/results', function (req, res) {
+ var date = Date.now();
+
+ var jsonData = '';
+ req.on('data', function (data) {
+ jsonData += data.toString('utf8');
+ });
+
+ req.on('end', function () {
+ var userData = JSON.parse(jsonData);
+ saveUpload({
+ date: date,
+ ip: req.connection.remoteAddress,
+ userData: userData
+ });
+ res.end();
+ });
+
+ req.resume();
+});
+
+app.listen(3002);
+console.log('Listening on :3002');
« no previous file with comments | « chrome/test/data/third_party/spaceport/results/raw/1330415380941_10.0.1.187.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698