| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/layers/video_frame_provider.h" | 6 #include "cc/layers/video_frame_provider.h" |
| 7 #include "content/renderer/media/video_frame_compositor.h" | 7 #include "content/renderer/media/video_frame_compositor.h" |
| 8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 int did_receive_frame_count_; | 62 int did_receive_frame_count_; |
| 63 int natural_size_changed_count_; | 63 int natural_size_changed_count_; |
| 64 gfx::Size natural_size_; | 64 gfx::Size natural_size_; |
| 65 int opacity_changed_count_; | 65 int opacity_changed_count_; |
| 66 bool opaque_; | 66 bool opaque_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest); | 68 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 TEST_F(VideoFrameCompositorTest, InitialValues) { | 71 TEST_F(VideoFrameCompositorTest, InitialValues) { |
| 72 EXPECT_FALSE(compositor()->GetCurrentFrame()); | 72 EXPECT_FALSE(compositor()->GetCurrentFrame().get()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(VideoFrameCompositorTest, UpdateCurrentFrame) { | 75 TEST_F(VideoFrameCompositorTest, UpdateCurrentFrame) { |
| 76 scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame(); | 76 scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame(); |
| 77 | 77 |
| 78 // Should notify compositor synchronously. | 78 // Should notify compositor synchronously. |
| 79 EXPECT_EQ(0, did_receive_frame_count()); | 79 EXPECT_EQ(0, did_receive_frame_count()); |
| 80 compositor()->UpdateCurrentFrame(expected); | 80 compositor()->UpdateCurrentFrame(expected); |
| 81 scoped_refptr<VideoFrame> actual = compositor()->GetCurrentFrame(); | 81 scoped_refptr<VideoFrame> actual = compositor()->GetCurrentFrame(); |
| 82 EXPECT_EQ(expected, actual); | 82 EXPECT_EQ(expected, actual); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 EXPECT_TRUE(opaque()); | 153 EXPECT_TRUE(opaque()); |
| 154 EXPECT_EQ(2, opacity_changed_count()); | 154 EXPECT_EQ(2, opacity_changed_count()); |
| 155 | 155 |
| 156 // Callback shouldn't be first subsequent times with same opaqueness. | 156 // Callback shouldn't be first subsequent times with same opaqueness. |
| 157 compositor()->UpdateCurrentFrame(opaque_frame); | 157 compositor()->UpdateCurrentFrame(opaque_frame); |
| 158 EXPECT_TRUE(opaque()); | 158 EXPECT_TRUE(opaque()); |
| 159 EXPECT_EQ(2, opacity_changed_count()); | 159 EXPECT_EQ(2, opacity_changed_count()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace content | 162 } // namespace content |
| OLD | NEW |