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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 instance_->AppendError("FileIOTrusted interface not available"); | 70 instance_->AppendError("FileIOTrusted interface not available"); |
71 } | 71 } |
72 url_loader_trusted_interface_ = static_cast<const PPB_URLLoaderTrusted*>( | 72 url_loader_trusted_interface_ = static_cast<const PPB_URLLoaderTrusted*>( |
73 pp::Module::Get()->GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE)); | 73 pp::Module::Get()->GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE)); |
74 if (!url_loader_trusted_interface_) { | 74 if (!url_loader_trusted_interface_) { |
75 instance_->AppendError("URLLoaderTrusted interface not available"); | 75 instance_->AppendError("URLLoaderTrusted interface not available"); |
76 } | 76 } |
77 return InitTestingInterface() && EnsureRunningOverHTTP(); | 77 return InitTestingInterface() && EnsureRunningOverHTTP(); |
78 } | 78 } |
79 | 79 |
80 void TestURLLoader::RunTest() { | 80 void TestURLLoader::RunTests(const std::string& filter) { |
81 RUN_TEST_FORCEASYNC_AND_NOT(BasicGET); | 81 RUN_TEST_FORCEASYNC_AND_NOT(BasicGET, filter); |
82 RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST); | 82 RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST, filter); |
83 RUN_TEST_FORCEASYNC_AND_NOT(BasicFilePOST); | 83 RUN_TEST_FORCEASYNC_AND_NOT(BasicFilePOST, filter); |
84 RUN_TEST_FORCEASYNC_AND_NOT(BasicFileRangePOST); | 84 RUN_TEST_FORCEASYNC_AND_NOT(BasicFileRangePOST, filter); |
85 RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST); | 85 RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST, filter); |
86 RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST); | 86 RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST, filter); |
87 RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST); | 87 RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST, filter); |
88 RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader); | 88 RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader, filter); |
89 RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength); | 89 RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength, filter); |
90 RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction); | 90 RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction, filter); |
91 RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest); | 91 RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest, filter); |
92 RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction); | 92 RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction, filter); |
93 RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction); | 93 RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction, filter); |
94 RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction); | 94 RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction, filter); |
95 RUN_TEST_FORCEASYNC_AND_NOT(CustomReferrer); | 95 RUN_TEST_FORCEASYNC_AND_NOT(CustomReferrer, filter); |
96 RUN_TEST_FORCEASYNC_AND_NOT(CustomContentTransferEncoding); | 96 RUN_TEST_FORCEASYNC_AND_NOT(CustomContentTransferEncoding, filter); |
97 RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile); | 97 RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile, filter); |
98 RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect); | 98 RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect, filter); |
99 RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls); | 99 RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter); |
100 RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad); | 100 RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad, filter); |
101 } | 101 } |
102 | 102 |
103 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, | 103 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, |
104 std::string* data) { | 104 std::string* data) { |
105 TestCompletionCallback callback(instance_->pp_instance(), force_async_); | 105 TestCompletionCallback callback(instance_->pp_instance(), force_async_); |
106 char buf[256]; | 106 char buf[256]; |
107 int64_t offset = 0; | 107 int64_t offset = 0; |
108 | 108 |
109 for (;;) { | 109 for (;;) { |
110 int32_t rv = file_io->Read(offset, buf, sizeof(buf), callback); | 110 int32_t rv = file_io->Read(offset, buf, sizeof(buf), callback); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 if (!error.empty()) | 756 if (!error.empty()) |
757 return error; | 757 return error; |
758 if (body != "hello\n") | 758 if (body != "hello\n") |
759 return ReportError("Couldn't read data", rv); | 759 return ReportError("Couldn't read data", rv); |
760 | 760 |
761 PASS(); | 761 PASS(); |
762 } | 762 } |
763 | 763 |
764 // TODO(viettrungluu): Add tests for FollowRedirect, | 764 // TODO(viettrungluu): Add tests for FollowRedirect, |
765 // Get{Upload,Download}Progress, Close (including abort tests if applicable). | 765 // Get{Upload,Download}Progress, Close (including abort tests if applicable). |
OLD | NEW |