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

Side by Side Diff: milo/appengine/buildbot/html_data.go

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix builder.html pointer Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 9
10 "github.com/luci/gae/impl/memory" 10 "github.com/luci/gae/impl/memory"
11 "github.com/luci/luci-go/common/clock/testclock" 11 "github.com/luci/luci-go/common/clock/testclock"
12 "github.com/luci/luci-go/milo/api/resp" 12 "github.com/luci/luci-go/milo/api/resp"
13 » "github.com/luci/luci-go/milo/appengine/settings" 13 » "github.com/luci/luci-go/milo/appengine/common"
14 "github.com/luci/luci-go/server/templates" 14 "github.com/luci/luci-go/server/templates"
15 "golang.org/x/net/context" 15 "golang.org/x/net/context"
16 ) 16 )
17 17
18 // We put this here because _test.go files are sometimes not built. 18 // We put this here because _test.go files are sometimes not built.
19 var testCases = []struct { 19 var testCases = []struct {
20 builder string 20 builder string
21 build int 21 build int
22 }{ 22 }{
23 {"CrWinGoma", 30608}, 23 {"CrWinGoma", 30608},
24 {"win_chromium_rel_ng", 246309}, 24 {"win_chromium_rel_ng", 246309},
25 } 25 }
26 26
27 // TestableBuild is a subclass of Build that interfaces with TestableHandler and 27 // BuildTestData returns sample test data for build pages.
28 // includes sample test data. 28 func BuildTestData() []common.TestBundle {
29 type TestableBuild struct{ Build }
30
31 // TestableBuilder is a subclass of Builder that interfaces with TestableHandler
32 // and includes sample test data.
33 type TestableBuilder struct{ Builder }
34
35 // TestData returns sample test data.
36 func (b Build) TestData() []settings.TestBundle {
37 c := memory.Use(context.Background()) 29 c := memory.Use(context.Background())
38 c, _ = testclock.UseTime(c, testclock.TestTimeUTC) 30 c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
39 » bundles := []settings.TestBundle{} 31 » bundles := []common.TestBundle{}
40 for _, tc := range testCases { 32 for _, tc := range testCases {
41 build, err := build(c, "debug", tc.builder, tc.build) 33 build, err := build(c, "debug", tc.builder, tc.build)
42 if err != nil { 34 if err != nil {
43 panic(fmt.Errorf( 35 panic(fmt.Errorf(
44 "Encountered error while building debug/%s/%s.\n %s", 36 "Encountered error while building debug/%s/%s.\n %s",
45 tc.builder, tc.build, err)) 37 tc.builder, tc.build, err))
46 } 38 }
47 » » bundles = append(bundles, settings.TestBundle{ 39 » » bundles = append(bundles, common.TestBundle{
48 Description: fmt.Sprintf("Debug page: %s/%d", tc.builder , tc.build), 40 Description: fmt.Sprintf("Debug page: %s/%d", tc.builder , tc.build),
49 Data: templates.Args{ 41 Data: templates.Args{
50 "Build": build, 42 "Build": build,
51 }, 43 },
52 }) 44 })
53 } 45 }
54 return bundles 46 return bundles
55 } 47 }
56 48
57 // TestData returns sample test data. 49 // BiulderTestData returns sample test data for builder pages.
58 func (b Builder) TestData() []settings.TestBundle { 50 func BuilderTestData() []common.TestBundle {
59 » return []settings.TestBundle{ 51 » return []common.TestBundle{
60 { 52 {
61 Description: "Basic Test no builds", 53 Description: "Basic Test no builds",
62 Data: templates.Args{ 54 Data: templates.Args{
63 "Builder": &resp.Builder{ 55 "Builder": &resp.Builder{
64 Name: "Sample Builder", 56 Name: "Sample Builder",
65 }, 57 },
66 }, 58 },
67 }, 59 },
68 { 60 {
69 Description: "Basic Test with builds", 61 Description: "Basic Test with builds",
(...skipping 25 matching lines...) Expand all
95 Label: "Some cur rent build", 87 Label: "Some cur rent build",
96 }, 88 },
97 Revision: "deadbeef", 89 Revision: "deadbeef",
98 }, 90 },
99 }, 91 },
100 }, 92 },
101 }, 93 },
102 }, 94 },
103 } 95 }
104 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698