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.h" | 10 #include "base/message_loop.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 114 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
115 EXPECT_EQ("/files/chromeos/gdata/testfile.txt", http_request_.relative_url); | 115 EXPECT_EQ("/files/chromeos/gdata/testfile.txt", http_request_.relative_url); |
116 | 116 |
117 const base::FilePath expected_path = | 117 const base::FilePath expected_path = |
118 test_util::GetTestFilePath("chromeos/gdata/testfile.txt"); | 118 test_util::GetTestFilePath("chromeos/gdata/testfile.txt"); |
119 std::string expected_contents; | 119 std::string expected_contents; |
120 file_util::ReadFileToString(expected_path, &expected_contents); | 120 file_util::ReadFileToString(expected_path, &expected_contents); |
121 EXPECT_EQ(expected_contents, contents); | 121 EXPECT_EQ(expected_contents, contents); |
122 } | 122 } |
123 | 123 |
124 // http://crbug.com/169588 | 124 TEST_F(BaseOperationsServerTest, DownloadFileRequest_NonExistentFile) { |
125 TEST_F(BaseOperationsServerTest, | |
126 DISABLED_DownloadFileRequest_NonExistentFile) { | |
127 GDataErrorCode result_code = GDATA_OTHER_ERROR; | 125 GDataErrorCode result_code = GDATA_OTHER_ERROR; |
128 base::FilePath temp_file; | 126 base::FilePath temp_file; |
129 DownloadFileRequest* operation = new DownloadFileRequest( | 127 DownloadFileRequest* operation = new DownloadFileRequest( |
130 operation_runner_.get(), | 128 operation_runner_.get(), |
131 request_context_getter_.get(), | 129 request_context_getter_.get(), |
132 CreateComposedCallback( | 130 CreateComposedCallback( |
133 base::Bind(&test_util::RunAndQuit), | 131 base::Bind(&test_util::RunAndQuit), |
134 test_util::CreateCopyResultCallback(&result_code, &temp_file)), | 132 test_util::CreateCopyResultCallback(&result_code, &temp_file)), |
135 GetContentCallback(), | 133 GetContentCallback(), |
136 ProgressCallback(), | 134 ProgressCallback(), |
137 test_server_.GetURL("/files/chromeos/gdata/no-such-file.txt"), | 135 test_server_.GetURL("/files/chromeos/gdata/no-such-file.txt"), |
138 base::FilePath::FromUTF8Unsafe("/dummy/gdata/no-such-file.txt"), | 136 base::FilePath::FromUTF8Unsafe("/dummy/gdata/no-such-file.txt"), |
139 GetTestCachedFilePath( | 137 GetTestCachedFilePath( |
140 base::FilePath::FromUTF8Unsafe("cache_no-such-file.txt"))); | 138 base::FilePath::FromUTF8Unsafe("cache_no-such-file.txt"))); |
141 operation_runner_->StartRequestWithRetry(operation); | 139 operation_runner_->StartRequestWithRetry(operation); |
142 base::MessageLoop::current()->Run(); | 140 base::MessageLoop::current()->Run(); |
143 | 141 |
144 std::string contents; | |
145 file_util::ReadFileToString(temp_file, &contents); | |
146 file_util::Delete(temp_file, false); | |
147 | |
148 EXPECT_EQ(HTTP_NOT_FOUND, result_code); | 142 EXPECT_EQ(HTTP_NOT_FOUND, result_code); |
149 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 143 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
150 EXPECT_EQ("/files/chromeos/gdata/no-such-file.txt", | 144 EXPECT_EQ("/files/chromeos/gdata/no-such-file.txt", |
151 http_request_.relative_url); | 145 http_request_.relative_url); |
152 // Do not verify the not found message. | 146 // Do not verify the not found message. |
153 } | 147 } |
154 | 148 |
155 } // namespace google_apis | 149 } // namespace google_apis |
OLD | NEW |