Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 package model | |
| 2 | |
| 3 import ( | |
| 4 "bytes" | |
| 5 "encoding/json" | |
| 6 "io/ioutil" | |
| 7 "path/filepath" | |
| 8 "testing" | |
| 9 | |
| 10 . "github.com/smartystreets/goconvey/convey" | |
| 11 ) | |
| 12 | |
| 13 func TestEndToEnd(t *testing.T) { | |
| 14 t.Parallel() | |
| 15 | |
| 16 Convey("End to end", t, func() { | |
| 17 Convey("FullResult: clean, unmarshal JSON, merge, trim", func() { | |
| 18 b, err := ioutil.ReadFile(filepath.Join("testdata", "ful l_results_callback.json")) | |
| 19 So(err, ShouldBeNil) | |
| 20 r, err := CleanJSON(bytes.NewReader(bytes.TrimSpace(b))) | |
| 21 So(err, ShouldBeNil) | |
| 22 | |
| 23 expected := &AggregateResult{ | |
| 24 Builder: "Webkit", | |
| 25 Version: ResultsVersion, | |
| 26 BuilderInfo: &BuilderInfo{ | |
| 27 BuildNumbers: []Number{3}, | |
| 28 ChromeRevs: []string{"5678"}, | |
| 29 FailureMap: FailureLongNames, | |
| 30 FailuresByType: map[string][]int{ | |
| 31 "AUDIO": {0}, | |
| 32 "CRASH": {3}, | |
| 33 "FAIL": {2}, | |
| 34 "IMAGE": {1}, | |
| 35 "IMAGE+TEXT": {0}, | |
| 36 "MISSING": {0}, | |
| 37 "PASS": {10}, | |
| 38 "SKIP": {2}, | |
| 39 "TEXT": {3}, | |
| 40 "TIMEOUT": {16}, | |
| 41 "LEAK": {1}, | |
| 42 }, | |
| 43 SecondsEpoch: []int64{1368146629}, | |
| 44 Tests: AggregateTest{ | |
| 45 "media": AggregateTest{ | |
| 46 "W3C": AggregateTest{ | |
| 47 "audio": Aggrega teTest{ | |
|
martiniss
2016/08/12 00:14:24
Just to confirm, the W3C video src tests in the te
nishanths
2016/08/12 02:37:39
Yes, added comment. Also added comment that is a p
| |
| 48 "src": A ggregateTest{ | |
| 49 "src_removal_does_not_trigger_loadstart.html": &AggregateTestLeaf{ | |
| 50 Results: []ResultSummary{{1, "P"}}, | |
| 51 Runtimes: []RuntimeSummary{{1, 4}}, | |
| 52 }, | |
| 53 }, | |
| 54 }, | |
| 55 }, | |
| 56 "encrypted-media": Aggre gateTest{ | |
| 57 "random-test-1.h tml": &AggregateTestLeaf{ | |
| 58 Bugs: []string{"crbug.com/1234"}, | |
| 59 Results: []ResultSummary{{1, "T"}}, | |
| 60 Runtimes : []RuntimeSummary{{1, 6}}, | |
| 61 Expected : []string{"TIMEOUT"}, | |
| 62 }, | |
| 63 "random-test-2.h tml": &AggregateTestLeaf{ | |
| 64 Expected : []string{"TIMEOUT"}, | |
| 65 Results: []ResultSummary{{1, "T"}}, | |
| 66 Runtimes : []RuntimeSummary{{1, 0}}, | |
| 67 }, | |
| 68 }, | |
| 69 "media-document-audio-re paint.html": &AggregateTestLeaf{ | |
| 70 Expected: []stri ng{"IMAGE"}, | |
| 71 Results: []Resu ltSummary{{1, "I"}}, | |
| 72 Runtimes: []Runt imeSummary{{1, 0}}, | |
| 73 }, | |
| 74 "progress-events-generat ed-correctly.html": &AggregateTestLeaf{ | |
| 75 Expected: []stri ng{"PASS", "FAIL", "IMAGE", "TIMEOUT", "CRASH", "MISSING"}, | |
| 76 Results: []Resu ltSummary{{1, "T"}}, | |
| 77 Runtimes: []Runt imeSummary{{1, 6}}, | |
| 78 }, | |
| 79 "flaky-failed.html": &Ag gregateTestLeaf{ | |
| 80 Expected: []stri ng{"PASS", "FAIL"}, | |
| 81 Results: []Resu ltSummary{{1, "Q"}}, | |
| 82 Runtimes: []Runt imeSummary{{1, 0}}, | |
| 83 }, | |
| 84 "unexpected-fail.html": &AggregateTestLeaf{ | |
| 85 Results: []Resu ltSummary{{1, "Q"}}, | |
| 86 Runtimes: []Runt imeSummary{{1, 0}}, | |
| 87 }, | |
| 88 "unexpected-leak.html": &AggregateTestLeaf{ | |
| 89 Results: []Resu ltSummary{{1, "K"}}, | |
| 90 Runtimes: []Runt imeSummary{{1, 0}}, | |
| 91 }, | |
| 92 "unexpected-flake.html": &AggregateTestLeaf{ | |
| 93 Results: []Resu ltSummary{{1, "QP"}}, | |
| 94 Runtimes: []Runt imeSummary{{1, 0}}, | |
| 95 }, | |
| 96 "unexpected-unexpected.h tml": &AggregateTestLeaf{ | |
| 97 Results: []Resu ltSummary{{1, "U"}}, | |
| 98 Runtimes: []Runt imeSummary{{1, 0}}, | |
| 99 }, | |
| 100 }, | |
| 101 }, | |
| 102 }, | |
| 103 } | |
| 104 | |
| 105 var aggr AggregateResult | |
| 106 aggr.Builder = "Webkit" | |
| 107 var x FullResult | |
|
martiniss
2016/08/12 00:14:24
nit: "var result FullResult"?
nishanths
2016/08/12 02:37:39
Done.
| |
| 108 | |
| 109 So(json.NewDecoder(r).Decode(&x), ShouldBeNil) | |
| 110 y, err := x.AggregateResult() | |
| 111 So(err, ShouldBeNil) | |
| 112 So(aggr.Merge(&y), ShouldBeNil) | |
| 113 So(aggr.Trim(ResultsSize), ShouldBeNil) | |
| 114 So(&aggr, ShouldResemble, expected) | |
| 115 }) | |
| 116 }) | |
| 117 } | |
| OLD | NEW |