| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/tests/test_url_loader.h" | 5 #include "ppapi/tests/test_url_loader.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 pp::FileRef_Dev body(response_info.GetBodyAsFileRef()); | 214 pp::FileRef_Dev body(response_info.GetBodyAsFileRef()); |
| 215 if (body.is_null()) | 215 if (body.is_null()) |
| 216 return "URLResponseInfo::GetBody returned null"; | 216 return "URLResponseInfo::GetBody returned null"; |
| 217 | 217 |
| 218 rv = loader.FinishStreamingToFile(callback); | 218 rv = loader.FinishStreamingToFile(callback); |
| 219 if (rv == PP_OK_COMPLETIONPENDING) | 219 if (rv == PP_OK_COMPLETIONPENDING) |
| 220 rv = callback.WaitForResult(); | 220 rv = callback.WaitForResult(); |
| 221 if (rv != PP_OK) | 221 if (rv != PP_OK) |
| 222 return ReportError("URLLoader::FinishStreamingToFile", rv); | 222 return ReportError("URLLoader::FinishStreamingToFile", rv); |
| 223 | 223 |
| 224 | |
| 225 pp::FileIO_Dev reader(instance_); | 224 pp::FileIO_Dev reader(instance_); |
| 226 rv = reader.Open(body, PP_FILEOPENFLAG_READ, callback); | 225 rv = reader.Open(body, PP_FILEOPENFLAG_READ, callback); |
| 227 if (rv == PP_OK_COMPLETIONPENDING) | 226 if (rv == PP_OK_COMPLETIONPENDING) |
| 228 rv = callback.WaitForResult(); | 227 rv = callback.WaitForResult(); |
| 229 if (rv != PP_OK) | 228 if (rv != PP_OK) |
| 230 return ReportError("FileIO::Open", rv); | 229 return ReportError("FileIO::Open", rv); |
| 231 | 230 |
| 232 std::string data; | 231 std::string data; |
| 233 std::string error = ReadEntireFile(&reader, &data); | 232 std::string error = ReadEntireFile(&reader, &data); |
| 234 if (!error.empty()) | 233 if (!error.empty()) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 374 |
| 376 // TODO(viettrungluu): More abort tests (but add basic tests first). | 375 // TODO(viettrungluu): More abort tests (but add basic tests first). |
| 377 // Also test that Close() aborts properly. crbug.com/69457 | 376 // Also test that Close() aborts properly. crbug.com/69457 |
| 378 | 377 |
| 379 PASS(); | 378 PASS(); |
| 380 } | 379 } |
| 381 | 380 |
| 382 // TODO(viettrungluu): Add tests for FollowRedirect, | 381 // TODO(viettrungluu): Add tests for FollowRedirect, |
| 383 // Get{Upload,Download}Progress, Close (including abort tests if applicable). | 382 // Get{Upload,Download}Progress, Close (including abort tests if applicable). |
| 384 // TODO(darin): Add a test for GrantUniversalAccess. | 383 // TODO(darin): Add a test for GrantUniversalAccess. |
| OLD | NEW |