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

Side by Side Diff: milo/appengine/common/middleware.go

Issue 2856273004: Milo: Increase test coverage for appengine/buildbot (Closed)
Patch Set: review Created 3 years, 6 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 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 common 5 package common
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 "strings" 9 "strings"
10 10
(...skipping 12 matching lines...) Expand all
23 "github.com/luci/luci-go/server/router" 23 "github.com/luci/luci-go/server/router"
24 "github.com/luci/luci-go/server/templates" 24 "github.com/luci/luci-go/server/templates"
25 ) 25 )
26 26
27 var authconfig *auth.Config 27 var authconfig *auth.Config
28 28
29 // GetTemplateBundles is used to render HTML templates. It provides base args 29 // GetTemplateBundles is used to render HTML templates. It provides base args
30 // passed to all templates. 30 // passed to all templates.
31 func GetTemplateBundle() *templates.Bundle { 31 func GetTemplateBundle() *templates.Bundle {
32 return &templates.Bundle{ 32 return &templates.Bundle{
33 » » Loader: templates.FileSystemLoader("templates"), 33 » » Loader: templates.FileSystemLoader("../frontend/templat es"),
34 DebugMode: info.IsDevAppServer, 34 DebugMode: info.IsDevAppServer,
35 DefaultTemplate: "base", 35 DefaultTemplate: "base",
36 DefaultArgs: func(c context.Context) (templates.Args, error) { 36 DefaultArgs: func(c context.Context) (templates.Args, error) {
37 r := getRequest(c) 37 r := getRequest(c)
38 path := r.URL.Path 38 path := r.URL.Path
39 loginURL, err := auth.LoginURL(c, path) 39 loginURL, err := auth.LoginURL(c, path)
40 if err != nil { 40 if err != nil {
41 return nil, err 41 return nil, err
42 } 42 }
43 logoutURL, err := auth.LogoutURL(c, path) 43 logoutURL, err := auth.LogoutURL(c, path)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 c.Context = WithRequest(c.Context, c.Request) 114 c.Context = WithRequest(c.Context, c.Request)
115 next(c) 115 next(c)
116 } 116 }
117 117
118 func getRequest(c context.Context) *http.Request { 118 func getRequest(c context.Context) *http.Request {
119 if req, ok := c.Value(&requestKey).(*http.Request); ok { 119 if req, ok := c.Value(&requestKey).(*http.Request); ok {
120 return req 120 return req
121 } 121 }
122 panic("No http.request found in context") 122 panic("No http.request found in context")
123 } 123 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/testdata/chromium_presubmit.426944.json ('k') | milo/appengine/frontend/buildbot_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698