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

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

Issue 4182010: Use PASS() everywhere in ppapi/tests. (Closed) Base URL: https://ppapi.googlecode.com/svn/trunk/tests
Patch Set: First. Created 9 years, 11 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_transport.cc ('k') | ppapi/tests/test_url_util.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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> 8 #include <string>
9 9
10 #include "ppapi/c/dev/ppb_file_io_dev.h" 10 #include "ppapi/c/dev/ppb_file_io_dev.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (data.size() != expected_body.size()) 235 if (data.size() != expected_body.size())
236 return "ReadEntireFile returned unexpected content length"; 236 return "ReadEntireFile returned unexpected content length";
237 if (data != expected_body) 237 if (data != expected_body)
238 return "ReadEntireFile returned unexpected content"; 238 return "ReadEntireFile returned unexpected content";
239 239
240 int32_t file_descriptor = file_io_trusted_interface_->GetOSFileDescriptor( 240 int32_t file_descriptor = file_io_trusted_interface_->GetOSFileDescriptor(
241 reader.pp_resource()); 241 reader.pp_resource());
242 if (file_descriptor < 0) 242 if (file_descriptor < 0)
243 return "FileIO::GetOSFileDescriptor() returned a bad file descriptor."; 243 return "FileIO::GetOSFileDescriptor() returned a bad file descriptor.";
244 244
245 return ""; 245 PASS();
246 } 246 }
247 247
248 std::string TestURLLoader::TestSameOriginRestriction() { 248 std::string TestURLLoader::TestSameOriginRestriction() {
249 pp::URLRequestInfo request; 249 pp::URLRequestInfo request;
250 request.SetURL("http://www.google.com/"); 250 request.SetURL("http://www.google.com/");
251 251
252 TestCompletionCallback callback; 252 TestCompletionCallback callback;
253 253
254 pp::URLLoader loader(*instance_); 254 pp::URLLoader loader(*instance_);
255 int32_t rv = loader.Open(request, callback); 255 int32_t rv = loader.Open(request, callback);
256 if (rv == PP_ERROR_WOULDBLOCK) 256 if (rv == PP_ERROR_WOULDBLOCK)
257 rv = callback.WaitForResult(); 257 rv = callback.WaitForResult();
258 258
259 // We expect a failure. 259 // We expect a failure.
260 if (rv != PP_ERROR_NOACCESS) { 260 if (rv != PP_ERROR_NOACCESS) {
261 if (rv == PP_OK) { 261 if (rv == PP_OK) {
262 return "URLLoader::Open() failed to block a cross-origin request."; 262 return "URLLoader::Open() failed to block a cross-origin request.";
263 } else { 263 } else {
264 return ReportError("URLLoader::Open()", rv); 264 return ReportError("URLLoader::Open()", rv);
265 } 265 }
266 } 266 }
267 267
268 return ""; 268 PASS();
269 } 269 }
270 270
271 // This test should cause a redirect and ensure that the loader runs 271 // This test should cause a redirect and ensure that the loader runs
272 // the callback, rather than following the redirect. 272 // the callback, rather than following the redirect.
273 std::string TestURLLoader::TestAuditURLRedirect() { 273 std::string TestURLLoader::TestAuditURLRedirect() {
274 pp::URLRequestInfo request; 274 pp::URLRequestInfo request;
275 // This path will cause the server to return a 301 redirect. 275 // This path will cause the server to return a 301 redirect.
276 request.SetURL("/server-redirect?www.google.com"); 276 request.SetURL("/server-redirect?www.google.com");
277 request.SetFollowRedirects(false); 277 request.SetFollowRedirects(false);
278 278
(...skipping 14 matching lines...) Expand all
293 int32_t status_code = response_info.GetStatusCode(); 293 int32_t status_code = response_info.GetStatusCode();
294 if (status_code != 301) 294 if (status_code != 301)
295 return "Response status should be 301"; 295 return "Response status should be 301";
296 if (response_info.GetRedirectURL().AsString() != "www.google.com") 296 if (response_info.GetRedirectURL().AsString() != "www.google.com")
297 return "Redirect URL should be www.google.com"; 297 return "Redirect URL should be www.google.com";
298 298
299 return ""; 299 return "";
300 } 300 }
301 301
302 // TODO(darin): Add a test for GrantUniversalAccess. 302 // TODO(darin): Add a test for GrantUniversalAccess.
OLDNEW
« no previous file with comments | « ppapi/tests/test_transport.cc ('k') | ppapi/tests/test_url_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698