Chromium Code Reviews| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 WebURLRequest request; | 314 WebURLRequest request; |
| 315 request.initialize(); | 315 request.initialize(); |
| 316 request.setURL(url); | 316 request.setURL(url); |
| 317 CheckFails(request); | 317 CheckFails(request); |
| 318 } | 318 } |
| 319 | 319 |
| 320 // Test a successful cross-origin load. | 320 // Test a successful cross-origin load. |
| 321 TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) | 321 TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) |
| 322 { | 322 { |
| 323 // This is cross-origin since the frame was loaded from www.test.com. | 323 // This is cross-origin since the frame was loaded from www.test.com. |
| 324 KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html"); | 324 KURL url = toKURL("http://www.other.com/CrossOriginSuccess"); |
|
tyoshino (SeeGerritForStatus)
2016/05/16 07:12:42
What's this change for?
horo
2016/05/16 07:23:15
I think it is weird to send the Script context req
| |
| 325 WebURLRequest request; | 325 WebURLRequest request; |
| 326 request.initialize(); | 326 request.initialize(); |
| 327 request.setURL(url); | 327 request.setURL(url); |
| 328 // No-CORS requests (CrossOriginRequestPolicyAllow) aren't allowed for the | |
| 329 // default context requests. So we set the context as Script here. | |
|
tyoshino (SeeGerritForStatus)
2016/05/16 07:12:42
"request" is duplicated.
No-CORS is not allowed f
horo
2016/05/16 07:23:15
Done.
| |
| 330 request.setRequestContext(WebURLRequest::RequestContextScript); | |
| 328 | 331 |
| 329 m_expectedResponse = WebURLResponse(); | 332 m_expectedResponse = WebURLResponse(); |
| 330 m_expectedResponse.initialize(); | 333 m_expectedResponse.initialize(); |
| 331 m_expectedResponse.setMIMEType("text/html"); | 334 m_expectedResponse.setMIMEType("text/html"); |
| 332 m_expectedResponse.setHTTPStatusCode(200); | 335 m_expectedResponse.setHTTPStatusCode(200); |
| 333 Platform::current()->getURLLoaderMockFactory()->registerURL(url, m_expectedR esponse, m_frameFilePath); | 336 Platform::current()->getURLLoaderMockFactory()->registerURL(url, m_expectedR esponse, m_frameFilePath); |
| 334 | 337 |
| 335 WebURLLoaderOptions options; | 338 WebURLLoaderOptions options; |
| 336 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo licyAllow; | 339 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo licyAllow; |
| 337 m_expectedLoader = createAssociatedURLLoader(options); | 340 m_expectedLoader = createAssociatedURLLoader(options); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 m_expectedLoader->loadAsynchronously(request, this); | 712 m_expectedLoader->loadAsynchronously(request, this); |
| 710 serveRequests(); | 713 serveRequests(); |
| 711 EXPECT_TRUE(m_didReceiveResponse); | 714 EXPECT_TRUE(m_didReceiveResponse); |
| 712 EXPECT_TRUE(m_didReceiveData); | 715 EXPECT_TRUE(m_didReceiveData); |
| 713 EXPECT_TRUE(m_didFinishLoading); | 716 EXPECT_TRUE(m_didFinishLoading); |
| 714 | 717 |
| 715 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); | 718 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); |
| 716 } | 719 } |
| 717 | 720 |
| 718 } // namespace blink | 721 } // namespace blink |
| OLD | NEW |