Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / net / url_request / url_request_test_util.h
index 3e3a114..cad472e 100644 (file)
@@ -25,6 +25,7 @@
 #include "net/base/net_errors.h"
 #include "net/base/network_delegate.h"
 #include "net/base/request_priority.h"
+#include "net/base/sdch_manager.h"
 #include "net/cert/cert_verifier.h"
 #include "net/cookies/cookie_monster.h"
 #include "net/disk_cache/disk_cache.h"
@@ -72,6 +73,10 @@ class TestURLRequestContext : public URLRequestContext {
       const HttpNetworkSession::Params& params) {
   }
 
+  void SetSdchManager(scoped_ptr<SdchManager> sdch_manager) {
+    context_storage_.set_sdch_manager(sdch_manager.Pass());
+  }
+
  private:
   bool initialized_;
 
@@ -117,17 +122,6 @@ class TestURLRequestContextGetter : public URLRequestContextGetter {
 
 //-----------------------------------------------------------------------------
 
-class TestURLRequest : public URLRequest {
- public:
-  TestURLRequest(const GURL& url,
-                 RequestPriority priority,
-                 Delegate* delegate,
-                 TestURLRequestContext* context);
-  virtual ~TestURLRequest();
-};
-
-//-----------------------------------------------------------------------------
-
 class TestDelegate : public URLRequest::Delegate {
  public:
   TestDelegate();
@@ -275,6 +269,10 @@ class TestNetworkDelegate : public NetworkDelegate {
   void set_can_throttle_requests(bool val) { can_throttle_requests_ = val; }
   bool can_throttle_requests() const { return can_throttle_requests_; }
 
+  void set_cancel_request_with_policy_violating_referrer(bool val) {
+    cancel_request_with_policy_violating_referrer_ = val;
+  }
+
   int observed_before_proxy_headers_sent_callbacks() const {
     return observed_before_proxy_headers_sent_callbacks_;
   }
@@ -330,6 +328,10 @@ class TestNetworkDelegate : public NetworkDelegate {
   virtual int OnBeforeSocketStreamConnect(
       SocketStream* stream,
       const CompletionCallback& callback) OVERRIDE;
+  virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
+      const URLRequest& request,
+      const GURL& target_url,
+      const GURL& referrer_url) const OVERRIDE;
 
   void InitRequestStatesIfNew(int request_id);
 
@@ -369,6 +371,7 @@ class TestNetworkDelegate : public NetworkDelegate {
 
   bool can_access_files_;  // true by default
   bool can_throttle_requests_;  // true by default
+  bool cancel_request_with_policy_violating_referrer_;  // false by default
 };
 
 // Overrides the host used by the LocalHttpTestServer in