| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 std::string error = ReadEntireFile(&reader, &data); | 449 std::string error = ReadEntireFile(&reader, &data); |
| 450 if (!error.empty()) | 450 if (!error.empty()) |
| 451 return error; | 451 return error; |
| 452 | 452 |
| 453 std::string expected_body = "hello\n"; | 453 std::string expected_body = "hello\n"; |
| 454 if (data.size() != expected_body.size()) | 454 if (data.size() != expected_body.size()) |
| 455 return "ReadEntireFile returned unexpected content length"; | 455 return "ReadEntireFile returned unexpected content length"; |
| 456 if (data != expected_body) | 456 if (data != expected_body) |
| 457 return "ReadEntireFile returned unexpected content"; | 457 return "ReadEntireFile returned unexpected content"; |
| 458 | 458 |
| 459 // FileIOTrusted is not supported by NaCl or ppapi/proxy. | |
| 460 if (!testing_interface_->IsOutOfProcess()) { | |
| 461 #if !(defined __native_client__) | |
| 462 int32_t file_descriptor = file_io_trusted_interface_->GetOSFileDescriptor( | |
| 463 reader.pp_resource()); | |
| 464 if (file_descriptor < 0) | |
| 465 return "FileIO::GetOSFileDescriptor() returned a bad file descriptor."; | |
| 466 #endif | |
| 467 } | |
| 468 PASS(); | 459 PASS(); |
| 469 } | 460 } |
| 470 | 461 |
| 471 // Untrusted, unintended cross-origin requests should fail. | 462 // Untrusted, unintended cross-origin requests should fail. |
| 472 std::string TestURLLoader::TestUntrustedSameOriginRestriction() { | 463 std::string TestURLLoader::TestUntrustedSameOriginRestriction() { |
| 473 pp::URLRequestInfo request(instance_); | 464 pp::URLRequestInfo request(instance_); |
| 474 std::string cross_origin_url = GetReachableCrossOriginURL("test_case.html"); | 465 std::string cross_origin_url = GetReachableCrossOriginURL("test_case.html"); |
| 475 request.SetURL(cross_origin_url); | 466 request.SetURL(cross_origin_url); |
| 476 | 467 |
| 477 int32_t rv = OpenUntrusted(request); | 468 int32_t rv = OpenUntrusted(request); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 if (rv != PP_ERROR_FAILED) { | 827 if (rv != PP_ERROR_FAILED) { |
| 837 return ReportError("The lower buffer value was higher than the upper but " | 828 return ReportError("The lower buffer value was higher than the upper but " |
| 838 "the URLLoader did not fail.", rv); | 829 "the URLLoader did not fail.", rv); |
| 839 } | 830 } |
| 840 | 831 |
| 841 PASS(); | 832 PASS(); |
| 842 } | 833 } |
| 843 | 834 |
| 844 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close | 835 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close |
| 845 // (including abort tests if applicable). | 836 // (including abort tests if applicable). |
| OLD | NEW |