| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 WebCore::KURL url = toKURL(id); | 240 WebCore::KURL url = toKURL(id); |
| 241 WebURLRequest request; | 241 WebURLRequest request; |
| 242 request.initialize(); | 242 request.initialize(); |
| 243 request.setURL(url); | 243 request.setURL(url); |
| 244 | 244 |
| 245 WebString headerNameString(WebString::fromUTF8(headerName)); | 245 WebString headerNameString(WebString::fromUTF8(headerName)); |
| 246 m_expectedResponse = WebURLResponse(); | 246 m_expectedResponse = WebURLResponse(); |
| 247 m_expectedResponse.initialize(); | 247 m_expectedResponse.initialize(); |
| 248 m_expectedResponse.setMIMEType("text/html"); | 248 m_expectedResponse.setMIMEType("text/html"); |
| 249 m_expectedResponse.setHTTPStatusCode(200); |
| 249 m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"
); | 250 m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"
); |
| 250 if (exposed) | 251 if (exposed) |
| 251 m_expectedResponse.addHTTPHeaderField("access-control-expose-headers
", headerNameString); | 252 m_expectedResponse.addHTTPHeaderField("access-control-expose-headers
", headerNameString); |
| 252 m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); | 253 m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); |
| 253 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expecte
dResponse, m_frameFilePath); | 254 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expecte
dResponse, m_frameFilePath); |
| 254 | 255 |
| 255 WebURLLoaderOptions options; | 256 WebURLLoaderOptions options; |
| 256 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginReque
stPolicyUseAccessControl; | 257 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginReque
stPolicyUseAccessControl; |
| 257 m_expectedLoader = createAssociatedURLLoader(options); | 258 m_expectedLoader = createAssociatedURLLoader(options); |
| 258 EXPECT_TRUE(m_expectedLoader); | 259 EXPECT_TRUE(m_expectedLoader); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) | 293 TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) |
| 293 { | 294 { |
| 294 WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html"); | 295 WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html"); |
| 295 WebURLRequest request; | 296 WebURLRequest request; |
| 296 request.initialize(); | 297 request.initialize(); |
| 297 request.setURL(url); | 298 request.setURL(url); |
| 298 | 299 |
| 299 m_expectedResponse = WebURLResponse(); | 300 m_expectedResponse = WebURLResponse(); |
| 300 m_expectedResponse.initialize(); | 301 m_expectedResponse.initialize(); |
| 301 m_expectedResponse.setMIMEType("text/html"); | 302 m_expectedResponse.setMIMEType("text/html"); |
| 303 m_expectedResponse.setHTTPStatusCode(200); |
| 302 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); | 304 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); |
| 303 | 305 |
| 304 m_expectedLoader = createAssociatedURLLoader(); | 306 m_expectedLoader = createAssociatedURLLoader(); |
| 305 EXPECT_TRUE(m_expectedLoader); | 307 EXPECT_TRUE(m_expectedLoader); |
| 306 m_expectedLoader->loadAsynchronously(request, this); | 308 m_expectedLoader->loadAsynchronously(request, this); |
| 307 serveRequests(); | 309 serveRequests(); |
| 308 EXPECT_TRUE(m_didReceiveResponse); | 310 EXPECT_TRUE(m_didReceiveResponse); |
| 309 EXPECT_TRUE(m_didReceiveData); | 311 EXPECT_TRUE(m_didReceiveData); |
| 310 EXPECT_TRUE(m_didFinishLoading); | 312 EXPECT_TRUE(m_didFinishLoading); |
| 311 } | 313 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 326 { | 328 { |
| 327 // This is cross-origin since the frame was loaded from www.test.com. | 329 // This is cross-origin since the frame was loaded from www.test.com. |
| 328 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html"); | 330 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html"); |
| 329 WebURLRequest request; | 331 WebURLRequest request; |
| 330 request.initialize(); | 332 request.initialize(); |
| 331 request.setURL(url); | 333 request.setURL(url); |
| 332 | 334 |
| 333 m_expectedResponse = WebURLResponse(); | 335 m_expectedResponse = WebURLResponse(); |
| 334 m_expectedResponse.initialize(); | 336 m_expectedResponse.initialize(); |
| 335 m_expectedResponse.setMIMEType("text/html"); | 337 m_expectedResponse.setMIMEType("text/html"); |
| 338 m_expectedResponse.setHTTPStatusCode(200); |
| 336 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); | 339 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); |
| 337 | 340 |
| 338 WebURLLoaderOptions options; | 341 WebURLLoaderOptions options; |
| 339 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyAllow; | 342 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyAllow; |
| 340 m_expectedLoader = createAssociatedURLLoader(options); | 343 m_expectedLoader = createAssociatedURLLoader(options); |
| 341 EXPECT_TRUE(m_expectedLoader); | 344 EXPECT_TRUE(m_expectedLoader); |
| 342 m_expectedLoader->loadAsynchronously(request, this); | 345 m_expectedLoader->loadAsynchronously(request, this); |
| 343 serveRequests(); | 346 serveRequests(); |
| 344 EXPECT_TRUE(m_didReceiveResponse); | 347 EXPECT_TRUE(m_didReceiveResponse); |
| 345 EXPECT_TRUE(m_didReceiveData); | 348 EXPECT_TRUE(m_didReceiveData); |
| 346 EXPECT_TRUE(m_didFinishLoading); | 349 EXPECT_TRUE(m_didFinishLoading); |
| 347 } | 350 } |
| 348 | 351 |
| 349 // Test a successful cross-origin load using CORS. | 352 // Test a successful cross-origin load using CORS. |
| 350 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) | 353 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) |
| 351 { | 354 { |
| 352 // This is cross-origin since the frame was loaded from www.test.com. | 355 // This is cross-origin since the frame was loaded from www.test.com. |
| 353 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessContro
lSuccess.html"); | 356 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessContro
lSuccess.html"); |
| 354 WebURLRequest request; | 357 WebURLRequest request; |
| 355 request.initialize(); | 358 request.initialize(); |
| 356 request.setURL(url); | 359 request.setURL(url); |
| 357 | 360 |
| 358 m_expectedResponse = WebURLResponse(); | 361 m_expectedResponse = WebURLResponse(); |
| 359 m_expectedResponse.initialize(); | 362 m_expectedResponse.initialize(); |
| 360 m_expectedResponse.setMIMEType("text/html"); | 363 m_expectedResponse.setMIMEType("text/html"); |
| 364 m_expectedResponse.setHTTPStatusCode(200); |
| 361 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); | 365 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); |
| 362 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); | 366 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); |
| 363 | 367 |
| 364 WebURLLoaderOptions options; | 368 WebURLLoaderOptions options; |
| 365 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; | 369 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; |
| 366 m_expectedLoader = createAssociatedURLLoader(options); | 370 m_expectedLoader = createAssociatedURLLoader(options); |
| 367 EXPECT_TRUE(m_expectedLoader); | 371 EXPECT_TRUE(m_expectedLoader); |
| 368 m_expectedLoader->loadAsynchronously(request, this); | 372 m_expectedLoader->loadAsynchronously(request, this); |
| 369 serveRequests(); | 373 serveRequests(); |
| 370 EXPECT_TRUE(m_didReceiveResponse); | 374 EXPECT_TRUE(m_didReceiveResponse); |
| 371 EXPECT_TRUE(m_didReceiveData); | 375 EXPECT_TRUE(m_didReceiveData); |
| 372 EXPECT_TRUE(m_didFinishLoading); | 376 EXPECT_TRUE(m_didFinishLoading); |
| 373 } | 377 } |
| 374 | 378 |
| 375 // Test an unsuccessful cross-origin load using CORS. | 379 // Test an unsuccessful cross-origin load using CORS. |
| 376 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) | 380 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) |
| 377 { | 381 { |
| 378 // This is cross-origin since the frame was loaded from www.test.com. | 382 // This is cross-origin since the frame was loaded from www.test.com. |
| 379 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessContro
lFailure.html"); | 383 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessContro
lFailure.html"); |
| 380 WebURLRequest request; | 384 WebURLRequest request; |
| 381 request.initialize(); | 385 request.initialize(); |
| 382 request.setURL(url); | 386 request.setURL(url); |
| 383 | 387 |
| 384 m_expectedResponse = WebURLResponse(); | 388 m_expectedResponse = WebURLResponse(); |
| 385 m_expectedResponse.initialize(); | 389 m_expectedResponse.initialize(); |
| 386 m_expectedResponse.setMIMEType("text/html"); | 390 m_expectedResponse.setMIMEType("text/html"); |
| 391 m_expectedResponse.setHTTPStatusCode(200); |
| 387 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); | 392 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); |
| 388 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); | 393 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); |
| 389 | 394 |
| 390 WebURLLoaderOptions options; | 395 WebURLLoaderOptions options; |
| 391 // Send credentials. This will cause the CORS checks to fail, because creden
tials can't be | 396 // Send credentials. This will cause the CORS checks to fail, because creden
tials can't be |
| 392 // sent to a server which returns the header "access-control-allow-origin" w
ith "*" as its value. | 397 // sent to a server which returns the header "access-control-allow-origin" w
ith "*" as its value. |
| 393 options.allowCredentials = true; | 398 options.allowCredentials = true; |
| 394 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; | 399 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; |
| 395 m_expectedLoader = createAssociatedURLLoader(options); | 400 m_expectedLoader = createAssociatedURLLoader(options); |
| 396 EXPECT_TRUE(m_expectedLoader); | 401 EXPECT_TRUE(m_expectedLoader); |
| 397 m_expectedLoader->loadAsynchronously(request, this); | 402 m_expectedLoader->loadAsynchronously(request, this); |
| 398 | 403 |
| 399 // Failure should not be reported synchronously. | 404 // Failure should not be reported synchronously. |
| 400 EXPECT_FALSE(m_didFail); | 405 EXPECT_FALSE(m_didFail); |
| 401 // The loader needs to receive the response, before doing the CORS check. | 406 // The loader needs to receive the response, before doing the CORS check. |
| 402 serveRequests(); | 407 serveRequests(); |
| 403 EXPECT_TRUE(m_didFail); | 408 EXPECT_TRUE(m_didFail); |
| 404 EXPECT_FALSE(m_didReceiveResponse); | 409 EXPECT_FALSE(m_didReceiveResponse); |
| 405 } | 410 } |
| 406 | 411 |
| 412 // Test an unsuccessful cross-origin load using CORS. |
| 413 TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailureBadStatusCode
) |
| 414 { |
| 415 // This is cross-origin since the frame was loaded from www.test.com. |
| 416 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessContro
lFailure.html"); |
| 417 WebURLRequest request; |
| 418 request.initialize(); |
| 419 request.setURL(url); |
| 420 |
| 421 m_expectedResponse = WebURLResponse(); |
| 422 m_expectedResponse.initialize(); |
| 423 m_expectedResponse.setMIMEType("text/html"); |
| 424 m_expectedResponse.setHTTPStatusCode(0); |
| 425 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); |
| 426 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); |
| 427 |
| 428 WebURLLoaderOptions options; |
| 429 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; |
| 430 m_expectedLoader = createAssociatedURLLoader(options); |
| 431 EXPECT_TRUE(m_expectedLoader); |
| 432 m_expectedLoader->loadAsynchronously(request, this); |
| 433 |
| 434 // Failure should not be reported synchronously. |
| 435 EXPECT_FALSE(m_didFail); |
| 436 // The loader needs to receive the response, before doing the CORS check. |
| 437 serveRequests(); |
| 438 EXPECT_TRUE(m_didFail); |
| 439 EXPECT_FALSE(m_didReceiveResponse); |
| 440 } |
| 441 |
| 407 // Test a same-origin URL redirect and load. | 442 // Test a same-origin URL redirect and load. |
| 408 TEST_F(AssociatedURLLoaderTest, RedirectSuccess) | 443 TEST_F(AssociatedURLLoaderTest, RedirectSuccess) |
| 409 { | 444 { |
| 410 WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html"); | 445 WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html"); |
| 411 char redirect[] = "http://www.test.com/RedirectSuccess2.html"; // Same-orig
in | 446 char redirect[] = "http://www.test.com/RedirectSuccess2.html"; // Same-orig
in |
| 412 WebCore::KURL redirectURL = toKURL(redirect); | 447 WebCore::KURL redirectURL = toKURL(redirect); |
| 413 | 448 |
| 414 WebURLRequest request; | 449 WebURLRequest request; |
| 415 request.initialize(); | 450 request.initialize(); |
| 416 request.setURL(url); | 451 request.setURL(url); |
| 417 | 452 |
| 418 m_expectedRedirectResponse = WebURLResponse(); | 453 m_expectedRedirectResponse = WebURLResponse(); |
| 419 m_expectedRedirectResponse.initialize(); | 454 m_expectedRedirectResponse.initialize(); |
| 420 m_expectedRedirectResponse.setMIMEType("text/html"); | 455 m_expectedRedirectResponse.setMIMEType("text/html"); |
| 421 m_expectedRedirectResponse.setHTTPStatusCode(301); | 456 m_expectedRedirectResponse.setHTTPStatusCode(301); |
| 422 m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect); | 457 m_expectedRedirectResponse.setHTTPHeaderField("Location", redirect); |
| 423 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRed
irectResponse, m_frameFilePath); | 458 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRed
irectResponse, m_frameFilePath); |
| 424 | 459 |
| 425 m_expectedNewRequest = WebURLRequest(); | 460 m_expectedNewRequest = WebURLRequest(); |
| 426 m_expectedNewRequest.initialize(); | 461 m_expectedNewRequest.initialize(); |
| 427 m_expectedNewRequest.setURL(redirectURL); | 462 m_expectedNewRequest.setURL(redirectURL); |
| 428 | 463 |
| 429 m_expectedResponse = WebURLResponse(); | 464 m_expectedResponse = WebURLResponse(); |
| 430 m_expectedResponse.initialize(); | 465 m_expectedResponse.initialize(); |
| 431 m_expectedResponse.setMIMEType("text/html"); | 466 m_expectedResponse.setMIMEType("text/html"); |
| 467 m_expectedResponse.setHTTPStatusCode(200); |
| 432 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_exp
ectedResponse, m_frameFilePath); | 468 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_exp
ectedResponse, m_frameFilePath); |
| 433 | 469 |
| 434 m_expectedLoader = createAssociatedURLLoader(); | 470 m_expectedLoader = createAssociatedURLLoader(); |
| 435 EXPECT_TRUE(m_expectedLoader); | 471 EXPECT_TRUE(m_expectedLoader); |
| 436 m_expectedLoader->loadAsynchronously(request, this); | 472 m_expectedLoader->loadAsynchronously(request, this); |
| 437 serveRequests(); | 473 serveRequests(); |
| 438 EXPECT_TRUE(m_willSendRequest); | 474 EXPECT_TRUE(m_willSendRequest); |
| 439 EXPECT_TRUE(m_didReceiveResponse); | 475 EXPECT_TRUE(m_didReceiveResponse); |
| 440 EXPECT_TRUE(m_didReceiveData); | 476 EXPECT_TRUE(m_didReceiveData); |
| 441 EXPECT_TRUE(m_didFinishLoading); | 477 EXPECT_TRUE(m_didFinishLoading); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 m_expectedRedirectResponse.addHTTPHeaderField("access-control-allow-origin",
"*"); | 530 m_expectedRedirectResponse.addHTTPHeaderField("access-control-allow-origin",
"*"); |
| 495 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRed
irectResponse, m_frameFilePath); | 531 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRed
irectResponse, m_frameFilePath); |
| 496 | 532 |
| 497 m_expectedNewRequest = WebURLRequest(); | 533 m_expectedNewRequest = WebURLRequest(); |
| 498 m_expectedNewRequest.initialize(); | 534 m_expectedNewRequest.initialize(); |
| 499 m_expectedNewRequest.setURL(redirectURL); | 535 m_expectedNewRequest.setURL(redirectURL); |
| 500 | 536 |
| 501 m_expectedResponse = WebURLResponse(); | 537 m_expectedResponse = WebURLResponse(); |
| 502 m_expectedResponse.initialize(); | 538 m_expectedResponse.initialize(); |
| 503 m_expectedResponse.setMIMEType("text/html"); | 539 m_expectedResponse.setMIMEType("text/html"); |
| 540 m_expectedResponse.setHTTPStatusCode(200); |
| 504 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); | 541 m_expectedResponse.addHTTPHeaderField("access-control-allow-origin", "*"); |
| 505 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_exp
ectedResponse, m_frameFilePath); | 542 Platform::current()->unitTestSupport()->registerMockedURL(redirectURL, m_exp
ectedResponse, m_frameFilePath); |
| 506 | 543 |
| 507 WebURLLoaderOptions options; | 544 WebURLLoaderOptions options; |
| 508 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; | 545 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; |
| 509 m_expectedLoader = createAssociatedURLLoader(options); | 546 m_expectedLoader = createAssociatedURLLoader(options); |
| 510 EXPECT_TRUE(m_expectedLoader); | 547 EXPECT_TRUE(m_expectedLoader); |
| 511 m_expectedLoader->loadAsynchronously(request, this); | 548 m_expectedLoader->loadAsynchronously(request, this); |
| 512 serveRequests(); | 549 serveRequests(); |
| 513 // We should not receive a notification for the redirect. | 550 // We should not receive a notification for the redirect. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 { | 637 { |
| 601 WebURLRequest request; | 638 WebURLRequest request; |
| 602 request.initialize(); | 639 request.initialize(); |
| 603 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowRespo
nseHeaders.html"); | 640 WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowRespo
nseHeaders.html"); |
| 604 request.setURL(url); | 641 request.setURL(url); |
| 605 | 642 |
| 606 WebString headerNameString(WebString::fromUTF8("non-whitelisted")); | 643 WebString headerNameString(WebString::fromUTF8("non-whitelisted")); |
| 607 m_expectedResponse = WebURLResponse(); | 644 m_expectedResponse = WebURLResponse(); |
| 608 m_expectedResponse.initialize(); | 645 m_expectedResponse.initialize(); |
| 609 m_expectedResponse.setMIMEType("text/html"); | 646 m_expectedResponse.setMIMEType("text/html"); |
| 647 m_expectedResponse.setHTTPStatusCode(200); |
| 610 m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"); | 648 m_expectedResponse.addHTTPHeaderField("Access-Control-Allow-Origin", "*"); |
| 611 m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); | 649 m_expectedResponse.addHTTPHeaderField(headerNameString, "foo"); |
| 612 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); | 650 Platform::current()->unitTestSupport()->registerMockedURL(url, m_expectedRes
ponse, m_frameFilePath); |
| 613 | 651 |
| 614 WebURLLoaderOptions options; | 652 WebURLLoaderOptions options; |
| 615 options.exposeAllResponseHeaders = true; // This turns off response whitelis
ting. | 653 options.exposeAllResponseHeaders = true; // This turns off response whitelis
ting. |
| 616 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; | 654 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo
licyUseAccessControl; |
| 617 m_expectedLoader = createAssociatedURLLoader(options); | 655 m_expectedLoader = createAssociatedURLLoader(options); |
| 618 EXPECT_TRUE(m_expectedLoader); | 656 EXPECT_TRUE(m_expectedLoader); |
| 619 m_expectedLoader->loadAsynchronously(request, this); | 657 m_expectedLoader->loadAsynchronously(request, this); |
| 620 serveRequests(); | 658 serveRequests(); |
| 621 EXPECT_TRUE(m_didReceiveResponse); | 659 EXPECT_TRUE(m_didReceiveResponse); |
| 622 EXPECT_TRUE(m_didReceiveData); | 660 EXPECT_TRUE(m_didReceiveData); |
| 623 EXPECT_TRUE(m_didFinishLoading); | 661 EXPECT_TRUE(m_didFinishLoading); |
| 624 | 662 |
| 625 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); | 663 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); |
| 626 } | 664 } |
| 627 | 665 |
| 628 } | 666 } |
| OLD | NEW |