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

Side by Side Diff: go/src/infra/appengine/test-results/frontend/get.go

Issue 2252623002: test-results: package model: Add type TestList (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@cl-ing_upload
Patch Set: Fix renamed function call Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | go/src/infra/appengine/test-results/model/aggregate_result.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package frontend 1 package frontend
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "encoding/json" 5 "encoding/json"
6 "fmt" 6 "fmt"
7 "infra/appengine/test-results/model" 7 "infra/appengine/test-results/model"
8 "io" 8 "io"
9 "net/http" 9 "net/http"
10 "regexp" 10 "regexp"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 http.Error(w, err.Error(), http.StatusInternalServerErro r) 214 http.Error(w, err.Error(), http.StatusInternalServerErro r)
215 logging.Errorf(c, "failed to clean test results JSON: %v ", err) 215 logging.Errorf(c, "failed to clean test results JSON: %v ", err)
216 return 216 return
217 } 217 }
218 aggr := model.AggregateResult{Builder: params.Builder} 218 aggr := model.AggregateResult{Builder: params.Builder}
219 if err := json.NewDecoder(data).Decode(&aggr); err != nil { 219 if err := json.NewDecoder(data).Decode(&aggr); err != nil {
220 http.Error(w, err.Error(), http.StatusInternalServerErro r) 220 http.Error(w, err.Error(), http.StatusInternalServerErro r)
221 logging.Errorf(c, "failed to unmarshal test results JSON : %+v: %v", data, err) 221 logging.Errorf(c, "failed to unmarshal test results JSON : %+v: %v", data, err)
222 return 222 return
223 } 223 }
224 » » aggr.Tests.ToTestList() 224 » » tl := aggr.ToTestList()
225 buf := &bytes.Buffer{} 225 buf := &bytes.Buffer{}
226 » » if err := json.NewEncoder(buf).Encode(aggr.Tests); err != nil { 226 » » if err := json.NewEncoder(buf).Encode(&tl); err != nil {
227 http.Error(w, err.Error(), http.StatusInternalServerErro r) 227 http.Error(w, err.Error(), http.StatusInternalServerErro r)
228 logging.Errorf(c, "failed to marshal test list JSON: %+v , %v", aggr.Tests, err) 228 logging.Errorf(c, "failed to marshal test list JSON: %+v , %v", aggr.Tests, err)
229 return 229 return
230 } 230 }
231 finalData = buf 231 finalData = buf
232 } 232 }
233 233
234 respondJSON(c, w, finalData, tf.LastMod, params.Callback) 234 respondJSON(c, w, finalData, tf.LastMod, params.Callback)
235 } 235 }
236 236
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 } 274 }
275 275
276 // wrapCallback returns an io.Reader that wraps the data in r in a 276 // wrapCallback returns an io.Reader that wraps the data in r in a
277 // JavaScript-style function call with the supplied name as the function name. 277 // JavaScript-style function call with the supplied name as the function name.
278 func wrapCallback(r io.Reader, name string) io.Reader { 278 func wrapCallback(r io.Reader, name string) io.Reader {
279 start := bytes.NewReader([]byte(name + "(")) 279 start := bytes.NewReader([]byte(name + "("))
280 end := bytes.NewReader([]byte(");")) 280 end := bytes.NewReader([]byte(");"))
281 return io.MultiReader(start, r, end) 281 return io.MultiReader(start, r, end)
282 } 282 }
OLDNEW
« no previous file with comments | « no previous file | go/src/infra/appengine/test-results/model/aggregate_result.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698