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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 request_context_getter_ = new net::TestURLRequestContextGetter( | 41 request_context_getter_ = new net::TestURLRequestContextGetter( |
42 message_loop_.task_runner()); | 42 message_loop_.task_runner()); |
43 | 43 |
44 request_sender_.reset(new RequestSender( | 44 request_sender_.reset(new RequestSender( |
45 new DummyAuthService, | 45 new DummyAuthService, |
46 request_context_getter_.get(), | 46 request_context_getter_.get(), |
47 message_loop_.task_runner(), | 47 message_loop_.task_runner(), |
48 kTestUserAgent)); | 48 kTestUserAgent)); |
49 | 49 |
50 ASSERT_TRUE(test_server_.Start()); | 50 ASSERT_TRUE(test_server_.InitializeAndListen()); |
51 test_server_.RegisterRequestHandler( | 51 test_server_.RegisterRequestHandler( |
52 base::Bind(&test_util::HandleDownloadFileRequest, | 52 base::Bind(&test_util::HandleDownloadFileRequest, |
53 test_server_.base_url(), | 53 test_server_.base_url(), |
54 base::Unretained(&http_request_))); | 54 base::Unretained(&http_request_))); |
| 55 test_server_.StartAcceptingConnections(); |
55 } | 56 } |
56 | 57 |
57 // Returns a temporary file path suitable for storing the cache file. | 58 // Returns a temporary file path suitable for storing the cache file. |
58 base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { | 59 base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { |
59 return temp_dir_.GetPath().Append(file_name); | 60 return temp_dir_.GetPath().Append(file_name); |
60 } | 61 } |
61 | 62 |
62 base::MessageLoopForIO message_loop_; // Test server needs IO thread. | 63 base::MessageLoopForIO message_loop_; // Test server needs IO thread. |
63 net::EmbeddedTestServer test_server_; | 64 net::EmbeddedTestServer test_server_; |
64 std::unique_ptr<RequestSender> request_sender_; | 65 std::unique_ptr<RequestSender> request_sender_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 run_loop.Run(); | 125 run_loop.Run(); |
125 } | 126 } |
126 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 127 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
127 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 128 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
128 EXPECT_EQ("/files/gdata/no-such-file.txt", | 129 EXPECT_EQ("/files/gdata/no-such-file.txt", |
129 http_request_.relative_url); | 130 http_request_.relative_url); |
130 // Do not verify the not found message. | 131 // Do not verify the not found message. |
131 } | 132 } |
132 | 133 |
133 } // namespace google_apis | 134 } // namespace google_apis |
OLD | NEW |