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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 RUN_CALLBACK_TEST(TestURLLoader, StreamToFile, filter); | 135 RUN_CALLBACK_TEST(TestURLLoader, StreamToFile, filter); |
136 RUN_CALLBACK_TEST(TestURLLoader, UntrustedJavascriptURLRestriction, filter); | 136 RUN_CALLBACK_TEST(TestURLLoader, UntrustedJavascriptURLRestriction, filter); |
137 RUN_CALLBACK_TEST(TestURLLoader, TrustedJavascriptURLRestriction, filter); | 137 RUN_CALLBACK_TEST(TestURLLoader, TrustedJavascriptURLRestriction, filter); |
138 RUN_CALLBACK_TEST(TestURLLoader, UntrustedHttpRequests, filter); | 138 RUN_CALLBACK_TEST(TestURLLoader, UntrustedHttpRequests, filter); |
139 RUN_CALLBACK_TEST(TestURLLoader, TrustedHttpRequests, filter); | 139 RUN_CALLBACK_TEST(TestURLLoader, TrustedHttpRequests, filter); |
140 RUN_CALLBACK_TEST(TestURLLoader, FollowURLRedirect, filter); | 140 RUN_CALLBACK_TEST(TestURLLoader, FollowURLRedirect, filter); |
141 RUN_CALLBACK_TEST(TestURLLoader, AuditURLRedirect, filter); | 141 RUN_CALLBACK_TEST(TestURLLoader, AuditURLRedirect, filter); |
142 RUN_CALLBACK_TEST(TestURLLoader, AbortCalls, filter); | 142 RUN_CALLBACK_TEST(TestURLLoader, AbortCalls, filter); |
143 RUN_CALLBACK_TEST(TestURLLoader, UntendedLoad, filter); | 143 RUN_CALLBACK_TEST(TestURLLoader, UntendedLoad, filter); |
144 RUN_CALLBACK_TEST(TestURLLoader, PrefetchBufferThreshold, filter); | 144 RUN_CALLBACK_TEST(TestURLLoader, PrefetchBufferThreshold, filter); |
| 145 RUN_CALLBACK_TEST(TestURLLoader, XRequestedWithHeader, filter); |
145 // These tests connect to localhost with privacy mode enabled: | 146 // These tests connect to localhost with privacy mode enabled: |
146 RUN_CALLBACK_TEST(TestURLLoader, UntrustedSameOriginRestriction, filter); | 147 RUN_CALLBACK_TEST(TestURLLoader, UntrustedSameOriginRestriction, filter); |
147 RUN_CALLBACK_TEST(TestURLLoader, UntrustedCrossOriginRequest, filter); | 148 RUN_CALLBACK_TEST(TestURLLoader, UntrustedCrossOriginRequest, filter); |
148 // These tests connect to localhost with privacy mode disabled: | 149 // These tests connect to localhost with privacy mode disabled: |
149 RUN_CALLBACK_TEST(TestURLLoader, TrustedSameOriginRestriction, filter); | 150 RUN_CALLBACK_TEST(TestURLLoader, TrustedSameOriginRestriction, filter); |
150 RUN_CALLBACK_TEST(TestURLLoader, TrustedCrossOriginRequest, filter); | 151 RUN_CALLBACK_TEST(TestURLLoader, TrustedCrossOriginRequest, filter); |
151 } | 152 } |
152 | 153 |
153 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, | 154 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, |
154 std::string* data) { | 155 std::string* data) { |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 | 854 |
854 rv = OpenWithPrefetchBufferThreshold(1000, 1); | 855 rv = OpenWithPrefetchBufferThreshold(1000, 1); |
855 if (rv != PP_ERROR_FAILED) { | 856 if (rv != PP_ERROR_FAILED) { |
856 return ReportError("The lower buffer value was higher than the upper but " | 857 return ReportError("The lower buffer value was higher than the upper but " |
857 "the URLLoader did not fail.", rv); | 858 "the URLLoader did not fail.", rv); |
858 } | 859 } |
859 | 860 |
860 PASS(); | 861 PASS(); |
861 } | 862 } |
862 | 863 |
| 864 // TODO(viettrungluu): This test properly belongs elsewhere. It tests that |
| 865 // Chrome properly tags URL requests made on behalf of Pepper plugins (with an |
| 866 // X-Requested-With header), but this isn't, strictly speaking, a PPAPI |
| 867 // behavior. |
| 868 std::string TestURLLoader::TestXRequestedWithHeader() { |
| 869 pp::URLRequestInfo request(instance_); |
| 870 request.SetURL("/echoheader?X-Requested-With"); |
| 871 // The name and version of the plugin is set from the command-line (see |
| 872 // chrome/test/ppapi/ppapi_test.cc. |
| 873 return LoadAndCompareBody(request, "PPAPITests/1.2.3"); |
| 874 } |
| 875 |
863 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close | 876 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close |
864 // (including abort tests if applicable). | 877 // (including abort tests if applicable). |
OLD | NEW |