| 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/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 ProgressCallback(), | 95 ProgressCallback(), |
| 96 test_server_.GetURL("/files/chromeos/gdata/testfile.txt"), | 96 test_server_.GetURL("/files/chromeos/gdata/testfile.txt"), |
| 97 GetTestCachedFilePath( | 97 GetTestCachedFilePath( |
| 98 base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); | 98 base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); |
| 99 request_sender_->StartRequestWithRetry(request); | 99 request_sender_->StartRequestWithRetry(request); |
| 100 run_loop.Run(); | 100 run_loop.Run(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 std::string contents; | 103 std::string contents; |
| 104 file_util::ReadFileToString(temp_file, &contents); | 104 file_util::ReadFileToString(temp_file, &contents); |
| 105 file_util::Delete(temp_file, false); | 105 base::Delete(temp_file, false); |
| 106 | 106 |
| 107 EXPECT_EQ(HTTP_SUCCESS, result_code); | 107 EXPECT_EQ(HTTP_SUCCESS, result_code); |
| 108 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 108 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
| 109 EXPECT_EQ("/files/chromeos/gdata/testfile.txt", http_request_.relative_url); | 109 EXPECT_EQ("/files/chromeos/gdata/testfile.txt", http_request_.relative_url); |
| 110 | 110 |
| 111 const base::FilePath expected_path = | 111 const base::FilePath expected_path = |
| 112 test_util::GetTestFilePath("chromeos/gdata/testfile.txt"); | 112 test_util::GetTestFilePath("chromeos/gdata/testfile.txt"); |
| 113 std::string expected_contents; | 113 std::string expected_contents; |
| 114 file_util::ReadFileToString(expected_path, &expected_contents); | 114 file_util::ReadFileToString(expected_path, &expected_contents); |
| 115 EXPECT_EQ(expected_contents, contents); | 115 EXPECT_EQ(expected_contents, contents); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 134 run_loop.Run(); | 134 run_loop.Run(); |
| 135 } | 135 } |
| 136 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 136 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
| 137 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 137 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
| 138 EXPECT_EQ("/files/chromeos/gdata/no-such-file.txt", | 138 EXPECT_EQ("/files/chromeos/gdata/no-such-file.txt", |
| 139 http_request_.relative_url); | 139 http_request_.relative_url); |
| 140 // Do not verify the not found message. | 140 // Do not verify the not found message. |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace google_apis | 143 } // namespace google_apis |
| OLD | NEW |