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

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: Updated timing to server=90s and test=120s 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..0861fab3efd1f68246f1804a5ed5bbf8ac3a9320 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 90 seconds for proxied responses, in order to test if
+// the proxy will timeout on the site. 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.
+ time.Sleep(90 * time.Second);
+ 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