Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: media/blink/webmediaplayer_impl_unittest.cc

Issue 2389493002: Revert of Require WebLocalFrame to be created with a non-null client (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "media/base/media_log.h" 21 #include "media/base/media_log.h"
22 #include "media/base/media_switches.h" 22 #include "media/base/media_switches.h"
23 #include "media/base/test_helpers.h" 23 #include "media/base/test_helpers.h"
24 #include "media/blink/mock_webframeclient.h"
24 #include "media/blink/webmediaplayer_delegate.h" 25 #include "media/blink/webmediaplayer_delegate.h"
25 #include "media/blink/webmediaplayer_params.h" 26 #include "media/blink/webmediaplayer_params.h"
26 #include "media/renderers/default_renderer_factory.h" 27 #include "media/renderers/default_renderer_factory.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" 30 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
30 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 31 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
31 #include "third_party/WebKit/public/platform/WebSize.h" 32 #include "third_party/WebKit/public/platform/WebSize.h"
32 #include "third_party/WebKit/public/web/WebFrameClient.h" 33 #include "third_party/WebKit/public/web/WebFrameClient.h"
33 #include "third_party/WebKit/public/web/WebLocalFrame.h" 34 #include "third_party/WebKit/public/web/WebLocalFrame.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ~WebMediaPlayerImplTest() override { 145 ~WebMediaPlayerImplTest() override {
145 // Destruct WebMediaPlayerImpl and pump the message loop to ensure that 146 // Destruct WebMediaPlayerImpl and pump the message loop to ensure that
146 // objects passed to the message loop for destruction are released. 147 // objects passed to the message loop for destruction are released.
147 // 148 //
148 // NOTE: This should be done before any other member variables are 149 // NOTE: This should be done before any other member variables are
149 // destructed since WMPI may reference them during destruction. 150 // destructed since WMPI may reference them during destruction.
150 wmpi_.reset(); 151 wmpi_.reset();
151 base::RunLoop().RunUntilIdle(); 152 base::RunLoop().RunUntilIdle();
152 153
153 web_view_->close(); 154 web_view_->close();
155 web_local_frame_->close();
154 } 156 }
155 157
156 protected: 158 protected:
157 void SetReadyState(blink::WebMediaPlayer::ReadyState state) { 159 void SetReadyState(blink::WebMediaPlayer::ReadyState state) {
158 wmpi_->SetReadyState(state); 160 wmpi_->SetReadyState(state);
159 } 161 }
160 162
161 void SetPaused(bool is_paused) { wmpi_->paused_ = is_paused; } 163 void SetPaused(bool is_paused) { wmpi_->paused_ = is_paused; }
162 void SetSeeking(bool is_seeking) { wmpi_->seeking_ = is_seeking; } 164 void SetSeeking(bool is_seeking) { wmpi_->seeking_ = is_seeking; }
163 void SetEnded(bool is_ended) { wmpi_->ended_ = is_ended; } 165 void SetEnded(bool is_ended) { wmpi_->ended_ = is_ended; }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 236 }
235 237
236 // "Renderer" thread. 238 // "Renderer" thread.
237 base::MessageLoop message_loop_; 239 base::MessageLoop message_loop_;
238 240
239 // "Media" thread. This is necessary because WMPI destruction waits on a 241 // "Media" thread. This is necessary because WMPI destruction waits on a
240 // WaitableEvent. 242 // WaitableEvent.
241 base::Thread media_thread_; 243 base::Thread media_thread_;
242 244
243 // Blink state. 245 // Blink state.
244 blink::WebFrameClient web_frame_client_; 246 MockWebFrameClient web_frame_client_;
245 blink::WebView* web_view_; 247 blink::WebView* web_view_;
246 blink::WebLocalFrame* web_local_frame_; 248 blink::WebLocalFrame* web_local_frame_;
247 249
248 scoped_refptr<MediaLog> media_log_; 250 scoped_refptr<MediaLog> media_log_;
249 linked_ptr<media::UrlIndex> url_index_; 251 linked_ptr<media::UrlIndex> url_index_;
250 252
251 // Audio hardware configuration. 253 // Audio hardware configuration.
252 AudioParameters audio_parameters_; 254 AudioParameters audio_parameters_;
253 255
254 // The client interface used by |wmpi_|. Just a dummy for now, but later we 256 // The client interface used by |wmpi_|. Just a dummy for now, but later we
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 EXPECT_CALL(delegate_, IsPlayingBackgroundVideo()).WillOnce(Return(false)); 649 EXPECT_CALL(delegate_, IsPlayingBackgroundVideo()).WillOnce(Return(false));
648 EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true)); 650 EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true));
649 651
650 state = ComputeBackgroundedPlayState(); 652 state = ComputeBackgroundedPlayState();
651 EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state); 653 EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state);
652 EXPECT_FALSE(state.is_memory_reporting_enabled); 654 EXPECT_FALSE(state.is_memory_reporting_enabled);
653 EXPECT_TRUE(state.is_suspended); 655 EXPECT_TRUE(state.is_suspended);
654 } 656 }
655 657
656 } // namespace media 658 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/resource_multibuffer_data_provider_unittest.cc ('k') | third_party/WebKit/Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698