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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 188 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
189 linked_ptr<UrlIndex> url_index, | 189 linked_ptr<UrlIndex> url_index, |
190 WebLocalFrame* frame, | 190 WebLocalFrame* frame, |
191 BufferedDataSourceHost* host) | 191 BufferedDataSourceHost* host) |
192 : MultibufferDataSource( | 192 : MultibufferDataSource( |
193 url, | 193 url, |
194 cors_mode, | 194 cors_mode, |
195 task_runner, | 195 task_runner, |
196 url_index, | 196 url_index, |
197 frame, | 197 frame, |
198 new media::MediaLog(), | 198 &media_log_, |
199 host, | 199 host, |
200 base::Bind(&MockMultibufferDataSource::set_downloading, | 200 base::Bind(&MockMultibufferDataSource::set_downloading, |
201 base::Unretained(this))), | 201 base::Unretained(this))), |
202 downloading_(false) {} | 202 downloading_(false) {} |
203 | 203 |
204 bool downloading() { return downloading_; } | 204 bool downloading() { return downloading_; } |
205 void set_downloading(bool downloading) { downloading_ = downloading; } | 205 void set_downloading(bool downloading) { downloading_ = downloading; } |
206 bool range_supported() { return url_data_->range_supported(); } | 206 bool range_supported() { return url_data_->range_supported(); } |
207 | 207 |
208 private: | 208 private: |
209 // Whether the resource is downloading or deferred. | 209 // Whether the resource is downloading or deferred. |
210 bool downloading_; | 210 bool downloading_; |
| 211 MediaLog media_log_; |
211 | 212 |
212 DISALLOW_COPY_AND_ASSIGN(MockMultibufferDataSource); | 213 DISALLOW_COPY_AND_ASSIGN(MockMultibufferDataSource); |
213 }; | 214 }; |
214 | 215 |
215 static const int64_t kFileSize = 5000000; | 216 static const int64_t kFileSize = 5000000; |
216 static const int64_t kFarReadPosition = 3997696; | 217 static const int64_t kFarReadPosition = 3997696; |
217 static const int kDataSize = 32 << 10; | 218 static const int kDataSize = 32 << 10; |
218 | 219 |
219 static const char kHttpUrl[] = "http://localhost/foo.webm"; | 220 static const char kHttpUrl[] = "http://localhost/foo.webm"; |
220 static const char kFileUrl[] = "file:///tmp/bar.webm"; | 221 static const char kFileUrl[] = "file:///tmp/bar.webm"; |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 base::Bind(&MultibufferDataSourceTest::ReadCallback, | 1597 base::Bind(&MultibufferDataSourceTest::ReadCallback, |
1597 base::Unretained(this))); | 1598 base::Unretained(this))); |
1598 base::RunLoop().RunUntilIdle(); | 1599 base::RunLoop().RunUntilIdle(); |
1599 | 1600 |
1600 // Make sure we're not downloading anymore. | 1601 // Make sure we're not downloading anymore. |
1601 EXPECT_EQ(data_source_->downloading(), false); | 1602 EXPECT_EQ(data_source_->downloading(), false); |
1602 Stop(); | 1603 Stop(); |
1603 } | 1604 } |
1604 | 1605 |
1605 } // namespace media | 1606 } // namespace media |
OLD | NEW |