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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "google_apis/drive/dummy_auth_service.h" | 12 #include "google_apis/drive/dummy_auth_service.h" |
13 #include "google_apis/drive/request_sender.h" | 13 #include "google_apis/drive/request_sender.h" |
14 #include "google_apis/drive/test_util.h" | 14 #include "google_apis/drive/test_util.h" |
15 #include "net/test/embedded_test_server/embedded_test_server.h" | 15 #include "net/test/embedded_test_server/embedded_test_server.h" |
16 #include "net/test/embedded_test_server/http_request.h" | 16 #include "net/test/embedded_test_server/http_request.h" |
17 #include "net/test/embedded_test_server/http_response.h" | 17 #include "net/test/embedded_test_server/http_response.h" |
18 #include "net/url_request/url_request_test_util.h" | 18 #include "net/url_request/url_request_test_util.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace google_apis { | 21 namespace google_apis { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 const char kValidJsonString[] = "{ \"test\": 123 }"; | 25 const char kValidJsonString[] = "{ \"test\": 123 }"; |
26 const char kInvalidJsonString[] = "$$$"; | 26 const char kInvalidJsonString[] = "$$$"; |
27 | 27 |
28 class FakeUrlFetchRequest : public UrlFetchRequestBase { | 28 class FakeUrlFetchRequest : public UrlFetchRequestBase { |
29 public: | 29 public: |
30 explicit 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 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_; } |
(...skipping 87 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 |