Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: ppapi/tests/test_url_loader.cc

Issue 7706021: Convert FileRefImpl and URLRequestInfo to shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_url_loader.h ('k') | ppapi/thunk/enter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void TestURLLoader::RunTest() { 73 void TestURLLoader::RunTest() {
74 RUN_TEST_FORCEASYNC_AND_NOT(BasicGET); 74 RUN_TEST_FORCEASYNC_AND_NOT(BasicGET);
75 RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST); 75 RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST);
76 RUN_TEST_FORCEASYNC_AND_NOT(BasicFilePOST); 76 RUN_TEST_FORCEASYNC_AND_NOT(BasicFilePOST);
77 RUN_TEST_FORCEASYNC_AND_NOT(BasicFileRangePOST); 77 RUN_TEST_FORCEASYNC_AND_NOT(BasicFileRangePOST);
78 RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST); 78 RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST);
79 RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST); 79 RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST);
80 RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST); 80 RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST);
81 RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader); 81 RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader);
82 RUN_TEST_FORCEASYNC_AND_NOT(IgnoresBogusContentLength); 82 RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength);
83 RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction); 83 RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction);
84 RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction); 84 RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction);
85 RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest); 85 RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest);
86 RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile); 86 RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile);
87 RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect); 87 RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect);
88 RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls); 88 RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls);
89 RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad); 89 RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad);
90 } 90 }
91 91
92 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, 92 std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return LoadAndCompareBody(request, postdata); 303 return LoadAndCompareBody(request, postdata);
304 } 304 }
305 305
306 std::string TestURLLoader::TestCustomRequestHeader() { 306 std::string TestURLLoader::TestCustomRequestHeader() {
307 pp::URLRequestInfo request(instance_); 307 pp::URLRequestInfo request(instance_);
308 request.SetURL("/echoheader?Foo"); 308 request.SetURL("/echoheader?Foo");
309 request.SetHeaders("Foo: 1"); 309 request.SetHeaders("Foo: 1");
310 return LoadAndCompareBody(request, "1"); 310 return LoadAndCompareBody(request, "1");
311 } 311 }
312 312
313 std::string TestURLLoader::TestIgnoresBogusContentLength() { 313 std::string TestURLLoader::TestFailsBogusContentLength() {
314 pp::URLRequestInfo request(instance_); 314 pp::URLRequestInfo request(instance_);
315 request.SetURL("/echo"); 315 request.SetURL("/echo");
316 request.SetMethod("POST"); 316 request.SetMethod("POST");
317 request.SetHeaders("Content-Length: 400"); 317 request.SetHeaders("Content-Length: 400");
318 std::string postdata("postdata"); 318 std::string postdata("postdata");
319 request.AppendDataToBody(postdata.data(), postdata.length()); 319 request.AppendDataToBody(postdata.data(), postdata.length());
320 return LoadAndCompareBody(request, postdata); 320
321 TestCompletionCallback callback(instance_->pp_instance(), force_async_);
322 pp::URLLoader loader(*instance_);
323 int32_t rv = loader.Open(request, callback);
brettw 2011/08/22 22:44:28 This test changed because we now report header err
324 if (force_async_ && rv != PP_OK_COMPLETIONPENDING)
325 return ReportError("URLLoader::Open force_async", rv);
326 if (rv == PP_OK_COMPLETIONPENDING)
327 rv = callback.WaitForResult();
328
329 // The bad header should have made the request fail.
330 ASSERT_TRUE(rv == PP_ERROR_FAILED);
331 PASS();
321 } 332 }
322 333
323 std::string TestURLLoader::TestStreamToFile() { 334 std::string TestURLLoader::TestStreamToFile() {
324 pp::URLRequestInfo request(instance_); 335 pp::URLRequestInfo request(instance_);
325 request.SetURL("test_url_loader_data/hello.txt"); 336 request.SetURL("test_url_loader_data/hello.txt");
326 request.SetStreamToFile(true); 337 request.SetStreamToFile(true);
327 338
328 TestCompletionCallback callback(instance_->pp_instance(), force_async_); 339 TestCompletionCallback callback(instance_->pp_instance(), force_async_);
329 340
330 pp::URLLoader loader(*instance_); 341 pp::URLLoader loader(*instance_);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 return error; 612 return error;
602 if (body != "hello\n") 613 if (body != "hello\n")
603 return ReportError("Couldn't read data", rv); 614 return ReportError("Couldn't read data", rv);
604 615
605 PASS(); 616 PASS();
606 } 617 }
607 618
608 // TODO(viettrungluu): Add tests for FollowRedirect, 619 // TODO(viettrungluu): Add tests for FollowRedirect,
609 // Get{Upload,Download}Progress, Close (including abort tests if applicable). 620 // Get{Upload,Download}Progress, Close (including abort tests if applicable).
610 // TODO(darin): Add a test for GrantUniversalAccess. 621 // TODO(darin): Add a test for GrantUniversalAccess.
OLDNEW
« no previous file with comments | « ppapi/tests/test_url_loader.h ('k') | ppapi/thunk/enter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698