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 <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 base::Unretained(this))); | 86 base::Unretained(this))); |
87 | 87 |
88 GURL test_base_url = test_util::GetBaseUrlForTesting(test_server_.port()); | 88 GURL test_base_url = test_util::GetBaseUrlForTesting(test_server_.port()); |
89 url_generator_.reset(new GDataWapiUrlGenerator( | 89 url_generator_.reset(new GDataWapiUrlGenerator( |
90 test_base_url, test_base_url.Resolve(kTestDownloadPathPrefix))); | 90 test_base_url, test_base_url.Resolve(kTestDownloadPathPrefix))); |
91 | 91 |
92 received_bytes_ = 0; | 92 received_bytes_ = 0; |
93 content_length_ = 0; | 93 content_length_ = 0; |
94 } | 94 } |
95 | 95 |
96 virtual void TearDown() OVERRIDE { | |
97 EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); | |
98 request_context_getter_ = NULL; | |
99 } | |
100 | |
101 protected: | 96 protected: |
102 // Handles a request for fetching a resource feed. | 97 // Handles a request for fetching a resource feed. |
103 scoped_ptr<net::test_server::HttpResponse> HandleResourceFeedRequest( | 98 scoped_ptr<net::test_server::HttpResponse> HandleResourceFeedRequest( |
104 const net::test_server::HttpRequest& request) { | 99 const net::test_server::HttpRequest& request) { |
105 http_request_ = request; | 100 http_request_ = request; |
106 | 101 |
107 const GURL absolute_url = test_server_.GetURL(request.relative_url); | 102 const GURL absolute_url = test_server_.GetURL(request.relative_url); |
108 std::string remaining_path; | 103 std::string remaining_path; |
109 if (absolute_url.path() == "/feeds/default/private/full" && | 104 if (absolute_url.path() == "/feeds/default/private/full" && |
110 request.method == net::test_server::METHOD_POST) { | 105 request.method == net::test_server::METHOD_POST) { |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 EXPECT_EQ(HTTP_SUCCESS, result_code); | 1595 EXPECT_EQ(HTTP_SUCCESS, result_code); |
1601 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 1596 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
1602 EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url); | 1597 EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url); |
1603 EXPECT_EQ(kDownloadedFilePath, temp_file); | 1598 EXPECT_EQ(kDownloadedFilePath, temp_file); |
1604 | 1599 |
1605 const std::string expected_contents = kTestId + kTestId + kTestId; | 1600 const std::string expected_contents = kTestId + kTestId + kTestId; |
1606 EXPECT_EQ(expected_contents, contents); | 1601 EXPECT_EQ(expected_contents, contents); |
1607 } | 1602 } |
1608 | 1603 |
1609 } // namespace google_apis | 1604 } // namespace google_apis |
OLD | NEW |