| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "media/base/audio_hardware_config.h" | 15 #include "media/base/audio_hardware_config.h" |
| 16 #include "media/base/media_log.h" | 16 #include "media/base/media_log.h" |
| 17 #include "media/base/test_helpers.h" | 17 #include "media/base/test_helpers.h" |
| 18 #include "media/blink/mock_webframeclient.h" |
| 18 #include "media/blink/webmediaplayer_delegate.h" | 19 #include "media/blink/webmediaplayer_delegate.h" |
| 19 #include "media/blink/webmediaplayer_impl.h" | 20 #include "media/blink/webmediaplayer_impl.h" |
| 20 #include "media/blink/webmediaplayer_params.h" | 21 #include "media/blink/webmediaplayer_params.h" |
| 21 #include "media/renderers/default_renderer_factory.h" | 22 #include "media/renderers/default_renderer_factory.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 25 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 25 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 26 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 26 #include "third_party/WebKit/public/web/WebFrameClient.h" | 27 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 27 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 28 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 28 #include "third_party/WebKit/public/web/WebView.h" | 29 #include "third_party/WebKit/public/web/WebView.h" |
| 29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 30 | 31 |
| 31 namespace media { | 32 namespace media { |
| 32 | 33 |
| 33 int64_t OnAdjustAllocatedMemory(int64_t delta) { | 34 int64_t OnAdjustAllocatedMemory(int64_t delta) { |
| 34 return 0; | 35 return 0; |
| 35 } | 36 } |
| 36 | 37 |
| 37 // Dummy superclass necessary since blink::WebFrameClient() has a protected | |
| 38 // destructor. | |
| 39 class DummyWebFrameClient : public blink::WebFrameClient {}; | |
| 40 | |
| 41 class DummyWebMediaPlayerClient : public blink::WebMediaPlayerClient { | 38 class DummyWebMediaPlayerClient : public blink::WebMediaPlayerClient { |
| 42 public: | 39 public: |
| 43 DummyWebMediaPlayerClient() {} | 40 DummyWebMediaPlayerClient() {} |
| 44 | 41 |
| 45 // blink::WebMediaPlayerClient implementation. | 42 // blink::WebMediaPlayerClient implementation. |
| 46 void networkStateChanged() override {} | 43 void networkStateChanged() override {} |
| 47 void readyStateChanged() override {} | 44 void readyStateChanged() override {} |
| 48 void timeChanged() override {} | 45 void timeChanged() override {} |
| 49 void repaint() override {} | 46 void repaint() override {} |
| 50 void durationChanged() override {} | 47 void durationChanged() override {} |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 123 |
| 127 protected: | 124 protected: |
| 128 // "Renderer" thread. | 125 // "Renderer" thread. |
| 129 base::MessageLoop message_loop_; | 126 base::MessageLoop message_loop_; |
| 130 | 127 |
| 131 // "Media" thread. This is necessary because WMPI destruction waits on a | 128 // "Media" thread. This is necessary because WMPI destruction waits on a |
| 132 // WaitableEvent. | 129 // WaitableEvent. |
| 133 base::Thread media_thread_; | 130 base::Thread media_thread_; |
| 134 | 131 |
| 135 // Blink state. | 132 // Blink state. |
| 136 DummyWebFrameClient web_frame_client_; | 133 MockWebFrameClient web_frame_client_; |
| 137 blink::WebView* web_view_; | 134 blink::WebView* web_view_; |
| 138 blink::WebLocalFrame* web_local_frame_; | 135 blink::WebLocalFrame* web_local_frame_; |
| 139 | 136 |
| 140 scoped_refptr<MediaLog> media_log_; | 137 scoped_refptr<MediaLog> media_log_; |
| 141 linked_ptr<media::UrlIndex> url_index_; | 138 linked_ptr<media::UrlIndex> url_index_; |
| 142 | 139 |
| 143 // Audio hardware configuration. | 140 // Audio hardware configuration. |
| 144 AudioParameters audio_parameters_; | 141 AudioParameters audio_parameters_; |
| 145 AudioHardwareConfig audio_hardware_config_; | 142 AudioHardwareConfig audio_hardware_config_; |
| 146 | 143 |
| 147 // The client interface used by |wmpi_|. Just a dummy for now, but later we | 144 // The client interface used by |wmpi_|. Just a dummy for now, but later we |
| 148 // may want a mock or intelligent fake. | 145 // may want a mock or intelligent fake. |
| 149 DummyWebMediaPlayerClient client_; | 146 DummyWebMediaPlayerClient client_; |
| 150 | 147 |
| 151 // The WebMediaPlayerImpl instance under test. | 148 // The WebMediaPlayerImpl instance under test. |
| 152 scoped_ptr<WebMediaPlayerImpl> wmpi_; | 149 scoped_ptr<WebMediaPlayerImpl> wmpi_; |
| 153 | 150 |
| 154 private: | 151 private: |
| 155 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImplTest); | 152 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImplTest); |
| 156 }; | 153 }; |
| 157 | 154 |
| 158 TEST_F(WebMediaPlayerImplTest, ConstructAndDestroy) {} | 155 TEST_F(WebMediaPlayerImplTest, ConstructAndDestroy) {} |
| 159 | 156 |
| 160 } // namespace media | 157 } // namespace media |
| OLD | NEW |