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 "google_apis/drive/base_requests.h" | 5 #include "google_apis/drive/base_requests.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 ASSERT_TRUE(test_server_.Start()); | 49 ASSERT_TRUE(test_server_.Start()); |
50 test_server_.RegisterRequestHandler( | 50 test_server_.RegisterRequestHandler( |
51 base::Bind(&test_util::HandleDownloadFileRequest, | 51 base::Bind(&test_util::HandleDownloadFileRequest, |
52 test_server_.base_url(), | 52 test_server_.base_url(), |
53 base::Unretained(&http_request_))); | 53 base::Unretained(&http_request_))); |
54 } | 54 } |
55 | 55 |
56 // Returns a temporary file path suitable for storing the cache file. | 56 // Returns a temporary file path suitable for storing the cache file. |
57 base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { | 57 base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { |
58 return temp_dir_.path().Append(file_name); | 58 return temp_dir_.GetPath().Append(file_name); |
59 } | 59 } |
60 | 60 |
61 base::MessageLoopForIO message_loop_; // Test server needs IO thread. | 61 base::MessageLoopForIO message_loop_; // Test server needs IO thread. |
62 net::EmbeddedTestServer test_server_; | 62 net::EmbeddedTestServer test_server_; |
63 std::unique_ptr<RequestSender> request_sender_; | 63 std::unique_ptr<RequestSender> request_sender_; |
64 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 64 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
65 base::ScopedTempDir temp_dir_; | 65 base::ScopedTempDir temp_dir_; |
66 | 66 |
67 // The incoming HTTP request is saved so tests can verify the request | 67 // The incoming HTTP request is saved so tests can verify the request |
68 // parameters like HTTP method (ex. some requests should use DELETE | 68 // parameters like HTTP method (ex. some requests should use DELETE |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 run_loop.Run(); | 123 run_loop.Run(); |
124 } | 124 } |
125 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 125 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
126 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 126 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
127 EXPECT_EQ("/files/gdata/no-such-file.txt", | 127 EXPECT_EQ("/files/gdata/no-such-file.txt", |
128 http_request_.relative_url); | 128 http_request_.relative_url); |
129 // Do not verify the not found message. | 129 // Do not verify the not found message. |
130 } | 130 } |
131 | 131 |
132 } // namespace google_apis | 132 } // namespace google_apis |
OLD | NEW |