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

Unified Diff: webkit/media/skcanvas_video_renderer_unittest.cc

Issue 10823012: Fix the errors of ui unittests caused by packing colors for Android (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 5 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
« ui/gfx/image/image_unittest.cc ('K') | « ui/gfx/skbitmap_operations_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/skcanvas_video_renderer_unittest.cc
diff --git a/webkit/media/skcanvas_video_renderer_unittest.cc b/webkit/media/skcanvas_video_renderer_unittest.cc
index f2a1c888e1246ee044f50fedeb6c02a37ff4fe49..b362f112734aa38e80d862ebc8f08cfb7c2fc3b4 100644
--- a/webkit/media/skcanvas_video_renderer_unittest.cc
+++ b/webkit/media/skcanvas_video_renderer_unittest.cc
@@ -109,6 +109,15 @@ void SkCanvasVideoRendererTest::Paint(VideoFrame* video_frame,
renderer_.Paint(video_frame, canvas, kNaturalRect, 0xFF);
}
+inline uint32_t SetPackedColor(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
+ return (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) |
+ (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT);
+}
+
+#define ColorRed SetPackedColor(0xFF, 0xFF, 0x00, 0x00)
+#define ColorGreen SetPackedColor(0xFF, 0x00, 0xFF, 0x00)
+#define ColorBlue SetPackedColor(0xFF, 0x00, 0x00, 0xFF)
+
TEST_F(SkCanvasVideoRendererTest, FastPaint_NoFrame) {
// Test that black gets painted over canvas.
FillCanvas(fast_path_canvas(), SK_ColorRED);
@@ -125,76 +134,76 @@ TEST_F(SkCanvasVideoRendererTest, SlowPaint_NoFrame) {
TEST_F(SkCanvasVideoRendererTest, FastPaint_Natural) {
Paint(natural_frame(), fast_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(fast_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, SlowPaint_Natural) {
Paint(natural_frame(), slow_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(slow_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, FastPaint_Larger) {
Paint(natural_frame(), fast_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(fast_path_canvas()));
Paint(larger_frame(), fast_path_canvas(), kBlue);
- EXPECT_EQ(SK_ColorBLUE, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorBlue, GetColor(fast_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, SlowPaint_Larger) {
Paint(natural_frame(), slow_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(slow_path_canvas()));
Paint(larger_frame(), slow_path_canvas(), kBlue);
- EXPECT_EQ(SK_ColorBLUE, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorBlue, GetColor(slow_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, FastPaint_Smaller) {
Paint(natural_frame(), fast_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(fast_path_canvas()));
Paint(smaller_frame(), fast_path_canvas(), kBlue);
- EXPECT_EQ(SK_ColorBLUE, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorBlue, GetColor(fast_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, SlowPaint_Smaller) {
Paint(natural_frame(), slow_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(slow_path_canvas()));
Paint(smaller_frame(), slow_path_canvas(), kBlue);
- EXPECT_EQ(SK_ColorBLUE, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorBlue, GetColor(slow_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, FastPaint_NoTimestamp) {
VideoFrame* video_frame = natural_frame();
video_frame->SetTimestamp(media::kNoTimestamp());
Paint(video_frame, fast_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(fast_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, SlowPaint_NoTimestamp) {
VideoFrame* video_frame = natural_frame();
video_frame->SetTimestamp(media::kNoTimestamp());
Paint(video_frame, slow_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(slow_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, FastPaint_SameVideoFrame) {
Paint(natural_frame(), fast_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(fast_path_canvas()));
// Fast paints always get painted to the canvas.
Paint(natural_frame(), fast_path_canvas(), kBlue);
- EXPECT_EQ(SK_ColorBLUE, GetColor(fast_path_canvas()));
+ EXPECT_EQ(ColorBlue, GetColor(fast_path_canvas()));
}
TEST_F(SkCanvasVideoRendererTest, SlowPaint_SameVideoFrame) {
Paint(natural_frame(), slow_path_canvas(), kRed);
- EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(slow_path_canvas()));
// Slow paints can get cached, expect the old color value.
Paint(natural_frame(), slow_path_canvas(), kBlue);
- EXPECT_EQ(SK_ColorRED, GetColor(slow_path_canvas()));
+ EXPECT_EQ(ColorRed, GetColor(slow_path_canvas()));
}
} // namespace webkit_media
« ui/gfx/image/image_unittest.cc ('K') | « ui/gfx/skbitmap_operations_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698