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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DownloadFileRequestBase* request = new DownloadFileRequestBase( | 77 DownloadFileRequestBase* request = new DownloadFileRequestBase( |
78 request_sender_.get(), | 78 request_sender_.get(), |
79 test_util::CreateQuitCallback( | 79 test_util::CreateQuitCallback( |
80 &run_loop, | 80 &run_loop, |
81 test_util::CreateCopyResultCallback(&result_code, &temp_file)), | 81 test_util::CreateCopyResultCallback(&result_code, &temp_file)), |
82 GetContentCallback(), | 82 GetContentCallback(), |
83 ProgressCallback(), | 83 ProgressCallback(), |
84 test_server_.GetURL("/files/drive/testfile.txt"), | 84 test_server_.GetURL("/files/drive/testfile.txt"), |
85 GetTestCachedFilePath( | 85 GetTestCachedFilePath( |
86 base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); | 86 base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); |
87 request_sender_->StartRequestWithRetry(request); | 87 request_sender_->StartRequestWithAuthRetry(request); |
88 run_loop.Run(); | 88 run_loop.Run(); |
89 } | 89 } |
90 | 90 |
91 std::string contents; | 91 std::string contents; |
92 base::ReadFileToString(temp_file, &contents); | 92 base::ReadFileToString(temp_file, &contents); |
93 base::DeleteFile(temp_file, false); | 93 base::DeleteFile(temp_file, false); |
94 | 94 |
95 EXPECT_EQ(HTTP_SUCCESS, result_code); | 95 EXPECT_EQ(HTTP_SUCCESS, result_code); |
96 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 96 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
97 EXPECT_EQ("/files/drive/testfile.txt", http_request_.relative_url); | 97 EXPECT_EQ("/files/drive/testfile.txt", http_request_.relative_url); |
(...skipping 13 matching lines...) Expand all Loading... |
111 DownloadFileRequestBase* request = new DownloadFileRequestBase( | 111 DownloadFileRequestBase* request = new DownloadFileRequestBase( |
112 request_sender_.get(), | 112 request_sender_.get(), |
113 test_util::CreateQuitCallback( | 113 test_util::CreateQuitCallback( |
114 &run_loop, | 114 &run_loop, |
115 test_util::CreateCopyResultCallback(&result_code, &temp_file)), | 115 test_util::CreateCopyResultCallback(&result_code, &temp_file)), |
116 GetContentCallback(), | 116 GetContentCallback(), |
117 ProgressCallback(), | 117 ProgressCallback(), |
118 test_server_.GetURL("/files/gdata/no-such-file.txt"), | 118 test_server_.GetURL("/files/gdata/no-such-file.txt"), |
119 GetTestCachedFilePath( | 119 GetTestCachedFilePath( |
120 base::FilePath::FromUTF8Unsafe("cache_no-such-file.txt"))); | 120 base::FilePath::FromUTF8Unsafe("cache_no-such-file.txt"))); |
121 request_sender_->StartRequestWithRetry(request); | 121 request_sender_->StartRequestWithAuthRetry(request); |
122 run_loop.Run(); | 122 run_loop.Run(); |
123 } | 123 } |
124 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 124 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
125 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 125 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
126 EXPECT_EQ("/files/gdata/no-such-file.txt", | 126 EXPECT_EQ("/files/gdata/no-such-file.txt", |
127 http_request_.relative_url); | 127 http_request_.relative_url); |
128 // Do not verify the not found message. | 128 // Do not verify the not found message. |
129 } | 129 } |
130 | 130 |
131 } // namespace google_apis | 131 } // namespace google_apis |
OLD | NEW |