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 17 matching lines...) Expand all Loading... |
28 class FakeUrlFetchRequest : public UrlFetchRequestBase { | 28 class FakeUrlFetchRequest : public UrlFetchRequestBase { |
29 public: | 29 public: |
30 FakeUrlFetchRequest(RequestSender* sender, | 30 FakeUrlFetchRequest(RequestSender* sender, |
31 const EntryActionCallback& callback, | 31 const EntryActionCallback& callback, |
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 ~FakeUrlFetchRequest() override {} |
39 } | |
40 | 39 |
41 protected: | 40 protected: |
42 virtual GURL GetURL() const override { return url_; } | 41 GURL GetURL() const override { return url_; } |
43 virtual void ProcessURLFetchResults(const net::URLFetcher* source) override { | 42 void ProcessURLFetchResults(const net::URLFetcher* source) override { |
44 callback_.Run(GetErrorCode()); | 43 callback_.Run(GetErrorCode()); |
45 } | 44 } |
46 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) override { | 45 void RunCallbackOnPrematureFailure(GDataErrorCode code) override { |
47 callback_.Run(code); | 46 callback_.Run(code); |
48 } | 47 } |
49 | 48 |
50 EntryActionCallback callback_; | 49 EntryActionCallback callback_; |
51 GURL url_; | 50 GURL url_; |
52 }; | 51 }; |
53 | 52 |
54 } // namespace | 53 } // namespace |
55 | 54 |
56 class BaseRequestsTest : public testing::Test { | 55 class BaseRequestsTest : public testing::Test { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 test_util::CreateQuitCallback( | 129 test_util::CreateQuitCallback( |
131 &run_loop, test_util::CreateCopyResultCallback(&error)), | 130 &run_loop, test_util::CreateCopyResultCallback(&error)), |
132 test_server_.base_url())); | 131 test_server_.base_url())); |
133 run_loop.Run(); | 132 run_loop.Run(); |
134 | 133 |
135 // HTTP_FORBIDDEN (403) is overridden by the error reason. | 134 // HTTP_FORBIDDEN (403) is overridden by the error reason. |
136 EXPECT_EQ(HTTP_SERVICE_UNAVAILABLE, error); | 135 EXPECT_EQ(HTTP_SERVICE_UNAVAILABLE, error); |
137 } | 136 } |
138 | 137 |
139 } // namespace google_apis | 138 } // namespace google_apis |
OLD | NEW |