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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "content/renderer/media/buffered_data_source.h" |
| 8 #include "content/renderer/media/test_response_generator.h" |
7 #include "media/base/media_log.h" | 9 #include "media/base/media_log.h" |
8 #include "media/base/mock_data_source_host.h" | 10 #include "media/base/mock_data_source_host.h" |
9 #include "media/base/mock_filters.h" | 11 #include "media/base/mock_filters.h" |
10 #include "media/base/test_helpers.h" | 12 #include "media/base/test_helpers.h" |
11 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 13 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
12 #include "third_party/WebKit/public/web/WebView.h" | 14 #include "third_party/WebKit/public/web/WebView.h" |
13 #include "webkit/mocks/mock_webframeclient.h" | 15 #include "webkit/mocks/mock_webframeclient.h" |
14 #include "webkit/mocks/mock_weburlloader.h" | 16 #include "webkit/mocks/mock_weburlloader.h" |
15 #include "webkit/renderer/media/buffered_data_source.h" | |
16 #include "webkit/renderer/media/test_response_generator.h" | |
17 | 17 |
18 using ::testing::_; | 18 using ::testing::_; |
19 using ::testing::Assign; | 19 using ::testing::Assign; |
20 using ::testing::Invoke; | 20 using ::testing::Invoke; |
21 using ::testing::InSequence; | 21 using ::testing::InSequence; |
22 using ::testing::NiceMock; | 22 using ::testing::NiceMock; |
23 using ::testing::StrictMock; | 23 using ::testing::StrictMock; |
24 | 24 |
25 using WebKit::WebFrame; | 25 using WebKit::WebFrame; |
26 using WebKit::WebString; | 26 using WebKit::WebString; |
27 using WebKit::WebURLLoader; | 27 using WebKit::WebURLLoader; |
28 using WebKit::WebURLResponse; | 28 using WebKit::WebURLResponse; |
29 using WebKit::WebView; | 29 using WebKit::WebView; |
30 | 30 |
31 using webkit_glue::MockWebFrameClient; | 31 using webkit_glue::MockWebFrameClient; |
32 using webkit_glue::MockWebURLLoader; | 32 using webkit_glue::MockWebURLLoader; |
33 | 33 |
34 namespace webkit_media { | 34 namespace content { |
35 | 35 |
36 // Overrides CreateResourceLoader() to permit injecting a MockWebURLLoader. | 36 // Overrides CreateResourceLoader() to permit injecting a MockWebURLLoader. |
37 // Also keeps track of whether said MockWebURLLoader is actively loading. | 37 // Also keeps track of whether said MockWebURLLoader is actively loading. |
38 class MockBufferedDataSource : public BufferedDataSource { | 38 class MockBufferedDataSource : public BufferedDataSource { |
39 public: | 39 public: |
40 MockBufferedDataSource( | 40 MockBufferedDataSource( |
41 const scoped_refptr<base::MessageLoopProxy>& message_loop, | 41 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
42 WebFrame* frame) | 42 WebFrame* frame) |
43 : BufferedDataSource(message_loop, frame, new media::MediaLog(), | 43 : BufferedDataSource(message_loop, frame, new media::MediaLog(), |
44 base::Bind(&MockBufferedDataSource::set_downloading, | 44 base::Bind(&MockBufferedDataSource::set_downloading, |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 TEST_F(BufferedDataSourceTest, File_FinishLoading) { | 647 TEST_F(BufferedDataSourceTest, File_FinishLoading) { |
648 InitializeWithFileResponse(); | 648 InitializeWithFileResponse(); |
649 | 649 |
650 EXPECT_FALSE(data_source_->downloading()); | 650 EXPECT_FALSE(data_source_->downloading()); |
651 FinishLoading(); | 651 FinishLoading(); |
652 EXPECT_FALSE(data_source_->downloading()); | 652 EXPECT_FALSE(data_source_->downloading()); |
653 | 653 |
654 Stop(); | 654 Stop(); |
655 } | 655 } |
656 | 656 |
657 } // namespace webkit_media | 657 } // namespace content |
OLD | NEW |