Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / net / url_request / url_fetcher_impl_unittest.cc
index 2f1acce..fce7ace 100644 (file)
@@ -11,6 +11,7 @@
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/message_loop/message_loop_proxy.h"
+#include "base/path_service.h"
 #include "base/strings/stringprintf.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/thread.h"
@@ -67,12 +68,10 @@ class ThrottlingTestURLRequestContextGetter
   }
 
   // TestURLRequestContextGetter:
-  virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE {
-    return context_;
-  }
+  TestURLRequestContext* GetURLRequestContext() override { return context_; }
 
  protected:
-  virtual ~ThrottlingTestURLRequestContextGetter() {}
+  ~ThrottlingTestURLRequestContextGetter() override {}
 
   TestURLRequestContext* const context_;
 };
@@ -95,7 +94,7 @@ class URLFetcherTest : public testing::Test,
   // Subclasses that override this should either call this function or
   // CleanupAfterFetchComplete() at the end of their processing, depending on
   // whether they want to check for a non-empty HTTP 200 response or not.
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
   // Deletes |fetcher| and terminates the message loop.
   void CleanupAfterFetchComplete();
@@ -110,7 +109,7 @@ class URLFetcherTest : public testing::Test,
 
  protected:
   // testing::Test:
-  virtual void SetUp() OVERRIDE {
+  void SetUp() override {
     testing::Test::SetUp();
 
     context_.reset(new ThrottlingTestURLRequestContext());
@@ -122,7 +121,7 @@ class URLFetcherTest : public testing::Test,
 #endif
   }
 
-  virtual void TearDown() OVERRIDE {
+  void TearDown() override {
 #if defined(USE_NSS) || defined(OS_IOS)
     ShutdownNSSHttpIO();
 #endif
@@ -143,13 +142,13 @@ class URLFetcherTest : public testing::Test,
 class URLFetcherMockDnsTest : public URLFetcherTest {
  public:
   // testing::Test:
-  virtual void SetUp() OVERRIDE;
+  void SetUp() override;
 
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
  protected:
   GURL test_url_;
@@ -231,10 +230,10 @@ namespace {
 class URLFetcherPostTest : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 };
 
 // Version of URLFetcherTest that does a POST of a file using
@@ -249,10 +248,10 @@ class URLFetcherPostFileTest : public URLFetcherTest {
   }
 
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
  private:
   base::FilePath path_;
@@ -264,10 +263,10 @@ class URLFetcherPostFileTest : public URLFetcherTest {
 class URLFetcherEmptyPostTest : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 };
 
 // Version of URLFetcherTest that tests download progress reports.
@@ -279,12 +278,12 @@ class URLFetcherDownloadProgressTest : public URLFetcherTest {
   }
 
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchDownloadProgress(const URLFetcher* source,
-                                          int64 current,
-                                          int64 total) OVERRIDE;
+  void OnURLFetchDownloadProgress(const URLFetcher* source,
+                                  int64 current,
+                                  int64 total) override;
 
  protected:
   // Download progress returned by the previous callback.
@@ -298,13 +297,14 @@ class URLFetcherDownloadProgressTest : public URLFetcherTest {
 class URLFetcherDownloadProgressCancelTest : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
-  virtual void OnURLFetchDownloadProgress(const URLFetcher* source,
-                                          int64 current,
-                                          int64 total) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
+  void OnURLFetchDownloadProgress(const URLFetcher* source,
+                                  int64 current,
+                                  int64 total) override;
+
  protected:
   bool cancelled_;
 };
@@ -313,12 +313,13 @@ class URLFetcherDownloadProgressCancelTest : public URLFetcherTest {
 class URLFetcherUploadProgressTest : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchUploadProgress(const URLFetcher* source,
-                                        int64 current,
-                                        int64 total) OVERRIDE;
+  void OnURLFetchUploadProgress(const URLFetcher* source,
+                                int64 current,
+                                int64 total) override;
+
  protected:
   int64 previous_progress_;
   std::string chunk_;
@@ -329,14 +330,15 @@ class URLFetcherUploadProgressTest : public URLFetcherTest {
 class URLFetcherHeadersTest : public URLFetcherTest {
  public:
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 };
 
 // Version of URLFetcherTest that tests SocketAddress.
 class URLFetcherSocketAddressTest : public URLFetcherTest {
  public:
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
+
  protected:
   std::string expected_host_;
   uint16 expected_port_;
@@ -346,13 +348,13 @@ class URLFetcherSocketAddressTest : public URLFetcherTest {
 class URLFetcherStopOnRedirectTest : public URLFetcherTest {
  public:
   URLFetcherStopOnRedirectTest();
-  virtual ~URLFetcherStopOnRedirectTest();
+  ~URLFetcherStopOnRedirectTest() override;
 
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
  protected:
   // The URL we should be redirected to.
@@ -365,10 +367,11 @@ class URLFetcherStopOnRedirectTest : public URLFetcherTest {
 class URLFetcherProtectTest : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
+
  private:
   Time start_time_;
 };
@@ -378,10 +381,11 @@ class URLFetcherProtectTest : public URLFetcherTest {
 class URLFetcherProtectTestPassedThrough : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
+
  private:
   Time start_time_;
 };
@@ -392,7 +396,7 @@ class URLFetcherBadHTTPSTest : public URLFetcherTest {
   URLFetcherBadHTTPSTest();
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
  private:
   base::FilePath cert_dir_;
@@ -402,10 +406,10 @@ class URLFetcherBadHTTPSTest : public URLFetcherTest {
 class URLFetcherCancelTest : public URLFetcherTest {
  public:
   // URLFetcherTest:
-  virtual void CreateFetcher(const GURL& url) OVERRIDE;
+  void CreateFetcher(const GURL& url) override;
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
   void CancelRequest();
 };
@@ -418,7 +422,7 @@ class CancelTestURLRequestContext : public ThrottlingTestURLRequestContext {
   }
 
  private:
-  virtual ~CancelTestURLRequestContext() {
+  ~CancelTestURLRequestContext() override {
     // The d'tor should execute in the IO thread. Post the quit task to the
     // current thread.
     base::MessageLoop::current()->PostTask(FROM_HERE,
@@ -439,7 +443,7 @@ class CancelTestURLRequestContextGetter
   }
 
   // TestURLRequestContextGetter:
-  virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE {
+  TestURLRequestContext* GetURLRequestContext() override {
     if (!context_.get()) {
       context_.reset(new CancelTestURLRequestContext());
       DCHECK(context_->throttler_manager());
@@ -474,7 +478,7 @@ class CancelTestURLRequestContextGetter
   }
 
  protected:
-  virtual ~CancelTestURLRequestContextGetter() {}
+  ~CancelTestURLRequestContextGetter() override {}
 
  private:
   scoped_ptr<TestURLRequestContext> context_;
@@ -487,7 +491,8 @@ class CancelTestURLRequestContextGetter
 class URLFetcherMultipleAttemptTest : public URLFetcherTest {
  public:
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
+
  private:
   std::string data_;
 };
@@ -501,7 +506,7 @@ class URLFetcherFileTest : public URLFetcherTest {
   void CreateFetcherForTempFile(const GURL& url);
 
   // URLFetcherDelegate:
-  virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE;
+  void OnURLFetchComplete(const URLFetcher* source) override;
 
  protected:
   base::FilePath expected_file_;