| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" |
| 14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 15 #include "media/base/media_log.h" | 16 #include "media/base/media_log.h" |
| 16 #include "media/base/seekable_buffer.h" | 17 #include "media/base/seekable_buffer.h" |
| 17 #include "media/blink/buffered_resource_loader.h" | 18 #include "media/blink/buffered_resource_loader.h" |
| 18 #include "media/blink/mock_webframeclient.h" | 19 #include "media/blink/mock_webframeclient.h" |
| 19 #include "media/blink/mock_weburlloader.h" | 20 #include "media/blink/mock_weburlloader.h" |
| 20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 21 #include "net/http/http_request_headers.h" | 22 #include "net/http/http_request_headers.h" |
| 22 #include "net/http/http_util.h" | 23 #include "net/http/http_util.h" |
| 23 #include "third_party/WebKit/public/platform/WebString.h" | 24 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 EXPECT_TRUE(loader_->range_supported()); | 197 EXPECT_TRUE(loader_->range_supported()); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void Redirect(const char* url) { | 200 void Redirect(const char* url) { |
| 200 GURL redirectUrl(url); | 201 GURL redirectUrl(url); |
| 201 blink::WebURLRequest newRequest(redirectUrl); | 202 blink::WebURLRequest newRequest(redirectUrl); |
| 202 blink::WebURLResponse redirectResponse(gurl_); | 203 blink::WebURLResponse redirectResponse(gurl_); |
| 203 | 204 |
| 204 loader_->willFollowRedirect(url_loader_, newRequest, redirectResponse); | 205 loader_->willFollowRedirect(url_loader_, newRequest, redirectResponse); |
| 205 | 206 |
| 206 base::MessageLoop::current()->RunUntilIdle(); | 207 base::RunLoop().RunUntilIdle(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 void StopWhenLoad() { | 210 void StopWhenLoad() { |
| 210 InSequence s; | 211 InSequence s; |
| 211 EXPECT_CALL(*url_loader_, cancel()); | 212 EXPECT_CALL(*url_loader_, cancel()); |
| 212 loader_->Stop(); | 213 loader_->Stop(); |
| 213 loader_.reset(); | 214 loader_.reset(); |
| 214 } | 215 } |
| 215 | 216 |
| 216 // Helper method to write to |loader_| from |data_|. | 217 // Helper method to write to |loader_| from |data_|. |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 | 1164 |
| 1164 // As soon as we have received enough data to fulfill the read, defer. | 1165 // As soon as we have received enough data to fulfill the read, defer. |
| 1165 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); | 1166 EXPECT_CALL(*this, LoadingCallback(BufferedResourceLoader::kLoadingDeferred)); |
| 1166 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); | 1167 EXPECT_CALL(*this, ReadCallback(BufferedResourceLoader::kOk, 10)); |
| 1167 WriteLoader(19, 1); | 1168 WriteLoader(19, 1); |
| 1168 VerifyBuffer(buffer, 10, 10); | 1169 VerifyBuffer(buffer, 10, 10); |
| 1169 EXPECT_FALSE(HasActiveLoader()); | 1170 EXPECT_FALSE(HasActiveLoader()); |
| 1170 } | 1171 } |
| 1171 | 1172 |
| 1172 } // namespace media | 1173 } // namespace media |
| OLD | NEW |