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

Unified Diff: components/component_updater/test/url_request_post_interceptor.h

Issue 493953002: Componentize component_updater: Move a bunch of tests to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: components/component_updater/test/url_request_post_interceptor.h
diff --git a/chrome/browser/component_updater/test/url_request_post_interceptor.h b/components/component_updater/test/url_request_post_interceptor.h
similarity index 67%
rename from chrome/browser/component_updater/test/url_request_post_interceptor.h
rename to components/component_updater/test/url_request_post_interceptor.h
index c7b4b2a0c6670434cff56a00d991cf5a8a703787..5699d0768be08f721f272ce13a3b2ca7eab1e39b 100644
--- a/chrome/browser/component_updater/test/url_request_post_interceptor.h
+++ b/components/component_updater/test/url_request_post_interceptor.h
@@ -10,6 +10,7 @@
#include <string>
#include <utility>
#include <vector>
+
#include "base/basictypes.h"
#include "base/synchronization/lock.h"
#include "url/gurl.h"
@@ -24,6 +25,25 @@ class URLRequest;
namespace component_updater {
+// component 1 has extension id "jebgalgnebhfojomionfpkfelancnnkf", and
+// the RSA public key the following hash:
+const uint8 jebg_hash[] = {0x94, 0x16, 0x0b, 0x6d, 0x41, 0x75, 0xe9, 0xec,
+ 0x8e, 0xd5, 0xfa, 0x54, 0xb0, 0xd2, 0xdd, 0xa5,
+ 0x6e, 0x05, 0x6b, 0xe8, 0x73, 0x47, 0xf6, 0xc4,
+ 0x11, 0x9f, 0xbc, 0xb3, 0x09, 0xb3, 0x5b, 0x40};
+// component 2 has extension id "abagagagagagagagagagagagagagagag", and
+// the RSA public key the following hash:
+const uint8 abag_hash[] = {0x01, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x01};
+// component 3 has extension id "ihfokbkgjpifnbbojhneepfflplebdkc", and
+// the RSA public key the following hash:
+const uint8 ihfo_hash[] = {0x87, 0x5e, 0xa1, 0xa6, 0x9f, 0x85, 0xd1, 0x1e,
+ 0x97, 0xd4, 0x4f, 0x55, 0xbf, 0xb4, 0x13, 0xa2,
+ 0xe7, 0xc5, 0xc8, 0xf5, 0x60, 0x19, 0x78, 0x1b,
+ 0x6d, 0xe9, 0x4c, 0xeb, 0x96, 0x05, 0x42, 0x17};
+
// Intercepts requests to a file path, counts them, and captures the body of
// the requests. Optionally, for each request, it can return a canned response
// from a given file. The class maintains a queue of expectations, and returns
@@ -109,6 +129,29 @@ class URLRequestPostInterceptorFactory {
DISALLOW_COPY_AND_ASSIGN(URLRequestPostInterceptorFactory);
};
+// Intercepts HTTP POST requests sent to "localhost2".
+class InterceptorFactory : public URLRequestPostInterceptorFactory {
+ public:
+ InterceptorFactory();
+ ~InterceptorFactory();
+
+ URLRequestPostInterceptor* CreateInterceptor();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InterceptorFactory);
+};
+
+class PartialMatch : public URLRequestPostInterceptor::RequestMatcher {
+ public:
+ explicit PartialMatch(const std::string& expected) : expected_(expected) {}
+ virtual bool Match(const std::string& actual) const OVERRIDE;
+
+ private:
+ const std::string expected_;
+
+ DISALLOW_COPY_AND_ASSIGN(PartialMatch);
+};
+
} // namespace component_updater
#endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_URL_REQUEST_POST_INTERCEPTOR_H_

Powered by Google App Engine
This is Rietveld 408576698