| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
| 6 #include "media/base/video_util.h" | 6 #include "media/base/video_util.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
| 9 #include "third_party/skia/include/core/SkDevice.h" | 9 #include "third_party/skia/include/core/SkDevice.h" |
| 10 #include "webkit/media/video_renderer_impl.h" | 10 #include "webkit/media/video_renderer_impl.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 TEST_F(VideoRendererImplTest, SlowPaint_Smaller) { | 160 TEST_F(VideoRendererImplTest, SlowPaint_Smaller) { |
| 161 Paint(natural_frame(), slow_path_canvas(), kRed); | 161 Paint(natural_frame(), slow_path_canvas(), kRed); |
| 162 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); | 162 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); |
| 163 | 163 |
| 164 Paint(smaller_frame(), slow_path_canvas(), kBlue); | 164 Paint(smaller_frame(), slow_path_canvas(), kBlue); |
| 165 EXPECT_EQ(SK_ColorBLUE, GetColor(slow_path_canvas())); | 165 EXPECT_EQ(SK_ColorBLUE, GetColor(slow_path_canvas())); |
| 166 } | 166 } |
| 167 | 167 |
| 168 TEST_F(VideoRendererImplTest, FastPaint_NoTimestamp) { | 168 TEST_F(VideoRendererImplTest, FastPaint_NoTimestamp) { |
| 169 VideoFrame* video_frame = natural_frame(); | 169 VideoFrame* video_frame = natural_frame(); |
| 170 video_frame->SetTimestamp(media::kNoTimestamp); | 170 video_frame->SetTimestamp(media::kNoTimestamp()); |
| 171 Paint(video_frame, fast_path_canvas(), kRed); | 171 Paint(video_frame, fast_path_canvas(), kRed); |
| 172 EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas())); | 172 EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas())); |
| 173 } | 173 } |
| 174 | 174 |
| 175 TEST_F(VideoRendererImplTest, SlowPaint_NoTimestamp) { | 175 TEST_F(VideoRendererImplTest, SlowPaint_NoTimestamp) { |
| 176 VideoFrame* video_frame = natural_frame(); | 176 VideoFrame* video_frame = natural_frame(); |
| 177 video_frame->SetTimestamp(media::kNoTimestamp); | 177 video_frame->SetTimestamp(media::kNoTimestamp()); |
| 178 Paint(video_frame, slow_path_canvas(), kRed); | 178 Paint(video_frame, slow_path_canvas(), kRed); |
| 179 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); | 179 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); |
| 180 } | 180 } |
| 181 | 181 |
| 182 TEST_F(VideoRendererImplTest, FastPaint_SameVideoFrame) { | 182 TEST_F(VideoRendererImplTest, FastPaint_SameVideoFrame) { |
| 183 Paint(natural_frame(), fast_path_canvas(), kRed); | 183 Paint(natural_frame(), fast_path_canvas(), kRed); |
| 184 EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas())); | 184 EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas())); |
| 185 | 185 |
| 186 // Fast paints always get painted to the canvas. | 186 // Fast paints always get painted to the canvas. |
| 187 Paint(natural_frame(), fast_path_canvas(), kBlue); | 187 Paint(natural_frame(), fast_path_canvas(), kBlue); |
| 188 EXPECT_EQ(SK_ColorBLUE, GetColor(fast_path_canvas())); | 188 EXPECT_EQ(SK_ColorBLUE, GetColor(fast_path_canvas())); |
| 189 } | 189 } |
| 190 | 190 |
| 191 TEST_F(VideoRendererImplTest, SlowPaint_SameVideoFrame) { | 191 TEST_F(VideoRendererImplTest, SlowPaint_SameVideoFrame) { |
| 192 Paint(natural_frame(), slow_path_canvas(), kRed); | 192 Paint(natural_frame(), slow_path_canvas(), kRed); |
| 193 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); | 193 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); |
| 194 | 194 |
| 195 // Slow paints can get cached, expect the old color value. | 195 // Slow paints can get cached, expect the old color value. |
| 196 Paint(natural_frame(), slow_path_canvas(), kBlue); | 196 Paint(natural_frame(), slow_path_canvas(), kBlue); |
| 197 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); | 197 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace webkit_media | 200 } // namespace webkit_media |
| OLD | NEW |