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 // Disable portion of test which failes when the HTTP server's | 90 // Disable portion of test which failes when the HTTP server's |
91 // data_dir is moved to PRODUCT_DIR. | 91 // data_dir is moved to PRODUCT_DIR. |
92 // see: http://code.google.com/p/chromium/issues/detail?id=103690 | 92 // see: http://code.google.com/p/chromium/issues/detail?id=103690 |
93 // RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction); | 93 // RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction, filter); |
94 // RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest); | 94 // RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest, filter); |
95 RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction); | 95 RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction, filter); |
96 RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction); | 96 RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction, filter); |
97 RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction); | 97 RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction, filter); |
98 RUN_TEST_FORCEASYNC_AND_NOT(CustomReferrer); | 98 RUN_TEST_FORCEASYNC_AND_NOT(CustomReferrer, filter); |
99 RUN_TEST_FORCEASYNC_AND_NOT(CustomContentTransferEncoding); | 99 RUN_TEST_FORCEASYNC_AND_NOT(CustomContentTransferEncoding, filter); |
100 RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile); | 100 RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile, filter); |
101 RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect); | 101 RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect, filter); |
102 RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls); | 102 RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter); |
103 RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad); | 103 RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad, filter); |
104 } | 104 } |
105 | 105 |
106 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, | 106 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, |
107 std::string* data) { | 107 std::string* data) { |
108 TestCompletionCallback callback(instance_->pp_instance(), force_async_); | 108 TestCompletionCallback callback(instance_->pp_instance(), force_async_); |
109 char buf[256]; | 109 char buf[256]; |
110 int64_t offset = 0; | 110 int64_t offset = 0; |
111 | 111 |
112 for (;;) { | 112 for (;;) { |
113 int32_t rv = file_io->Read(offset, buf, sizeof(buf), callback); | 113 int32_t rv = file_io->Read(offset, buf, sizeof(buf), callback); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 if (!error.empty()) | 759 if (!error.empty()) |
760 return error; | 760 return error; |
761 if (body != "hello\n") | 761 if (body != "hello\n") |
762 return ReportError("Couldn't read data", rv); | 762 return ReportError("Couldn't read data", rv); |
763 | 763 |
764 PASS(); | 764 PASS(); |
765 } | 765 } |
766 | 766 |
767 // TODO(viettrungluu): Add tests for FollowRedirect, | 767 // TODO(viettrungluu): Add tests for FollowRedirect, |
768 // Get{Upload,Download}Progress, Close (including abort tests if applicable). | 768 // Get{Upload,Download}Progress, Close (including abort tests if applicable). |
OLD | NEW |