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

Side by Side Diff: ui/ozone/platform/dri/dri_surface_unittest.cc

Issue 794603003: [Ozone] Fix build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_surface.cc ('k') | ui/ozone/platform/test/test_window_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkColor.h" 8 #include "third_party/skia/include/core/SkColor.h"
9 #include "third_party/skia/include/core/SkDevice.h" 9 #include "third_party/skia/include/core/SkDevice.h"
10 #include "ui/ozone/platform/dri/crtc_controller.h" 10 #include "ui/ozone/platform/dri/crtc_controller.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 EXPECT_EQ(3u, drm_->current_framebuffer()); 96 EXPECT_EQ(3u, drm_->current_framebuffer());
97 surface_->PresentCanvas(gfx::Rect()); 97 surface_->PresentCanvas(gfx::Rect());
98 EXPECT_EQ(2u, drm_->current_framebuffer()); 98 EXPECT_EQ(2u, drm_->current_framebuffer());
99 } 99 }
100 100
101 TEST_F(DriSurfaceTest, CheckSurfaceContents) { 101 TEST_F(DriSurfaceTest, CheckSurfaceContents) {
102 SkPaint paint; 102 SkPaint paint;
103 paint.setColor(SK_ColorWHITE); 103 paint.setColor(SK_ColorWHITE);
104 SkRect rect = SkRect::MakeWH(kDefaultMode.hdisplay / 2, 104 SkRect rect = SkRect::MakeWH(kDefaultMode.hdisplay / 2,
105 kDefaultMode.vdisplay / 2); 105 kDefaultMode.vdisplay / 2);
106 surface_->GetCanvas()->drawRect(rect, paint); 106 surface_->GetSurface()->getCanvas()->drawRect(rect, paint);
107 surface_->PresentCanvas( 107 surface_->PresentCanvas(
108 gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2)); 108 gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2));
109 109
110 SkBitmap image; 110 SkBitmap image;
111 // Buffer 0 is the buffer used in SetUp for modesetting and buffer 1 is the 111 // Buffer 0 is the buffer used in SetUp for modesetting and buffer 1 is the
112 // frontbuffer. 112 // frontbuffer.
113 // Buffer 2 is the backbuffer we just painted in, so we want to make sure its 113 // Buffer 2 is the backbuffer we just painted in, so we want to make sure its
114 // contents are correct. 114 // contents are correct.
115 image.setInfo(drm_->buffers()[2]->getCanvas()->imageInfo()); 115 image.setInfo(drm_->buffers()[2]->getCanvas()->imageInfo());
116 EXPECT_TRUE(drm_->buffers()[2]->getCanvas()->readPixels(&image, 0, 0)); 116 EXPECT_TRUE(drm_->buffers()[2]->getCanvas()->readPixels(&image, 0, 0));
117 117
118 EXPECT_EQ(kDefaultMode.hdisplay, image.width()); 118 EXPECT_EQ(kDefaultMode.hdisplay, image.width());
119 EXPECT_EQ(kDefaultMode.vdisplay, image.height()); 119 EXPECT_EQ(kDefaultMode.vdisplay, image.height());
120 120
121 // Make sure the updates are correctly propagated to the native surface. 121 // Make sure the updates are correctly propagated to the native surface.
122 for (int i = 0; i < image.height(); ++i) { 122 for (int i = 0; i < image.height(); ++i) {
123 for (int j = 0; j < image.width(); ++j) { 123 for (int j = 0; j < image.width(); ++j) {
124 if (j < kDefaultMode.hdisplay / 2 && i < kDefaultMode.vdisplay / 2) 124 if (j < kDefaultMode.hdisplay / 2 && i < kDefaultMode.vdisplay / 2)
125 EXPECT_EQ(SK_ColorWHITE, image.getColor(j, i)); 125 EXPECT_EQ(SK_ColorWHITE, image.getColor(j, i));
126 else 126 else
127 EXPECT_EQ(SK_ColorBLACK, image.getColor(j, i)); 127 EXPECT_EQ(SK_ColorBLACK, image.getColor(j, i));
128 } 128 }
129 } 129 }
130 } 130 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/dri_surface.cc ('k') | ui/ozone/platform/test/test_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698