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

Unified Diff: cc/layers/video_layer_impl_unittest.cc

Issue 1033563002: cc: Various code safety improvements in video compositing code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« cc/layers/video_layer_impl.h ('K') | « cc/layers/video_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/video_layer_impl_unittest.cc
diff --git a/cc/layers/video_layer_impl_unittest.cc b/cc/layers/video_layer_impl_unittest.cc
index 2fde4957c267d1a9a4dee67f982210f81b7e9f71..57ad33a5840e2137cf3f7987776ff44b495735d1 100644
--- a/cc/layers/video_layer_impl_unittest.cc
+++ b/cc/layers/video_layer_impl_unittest.cc
@@ -17,12 +17,22 @@
namespace cc {
namespace {
+// NOTE: We cannot use DebugScopedSetImplThreadAndMainThreadBlocked in these
+// tests because it gets destroyed before the VideoLayerImpl is destroyed. This
+// causes a DCHECK in VideoLayerImpl's destructor to fail.
+static void DebugSetImplThreadAndMainThreadBlocked(Proxy* proxy) {
+#if DCHECK_IS_ON()
+ proxy->SetCurrentThreadIsImplThread(true);
+ proxy->SetMainThreadBlocked(true);
+#endif
+}
+
TEST(VideoLayerImplTest, Occlusion) {
gfx::Size layer_size(1000, 1000);
gfx::Size viewport_size(1000, 1000);
LayerTestCommon::LayerImplTest impl;
- DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
scoped_refptr<media::VideoFrame> video_frame =
media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
@@ -76,7 +86,7 @@ TEST(VideoLayerImplTest, Occlusion) {
TEST(VideoLayerImplTest, DidBecomeActiveShouldSetActiveVideoLayer) {
LayerTestCommon::LayerImplTest impl;
- DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
FakeVideoFrameProvider provider;
VideoLayerImpl* video_layer_impl =
@@ -85,10 +95,10 @@ TEST(VideoLayerImplTest, DidBecomeActiveShouldSetActiveVideoLayer) {
VideoFrameProviderClientImpl* client =
static_cast<VideoFrameProviderClientImpl*>(provider.client());
ASSERT_TRUE(client);
- EXPECT_FALSE(client->active_video_layer());
+ EXPECT_FALSE(client->ActiveVideoLayer());
video_layer_impl->DidBecomeActive();
- EXPECT_EQ(video_layer_impl, client->active_video_layer());
+ EXPECT_EQ(video_layer_impl, client->ActiveVideoLayer());
}
TEST(VideoLayerImplTest, Rotated0) {
@@ -96,7 +106,7 @@ TEST(VideoLayerImplTest, Rotated0) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
scoped_refptr<media::VideoFrame> video_frame =
media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
@@ -132,7 +142,7 @@ TEST(VideoLayerImplTest, Rotated90) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
scoped_refptr<media::VideoFrame> video_frame =
media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
@@ -168,7 +178,7 @@ TEST(VideoLayerImplTest, Rotated180) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
scoped_refptr<media::VideoFrame> video_frame =
media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
@@ -204,7 +214,7 @@ TEST(VideoLayerImplTest, Rotated270) {
gfx::Size viewport_size(1000, 500);
LayerTestCommon::LayerImplTest impl;
- DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
scoped_refptr<media::VideoFrame> video_frame =
media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
« cc/layers/video_layer_impl.h ('K') | « cc/layers/video_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698