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

Unified Diff: chrome/browser/policy/cloud/test_request_interceptor.h

Issue 879233003: Initial RemoteCommandService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remote-commands
Patch Set: comments grammar fixes; fix win compile Created 5 years, 10 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: chrome/browser/policy/cloud/test_request_interceptor.h
diff --git a/chrome/browser/policy/cloud/test_request_interceptor.h b/chrome/browser/policy/cloud/test_request_interceptor.h
index 858af64556c1c766d739a543718cfdc1f7fa444d..65a4ee2644c7a00530e5d21bb92ff3245713e096 100644
--- a/chrome/browser/policy/cloud/test_request_interceptor.h
+++ b/chrome/browser/policy/cloud/test_request_interceptor.h
@@ -25,6 +25,8 @@ class URLRequestJob;
namespace policy {
+class TestingRemoteCommandsServer;
+
// Intercepts all requests to the given hostname while in scope, and allows
// queuing callbacks to handle expected requests. Must be created and destroyed
// while the IO thread is valid.
@@ -52,6 +54,11 @@ class TestRequestInterceptor {
// used only once, and in the order that they're pushed.
void PushJobCallback(const JobCallback& callback);
+ // Explicitly add certain request types to be ignored. For valid request of
+ // given ignored types, callback from queue will NOT be consumed and a bad
+ // request response will be sent back instead.
+ void AddIgnoredRequestType(const std::string& ignored_type);
+
// Returns a JobCallback that will fail with the given network |error|.
static JobCallback ErrorJob(int error);
@@ -71,6 +78,16 @@ class TestRequestInterceptor {
// Returns a JobCallback that will send the contents of |file_path|.
static JobCallback FileJob(const base::FilePath& file_path);
+ // Returns a JobCallback that will handle a "fetch remote command" request.
+ // |server| is a pointer to a TestingRemoteCommandsServer instance to handle
+ // the actual request, and is expected to be valid at the time the job is
+ // serviced. |expected_command_results| is the expected number of previous
+ // command results that will be sent by client. |expected_fetched_commands|
+ // is the expected number of fetched commands by this callback.
+ static JobCallback FetchRemoteCommandsJob(TestingRemoteCommandsServer* server,
+ size_t expected_command_results,
+ size_t expected_fetched_commands);
+
private:
class Delegate;

Powered by Google App Engine
This is Rietveld 408576698