OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 GURL test_base_url = test_util::GetBaseUrlForTesting(test_server_.port()); | 93 GURL test_base_url = test_util::GetBaseUrlForTesting(test_server_.port()); |
94 url_generator_.reset(new DriveApiUrlGenerator( | 94 url_generator_.reset(new DriveApiUrlGenerator( |
95 test_base_url, test_base_url.Resolve(kTestDownloadPathPrefix))); | 95 test_base_url, test_base_url.Resolve(kTestDownloadPathPrefix))); |
96 | 96 |
97 // Reset the server's expected behavior just in case. | 97 // Reset the server's expected behavior just in case. |
98 ResetExpectedResponse(); | 98 ResetExpectedResponse(); |
99 received_bytes_ = 0; | 99 received_bytes_ = 0; |
100 content_length_ = 0; | 100 content_length_ = 0; |
101 } | 101 } |
102 | 102 |
103 virtual void TearDown() OVERRIDE { | |
104 EXPECT_TRUE(test_server_.ShutdownAndWaitUntilComplete()); | |
105 request_context_getter_ = NULL; | |
106 ResetExpectedResponse(); | |
107 } | |
108 | |
109 content::TestBrowserThreadBundle thread_bundle_; | 103 content::TestBrowserThreadBundle thread_bundle_; |
110 net::test_server::EmbeddedTestServer test_server_; | 104 net::test_server::EmbeddedTestServer test_server_; |
111 scoped_ptr<TestingProfile> profile_; | 105 scoped_ptr<TestingProfile> profile_; |
112 scoped_ptr<RequestSender> request_sender_; | 106 scoped_ptr<RequestSender> request_sender_; |
113 scoped_ptr<DriveApiUrlGenerator> url_generator_; | 107 scoped_ptr<DriveApiUrlGenerator> url_generator_; |
114 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 108 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
115 base::ScopedTempDir temp_dir_; | 109 base::ScopedTempDir temp_dir_; |
116 | 110 |
117 // This is a path to the file which contains expected response from | 111 // This is a path to the file which contains expected response from |
118 // the server. See also HandleDataFileRequest below. | 112 // the server. See also HandleDataFileRequest below. |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 EXPECT_EQ(HTTP_SUCCESS, result_code); | 1392 EXPECT_EQ(HTTP_SUCCESS, result_code); |
1399 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 1393 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
1400 EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url); | 1394 EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url); |
1401 EXPECT_EQ(kDownloadedFilePath, temp_file); | 1395 EXPECT_EQ(kDownloadedFilePath, temp_file); |
1402 | 1396 |
1403 const std::string expected_contents = kTestId + kTestId + kTestId; | 1397 const std::string expected_contents = kTestId + kTestId + kTestId; |
1404 EXPECT_EQ(expected_contents, contents); | 1398 EXPECT_EQ(expected_contents, contents); |
1405 } | 1399 } |
1406 | 1400 |
1407 } // namespace google_apis | 1401 } // namespace google_apis |
OLD | NEW |