| 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 "chrome/browser/google_apis/base_requests.h" | 5 #include "chrome/browser/google_apis/base_requests.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 ProgressCallback(), | 87 ProgressCallback(), |
| 88 test_server_.GetURL("/files/gdata/testfile.txt"), | 88 test_server_.GetURL("/files/gdata/testfile.txt"), |
| 89 GetTestCachedFilePath( | 89 GetTestCachedFilePath( |
| 90 base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); | 90 base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); |
| 91 request_sender_->StartRequestWithRetry(request); | 91 request_sender_->StartRequestWithRetry(request); |
| 92 run_loop.Run(); | 92 run_loop.Run(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 std::string contents; | 95 std::string contents; |
| 96 file_util::ReadFileToString(temp_file, &contents); | 96 file_util::ReadFileToString(temp_file, &contents); |
| 97 base::Delete(temp_file, false); | 97 base::DeleteFile(temp_file, false); |
| 98 | 98 |
| 99 EXPECT_EQ(HTTP_SUCCESS, result_code); | 99 EXPECT_EQ(HTTP_SUCCESS, result_code); |
| 100 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 100 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
| 101 EXPECT_EQ("/files/gdata/testfile.txt", http_request_.relative_url); | 101 EXPECT_EQ("/files/gdata/testfile.txt", http_request_.relative_url); |
| 102 | 102 |
| 103 const base::FilePath expected_path = | 103 const base::FilePath expected_path = |
| 104 test_util::GetTestFilePath("gdata/testfile.txt"); | 104 test_util::GetTestFilePath("gdata/testfile.txt"); |
| 105 std::string expected_contents; | 105 std::string expected_contents; |
| 106 file_util::ReadFileToString(expected_path, &expected_contents); | 106 file_util::ReadFileToString(expected_path, &expected_contents); |
| 107 EXPECT_EQ(expected_contents, contents); | 107 EXPECT_EQ(expected_contents, contents); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 126 run_loop.Run(); | 126 run_loop.Run(); |
| 127 } | 127 } |
| 128 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 128 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
| 129 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 129 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
| 130 EXPECT_EQ("/files/gdata/no-such-file.txt", | 130 EXPECT_EQ("/files/gdata/no-such-file.txt", |
| 131 http_request_.relative_url); | 131 http_request_.relative_url); |
| 132 // Do not verify the not found message. | 132 // Do not verify the not found message. |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace google_apis | 135 } // namespace google_apis |
| OLD | NEW |