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