| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "google_apis/drive/base_requests.h" | 5 #include "google_apis/drive/base_requests.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" | 
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" | 
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32                       const GURL& url) | 32                       const GURL& url) | 
| 33       : UrlFetchRequestBase(sender), | 33       : UrlFetchRequestBase(sender), | 
| 34         callback_(callback), | 34         callback_(callback), | 
| 35         url_(url) { | 35         url_(url) { | 
| 36   } | 36   } | 
| 37 | 37 | 
| 38   virtual ~FakeUrlFetchRequest() { | 38   virtual ~FakeUrlFetchRequest() { | 
| 39   } | 39   } | 
| 40 | 40 | 
| 41  protected: | 41  protected: | 
| 42   virtual GURL GetURL() const OVERRIDE { return url_; } | 42   virtual GURL GetURL() const override { return url_; } | 
| 43   virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE { | 43   virtual void ProcessURLFetchResults(const net::URLFetcher* source) override { | 
| 44     callback_.Run(GetErrorCode()); | 44     callback_.Run(GetErrorCode()); | 
| 45   } | 45   } | 
| 46   virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE { | 46   virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) override { | 
| 47     callback_.Run(code); | 47     callback_.Run(code); | 
| 48   } | 48   } | 
| 49 | 49 | 
| 50   EntryActionCallback callback_; | 50   EntryActionCallback callback_; | 
| 51   GURL url_; | 51   GURL url_; | 
| 52 }; | 52 }; | 
| 53 | 53 | 
| 54 }  // namespace | 54 }  // namespace | 
| 55 | 55 | 
| 56 class BaseRequestsTest : public testing::Test { | 56 class BaseRequestsTest : public testing::Test { | 
| 57  public: | 57  public: | 
| 58   BaseRequestsTest() : response_code_(net::HTTP_OK) {} | 58   BaseRequestsTest() : response_code_(net::HTTP_OK) {} | 
| 59 | 59 | 
| 60   virtual void SetUp() OVERRIDE { | 60   virtual void SetUp() override { | 
| 61     request_context_getter_ = new net::TestURLRequestContextGetter( | 61     request_context_getter_ = new net::TestURLRequestContextGetter( | 
| 62         message_loop_.message_loop_proxy()); | 62         message_loop_.message_loop_proxy()); | 
| 63 | 63 | 
| 64     sender_.reset(new RequestSender(new DummyAuthService, | 64     sender_.reset(new RequestSender(new DummyAuthService, | 
| 65                                     request_context_getter_.get(), | 65                                     request_context_getter_.get(), | 
| 66                                     message_loop_.message_loop_proxy(), | 66                                     message_loop_.message_loop_proxy(), | 
| 67                                     std::string() /* custom user agent */)); | 67                                     std::string() /* custom user agent */)); | 
| 68 | 68 | 
| 69     ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); | 69     ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); | 
| 70     test_server_.RegisterRequestHandler( | 70     test_server_.RegisterRequestHandler( | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 130           test_util::CreateQuitCallback( | 130           test_util::CreateQuitCallback( | 
| 131               &run_loop, test_util::CreateCopyResultCallback(&error)), | 131               &run_loop, test_util::CreateCopyResultCallback(&error)), | 
| 132           test_server_.base_url())); | 132           test_server_.base_url())); | 
| 133   run_loop.Run(); | 133   run_loop.Run(); | 
| 134 | 134 | 
| 135   // HTTP_FORBIDDEN (403) is overridden by the error reason. | 135   // HTTP_FORBIDDEN (403) is overridden by the error reason. | 
| 136   EXPECT_EQ(HTTP_SERVICE_UNAVAILABLE, error); | 136   EXPECT_EQ(HTTP_SERVICE_UNAVAILABLE, error); | 
| 137 } | 137 } | 
| 138 | 138 | 
| 139 }  // namespace google_apis | 139 }  // namespace google_apis | 
| OLD | NEW | 
|---|