| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 /* | 3 /* |
| 4 Runs the frontend portion of the fuzzer. This primarily is the webserver (see D
ESIGN.md) | 4 Runs the frontend portion of the fuzzer. This primarily is the webserver (see D
ESIGN.md) |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "encoding/base64" | 9 "encoding/base64" |
| 10 "encoding/json" | 10 "encoding/json" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 glog.Errorf("Failed to expand template: %v", err) | 261 glog.Errorf("Failed to expand template: %v", err) |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 type countSummary struct { | 265 type countSummary struct { |
| 266 Category string `json:"category"` | 266 Category string `json:"category"` |
| 267 CategoryDisplay string `json:"categoryDisplay"` | 267 CategoryDisplay string `json:"categoryDisplay"` |
| 268 TotalBad int `json:"totalBadCount"` | 268 TotalBad int `json:"totalBadCount"` |
| 269 TotalGrey int `json:"totalGreyCount"` | 269 TotalGrey int `json:"totalGreyCount"` |
| 270 // "This" means "newly introduced/fixed in this revision" | 270 // "This" means "newly introduced/fixed in this revision" |
| 271 » ThisBad int `json:"thisBadCount"` | 271 » ThisBad int `json:"thisBadCount"` |
| 272 » ThisGrey int `json:"thisGreyCount"` | 272 » ThisRegression int `json:"thisRegressionCount"` |
| 273 } | 273 } |
| 274 | 274 |
| 275 func summaryJSONHandler(w http.ResponseWriter, r *http.Request) { | 275 func summaryJSONHandler(w http.ResponseWriter, r *http.Request) { |
| 276 summary := getSummary() | 276 summary := getSummary() |
| 277 | 277 |
| 278 if err := json.NewEncoder(w).Encode(summary); err != nil { | 278 if err := json.NewEncoder(w).Encode(summary); err != nil { |
| 279 glog.Errorf("Failed to write or encode output: %v", err) | 279 glog.Errorf("Failed to write or encode output: %v", err) |
| 280 return | 280 return |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 func getSummary() []countSummary { | 284 func getSummary() []countSummary { |
| 285 counts := make([]countSummary, 0, len(fcommon.FUZZ_CATEGORIES)) | 285 counts := make([]countSummary, 0, len(fcommon.FUZZ_CATEGORIES)) |
| 286 for _, cat := range fcommon.FUZZ_CATEGORIES { | 286 for _, cat := range fcommon.FUZZ_CATEGORIES { |
| 287 o := countSummary{ | 287 o := countSummary{ |
| 288 CategoryDisplay: fcommon.PrettifyCategory(cat), | 288 CategoryDisplay: fcommon.PrettifyCategory(cat), |
| 289 Category: cat, | 289 Category: cat, |
| 290 } | 290 } |
| 291 c := syncer.FuzzCount{ | 291 c := syncer.FuzzCount{ |
| 292 » » » TotalBad: -1, | 292 » » » TotalBad: -1, |
| 293 » » » TotalGrey: -1, | 293 » » » TotalGrey: -1, |
| 294 » » » ThisBad: -1, | 294 » » » ThisBad: -1, |
| 295 » » » ThisGrey: -1, | 295 » » » ThisRegression: -1, |
| 296 } | 296 } |
| 297 if fuzzSyncer != nil { | 297 if fuzzSyncer != nil { |
| 298 c = fuzzSyncer.LastCount(cat) | 298 c = fuzzSyncer.LastCount(cat) |
| 299 } | 299 } |
| 300 o.TotalBad = c.TotalBad | 300 o.TotalBad = c.TotalBad |
| 301 o.ThisBad = c.ThisBad | 301 o.ThisBad = c.ThisBad |
| 302 o.TotalGrey = c.TotalGrey | 302 o.TotalGrey = c.TotalGrey |
| 303 » » o.ThisGrey = c.ThisGrey | 303 » » o.ThisRegression = c.ThisRegression |
| 304 counts = append(counts, o) | 304 counts = append(counts, o) |
| 305 } | 305 } |
| 306 return counts | 306 return counts |
| 307 } | 307 } |
| 308 | 308 |
| 309 func detailsJSONHandler(w http.ResponseWriter, r *http.Request) { | 309 func detailsJSONHandler(w http.ResponseWriter, r *http.Request) { |
| 310 w.Header().Set("Content-Type", "application/json") | 310 w.Header().Set("Content-Type", "application/json") |
| 311 | 311 |
| 312 category := r.FormValue("category") | 312 category := r.FormValue("category") |
| 313 name := r.FormValue("name") | 313 name := r.FormValue("name") |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 481 } |
| 482 var t bytes.Buffer | 482 var t bytes.Buffer |
| 483 if err := newBugTemplate.Execute(&t, b); err != nil { | 483 if err := newBugTemplate.Execute(&t, b); err != nil { |
| 484 util.ReportError(w, r, err, fmt.Sprintf("Could not create templa
te with %#v", b)) | 484 util.ReportError(w, r, err, fmt.Sprintf("Could not create templa
te with %#v", b)) |
| 485 return | 485 return |
| 486 } | 486 } |
| 487 q.Add("comment", t.String()) | 487 q.Add("comment", t.String()) |
| 488 // 303 means "make a GET request to this url" | 488 // 303 means "make a GET request to this url" |
| 489 http.Redirect(w, r, "https://bugs.chromium.org/p/skia/issues/entry?"+q.E
ncode(), 303) | 489 http.Redirect(w, r, "https://bugs.chromium.org/p/skia/issues/entry?"+q.E
ncode(), 303) |
| 490 } | 490 } |
| OLD | NEW |