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

Unified Diff: tools/chrome_proxy/testserver/server.go

Issue 2206363002: Added integration test to Chrome Proxy to verify direct connection on remote site timeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit missing period 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/chrome_proxy/testserver/app.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/chrome_proxy/testserver/server.go
diff --git a/tools/chrome_proxy/testserver/server.go b/tools/chrome_proxy/testserver/server.go
index 698e45ce46d1c3cfc1e997ef4a4a604db4509729..b8d9bf33a760406855ec2f4f9f8bd9eae8dfa802 100644
--- a/tools/chrome_proxy/testserver/server.go
+++ b/tools/chrome_proxy/testserver/server.go
@@ -35,12 +35,15 @@ import (
"net/http"
"os"
"strconv"
+ "strings"
+ "time"
)
func init() {
http.HandleFunc("/requestHeader", requestHeader)
http.HandleFunc("/resource", resource)
http.HandleFunc("/default", defaultResponse)
+ http.HandleFunc("/blackhole", blackholeProxy)
}
// requestHander returns request headers in response body as text.
@@ -82,6 +85,19 @@ func defaultResponse(w http.ResponseWriter, r *http.Request) {
}
}
+// blackholePoxy delays longer than 90s test failure threshold to any request
+// coming from the proxy. Responds immediately to any other request.
+func blackholeProxy(w http.ResponseWriter, r *http.Request) {
+ if strings.Contains(r.Header.Get("via"), "Chrome-Compression-Proxy") {
+ // Causes timeout on proxy, will then send BLOCK_ONCE.
+ // Appspot will 502 traffic at 120 seconds with no response.
sclittle 2016/08/09 22:30:36 115 seconds seems pretty close to 120 seconds - pe
Robert Ogden 2016/08/09 22:44:54 Done.
+ time.Sleep(115 * time.Second);
sclittle 2016/08/09 22:30:36 AIUI it's probably better to make the doc.ready ti
Robert Ogden 2016/08/09 22:44:54 Ah, that's a good point. I like that logic
+ w.Write([]byte("You are proxy"));
+ } else {
+ w.Write([]byte("You are direct"));
+ }
+}
+
type override struct {
status int
header http.Header
« no previous file with comments | « tools/chrome_proxy/testserver/app.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698