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/skcanvas_video_renderer.h" | 10 #include "webkit/media/skcanvas_video_renderer.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 SkDevice fast_path_device_; | 70 SkDevice fast_path_device_; |
71 SkCanvas fast_path_canvas_; | 71 SkCanvas fast_path_canvas_; |
72 SkDevice slow_path_device_; | 72 SkDevice slow_path_device_; |
73 SkCanvas slow_path_canvas_; | 73 SkCanvas slow_path_canvas_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRendererTest); | 75 DISALLOW_COPY_AND_ASSIGN(SkCanvasVideoRendererTest); |
76 }; | 76 }; |
77 | 77 |
78 SkCanvasVideoRendererTest::SkCanvasVideoRendererTest() | 78 SkCanvasVideoRendererTest::SkCanvasVideoRendererTest() |
79 : natural_frame_(VideoFrame::CreateBlackFrame(kWidth, kHeight)), | 79 : natural_frame_(VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight))), |
80 larger_frame_(VideoFrame::CreateBlackFrame(kWidth * 2, kHeight * 2)), | 80 larger_frame_(VideoFrame::CreateBlackFrame( |
81 smaller_frame_(VideoFrame::CreateBlackFrame(kWidth / 2, kHeight / 2)), | 81 gfx::Size(kWidth * 2, kHeight * 2))), |
| 82 smaller_frame_(VideoFrame::CreateBlackFrame( |
| 83 gfx::Size(kWidth / 2, kHeight / 2))), |
82 fast_path_device_(SkBitmap::kARGB_8888_Config, kWidth, kHeight, true), | 84 fast_path_device_(SkBitmap::kARGB_8888_Config, kWidth, kHeight, true), |
83 fast_path_canvas_(&fast_path_device_), | 85 fast_path_canvas_(&fast_path_device_), |
84 slow_path_device_(SkBitmap::kARGB_8888_Config, kWidth, kHeight, false), | 86 slow_path_device_(SkBitmap::kARGB_8888_Config, kWidth, kHeight, false), |
85 slow_path_canvas_(&slow_path_device_) { | 87 slow_path_canvas_(&slow_path_device_) { |
86 // Give each frame a unique timestamp. | 88 // Give each frame a unique timestamp. |
87 natural_frame_->SetTimestamp(base::TimeDelta::FromMilliseconds(1)); | 89 natural_frame_->SetTimestamp(base::TimeDelta::FromMilliseconds(1)); |
88 larger_frame_->SetTimestamp(base::TimeDelta::FromMilliseconds(2)); | 90 larger_frame_->SetTimestamp(base::TimeDelta::FromMilliseconds(2)); |
89 smaller_frame_->SetTimestamp(base::TimeDelta::FromMilliseconds(3)); | 91 smaller_frame_->SetTimestamp(base::TimeDelta::FromMilliseconds(3)); |
90 } | 92 } |
91 | 93 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 TEST_F(SkCanvasVideoRendererTest, SlowPaint_SameVideoFrame) { | 193 TEST_F(SkCanvasVideoRendererTest, SlowPaint_SameVideoFrame) { |
192 Paint(natural_frame(), slow_path_canvas(), kRed); | 194 Paint(natural_frame(), slow_path_canvas(), kRed); |
193 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); | 195 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); |
194 | 196 |
195 // Slow paints can get cached, expect the old color value. | 197 // Slow paints can get cached, expect the old color value. |
196 Paint(natural_frame(), slow_path_canvas(), kBlue); | 198 Paint(natural_frame(), slow_path_canvas(), kBlue); |
197 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); | 199 EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas())); |
198 } | 200 } |
199 | 201 |
200 } // namespace webkit_media | 202 } // namespace webkit_media |
OLD | NEW |