| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 { | 115 { |
| 116 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequest
s(); | 116 Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequest
s(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 std::unique_ptr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOp
tions options = WebURLLoaderOptions()) | 119 std::unique_ptr<WebURLLoader> createAssociatedURLLoader(const WebURLLoaderOp
tions options = WebURLLoaderOptions()) |
| 120 { | 120 { |
| 121 return wrapUnique(mainFrame()->createAssociatedURLLoader(options)); | 121 return wrapUnique(mainFrame()->createAssociatedURLLoader(options)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // WebURLLoaderClient implementation. | 124 // WebURLLoaderClient implementation. |
| 125 void willFollowRedirect(WebURLLoader* loader, WebURLRequest& newRequest, con
st WebURLResponse& redirectResponse) override | 125 void willFollowRedirect(WebURLLoader* loader, WebURLRequest& newRequest, con
st WebURLResponse& redirectResponse, int64_t encodedDataLength) override |
| 126 { | 126 { |
| 127 m_willFollowRedirect = true; | 127 m_willFollowRedirect = true; |
| 128 EXPECT_EQ(m_expectedLoader.get(), loader); | 128 EXPECT_EQ(m_expectedLoader.get(), loader); |
| 129 EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url()); | 129 EXPECT_EQ(m_expectedNewRequest.url(), newRequest.url()); |
| 130 // Check that CORS simple headers are transferred to the new request. | 130 // Check that CORS simple headers are transferred to the new request. |
| 131 EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), newRequest.htt
pHeaderField("accept")); | 131 EXPECT_EQ(m_expectedNewRequest.httpHeaderField("accept"), newRequest.htt
pHeaderField("accept")); |
| 132 EXPECT_EQ(m_expectedRedirectResponse.url(), redirectResponse.url()); | 132 EXPECT_EQ(m_expectedRedirectResponse.url(), redirectResponse.url()); |
| 133 EXPECT_EQ(m_expectedRedirectResponse.httpStatusCode(), redirectResponse.
httpStatusCode()); | 133 EXPECT_EQ(m_expectedRedirectResponse.httpStatusCode(), redirectResponse.
httpStatusCode()); |
| 134 EXPECT_EQ(m_expectedRedirectResponse.mimeType(), redirectResponse.mimeTy
pe()); | 134 EXPECT_EQ(m_expectedRedirectResponse.mimeType(), redirectResponse.mimeTy
pe()); |
| 135 } | 135 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 148 EXPECT_EQ(m_expectedResponse.url(), response.url()); | 148 EXPECT_EQ(m_expectedResponse.url(), response.url()); |
| 149 EXPECT_EQ(m_expectedResponse.httpStatusCode(), response.httpStatusCode()
); | 149 EXPECT_EQ(m_expectedResponse.httpStatusCode(), response.httpStatusCode()
); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void didDownloadData(WebURLLoader* loader, int dataLength, int encodedDataLe
ngth) override | 152 void didDownloadData(WebURLLoader* loader, int dataLength, int encodedDataLe
ngth) override |
| 153 { | 153 { |
| 154 m_didDownloadData = true; | 154 m_didDownloadData = true; |
| 155 EXPECT_EQ(m_expectedLoader.get(), loader); | 155 EXPECT_EQ(m_expectedLoader.get(), loader); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void didReceiveData(WebURLLoader* loader, const char* data, int dataLength,
int encodedDataLength) override | 158 void didReceiveData(WebURLLoader* loader, const char* data, int dataLength,
int encodedDataLength, int encodedBodyLength) override |
| 159 { | 159 { |
| 160 m_didReceiveData = true; | 160 m_didReceiveData = true; |
| 161 EXPECT_EQ(m_expectedLoader.get(), loader); | 161 EXPECT_EQ(m_expectedLoader.get(), loader); |
| 162 EXPECT_TRUE(data); | 162 EXPECT_TRUE(data); |
| 163 EXPECT_GT(dataLength, 0); | 163 EXPECT_GT(dataLength, 0); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void didReceiveCachedMetadata(WebURLLoader* loader, const char* data, int da
taLength) override | 166 void didReceiveCachedMetadata(WebURLLoader* loader, const char* data, int da
taLength) override |
| 167 { | 167 { |
| 168 m_didReceiveCachedMetadata = true; | 168 m_didReceiveCachedMetadata = true; |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 m_expectedLoader->loadAsynchronously(request, this); | 680 m_expectedLoader->loadAsynchronously(request, this); |
| 681 serveRequests(); | 681 serveRequests(); |
| 682 EXPECT_TRUE(m_didReceiveResponse); | 682 EXPECT_TRUE(m_didReceiveResponse); |
| 683 EXPECT_TRUE(m_didReceiveData); | 683 EXPECT_TRUE(m_didReceiveData); |
| 684 EXPECT_TRUE(m_didFinishLoading); | 684 EXPECT_TRUE(m_didFinishLoading); |
| 685 | 685 |
| 686 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); | 686 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); |
| 687 } | 687 } |
| 688 | 688 |
| 689 } // namespace blink | 689 } // namespace blink |
| OLD | NEW |