OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "media/blink/resource_multibuffer_data_provider.h" | 5 #include "media/blink/resource_multibuffer_data_provider.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/run_loop.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "media/base/media_log.h" | 18 #include "media/base/media_log.h" |
18 #include "media/base/seekable_buffer.h" | 19 #include "media/base/seekable_buffer.h" |
19 #include "media/blink/mock_webframeclient.h" | 20 #include "media/blink/mock_webframeclient.h" |
20 #include "media/blink/mock_weburlloader.h" | 21 #include "media/blink/mock_weburlloader.h" |
21 #include "media/blink/url_index.h" | 22 #include "media/blink/url_index.h" |
22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
23 #include "net/http/http_request_headers.h" | 24 #include "net/http/http_request_headers.h" |
24 #include "net/http/http_util.h" | 25 #include "net/http/http_util.h" |
25 #include "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 GURL redirectUrl(url); | 175 GURL redirectUrl(url); |
175 blink::WebURLRequest newRequest(redirectUrl); | 176 blink::WebURLRequest newRequest(redirectUrl); |
176 blink::WebURLResponse redirectResponse(gurl_); | 177 blink::WebURLResponse redirectResponse(gurl_); |
177 | 178 |
178 EXPECT_CALL(*this, RedirectCallback(_)) | 179 EXPECT_CALL(*this, RedirectCallback(_)) |
179 .WillOnce( | 180 .WillOnce( |
180 Invoke(this, &ResourceMultiBufferDataProviderTest::SetUrlData)); | 181 Invoke(this, &ResourceMultiBufferDataProviderTest::SetUrlData)); |
181 | 182 |
182 loader_->willFollowRedirect(url_loader_, newRequest, redirectResponse); | 183 loader_->willFollowRedirect(url_loader_, newRequest, redirectResponse); |
183 | 184 |
184 base::MessageLoop::current()->RunUntilIdle(); | 185 base::RunLoop().RunUntilIdle(); |
185 } | 186 } |
186 | 187 |
187 void StopWhenLoad() { | 188 void StopWhenLoad() { |
188 InSequence s; | 189 InSequence s; |
189 EXPECT_CALL(*url_loader_, cancel()); | 190 EXPECT_CALL(*url_loader_, cancel()); |
190 loader_ = nullptr; | 191 loader_ = nullptr; |
191 url_data_ = nullptr; | 192 url_data_ = nullptr; |
192 } | 193 } |
193 | 194 |
194 // Helper method to write to |loader_| from |data_|. | 195 // Helper method to write to |loader_| from |data_|. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 TEST_F(ResourceMultiBufferDataProviderTest, TestRedirects) { | 323 TEST_F(ResourceMultiBufferDataProviderTest, TestRedirects) { |
323 // Test redirect. | 324 // Test redirect. |
324 Initialize(kHttpUrl, 0); | 325 Initialize(kHttpUrl, 0); |
325 Start(); | 326 Start(); |
326 Redirect(kHttpRedirect); | 327 Redirect(kHttpRedirect); |
327 FullResponse(1024); | 328 FullResponse(1024); |
328 StopWhenLoad(); | 329 StopWhenLoad(); |
329 } | 330 } |
330 | 331 |
331 } // namespace media | 332 } // namespace media |
OLD | NEW |