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

Unified Diff: chrome/browser/component_updater/test/url_request_post_interceptor.h

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/test/url_request_post_interceptor.h
diff --git a/chrome/browser/component_updater/test/url_request_post_interceptor.h b/chrome/browser/component_updater/test/url_request_post_interceptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..5086deffc4a803b188730d7bb90fe10fb5c69827
--- /dev/null
+++ b/chrome/browser/component_updater/test/url_request_post_interceptor.h
@@ -0,0 +1,72 @@
+
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_
+#define CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_
+
+#include "net/url_request/url_request_job_factory.h"
+#include "net/url_request/url_request_simple_job.h"
+
+namespace net {
+class NetworkDelegate;
+class URLRequest;
+}
+
+class RequestCounter {
+ public:
+ virtual void Trial(net::URLRequest* request) = 0;
+};
+
+class URLRequestPostInterceptor {
+ public:
+ explicit URLRequestPostInterceptor(RequestCounter* counter);
+ virtual ~URLRequestPostInterceptor();
+
+ private:
+ class Delegate;
+
+ // After creation, |delegate_| lives on the IO thread, and a task to delete it
+ // is posted from ~URLRequestPostInterceptor().
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(URLRequestPostInterceptor);
+};
+
+class URLRequestPostInterceptor::Delegate
+ : public net::URLRequestJobFactory::ProtocolHandler {
+ public:
+ explicit Delegate(RequestCounter* counter);
+ virtual ~Delegate() {}
+
+ void Register();
+
+ void Unregister();
+
+ private:
+ RequestCounter* counter_;
+
+ virtual net::URLRequestJob* MaybeCreateJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
+};
+
+class URLRequestPingMockJob : public net::URLRequestSimpleJob {
+ public:
+ URLRequestPingMockJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate);
+
+ protected:
+ virtual int GetData(std::string* mime_type,
+ std::string* charset,
+ std::string* data,
+ const net::CompletionCallback& callback) const OVERRIDE;
+
+ private:
+ virtual ~URLRequestPingMockJob() {}
+
+ DISALLOW_COPY_AND_ASSIGN(URLRequestPingMockJob);
+};
+
+#endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698