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

Unified Diff: net/test/embedded_test_server/embedded_test_server.h

Issue 1905873002: Add content_browsertests for testing cache control flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #13 Created 4 years, 7 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
Index: net/test/embedded_test_server/embedded_test_server.h
diff --git a/net/test/embedded_test_server/embedded_test_server.h b/net/test/embedded_test_server/embedded_test_server.h
index 93ba69086265444ee45e6a55629e0e94ccb21083..dd2966d3814a07700177664af916592ddf53e158 100644
--- a/net/test/embedded_test_server/embedded_test_server.h
+++ b/net/test/embedded_test_server/embedded_test_server.h
@@ -117,6 +117,8 @@ class EmbeddedTestServer {
typedef base::Callback<std::unique_ptr<HttpResponse>(
const HttpRequest& request)>
HandleRequestCallback;
+ typedef base::Callback<void(const HttpRequest& request)>
+ MonitorRequestCallback;
// Creates a http test server. Start() must be called to start the server.
// |type| indicates the protocol type of the server (HTTP/HTTPS).
@@ -133,7 +135,7 @@ class EmbeddedTestServer {
// This is the equivalent of calling InitializeAndListen() followed by
// StartAcceptingConnections().
// Returns whether a listening socket has been successfully created.
- bool Start();
+ bool Start() WARN_UNUSED_RESULT;
// Starts listening for incoming connections but will not yet accept them.
// Returns whether a listening socket has been succesfully created.
@@ -207,6 +209,11 @@ class EmbeddedTestServer {
// on UI thread.
void RegisterRequestHandler(const HandleRequestCallback& callback);
+ // Adds request monitors. The |callback| is called before any handlers are
+ // called, but can not respond it. This is useful to monitor requests that
+ // will be handled by other request handlers.
+ void RegisterRequestMonitor(const MonitorRequestCallback& callback);
+
// Adds default handlers, including those added by AddDefaultHandlers, to be
// tried after all other user-specified handlers have been tried.
void RegisterDefaultHandler(const HandleRequestCallback& callback);
@@ -271,8 +278,9 @@ class EmbeddedTestServer {
// Owns the HttpConnection objects.
std::map<StreamSocket*, HttpConnection*> connections_;
- // Vector of registered and default request handlers.
+ // Vector of registered and default request handlers and monitors.
std::vector<HandleRequestCallback> request_handlers_;
+ std::vector<MonitorRequestCallback> request_monitors_;
std::vector<HandleRequestCallback> default_request_handlers_;
base::ThreadChecker thread_checker_;

Powered by Google App Engine
This is Rietveld 408576698