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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_controller_unittest.cc

Issue 1091253003: [ozone] Keep the queue of surfaceless buffers inside gl_surface_ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests Created 5 years, 8 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 unified diff | Download patch
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/bind.h" 5 #include "base/bind.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 "ui/ozone/platform/drm/gpu/crtc_controller.h" 8 #include "ui/ozone/platform/drm/gpu/crtc_controller.h"
9 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" 9 #include "ui/ozone/platform/drm/gpu/drm_buffer.h"
10 #include "ui/ozone/platform/drm/gpu/drm_device.h" 10 #include "ui/ozone/platform/drm/gpu/drm_device.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 planes, false, 140 planes, false,
141 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, 141 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
142 base::Unretained(this)))); 142 base::Unretained(this))));
143 drm_->RunCallbacks(); 143 drm_->RunCallbacks();
144 planes.clear(); 144 planes.clear();
145 145
146 EXPECT_FALSE(plane1.buffer->HasOneRef()); 146 EXPECT_FALSE(plane1.buffer->HasOneRef());
147 EXPECT_TRUE(plane2.buffer->HasOneRef()); 147 EXPECT_TRUE(plane2.buffer->HasOneRef());
148 } 148 }
149 149
150 TEST_F(HardwareDisplayControllerTest, VerifyNoDRMCallsWhenDisabled) {
151 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>(
152 new MockScanoutBuffer(kDefaultModeSize)));
153
154 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
155 controller_->Disable();
156 ui::OverlayPlane plane2(scoped_refptr<ui::ScanoutBuffer>(
157 new MockScanoutBuffer(kDefaultModeSize)));
158 std::vector<ui::OverlayPlane> planes =
159 std::vector<ui::OverlayPlane>(1, plane2);
160 EXPECT_TRUE(controller_->SchedulePageFlip(
161 planes, false,
162 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
163 base::Unretained(this))));
164 drm_->RunCallbacks();
165 EXPECT_EQ(0, drm_->get_page_flip_call_count());
166
167 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
168 EXPECT_TRUE(controller_->SchedulePageFlip(
169 planes, false,
170 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
171 base::Unretained(this))));
172 drm_->RunCallbacks();
173 EXPECT_EQ(1, drm_->get_page_flip_call_count());
174 }
175
176 TEST_F(HardwareDisplayControllerTest, CheckOverlayPresent) { 150 TEST_F(HardwareDisplayControllerTest, CheckOverlayPresent) {
177 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( 151 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>(
178 new MockScanoutBuffer(kDefaultModeSize))); 152 new MockScanoutBuffer(kDefaultModeSize)));
179 ui::OverlayPlane plane2( 153 ui::OverlayPlane plane2(
180 scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)), 154 scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)),
181 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize), 155 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize),
182 gfx::RectF(kDefaultModeSizeF)); 156 gfx::RectF(kDefaultModeSizeF));
183 157
184 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); 158 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
185 159
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 planes, false, 260 planes, false,
287 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, 261 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
288 base::Unretained(this)))); 262 base::Unretained(this))));
289 263
290 controller_->RemoveCrtc(drm_, kPrimaryCrtc); 264 controller_->RemoveCrtc(drm_, kPrimaryCrtc);
291 265
292 EXPECT_EQ(1, page_flips_); 266 EXPECT_EQ(1, page_flips_);
293 drm_->RunCallbacks(); 267 drm_->RunCallbacks();
294 EXPECT_EQ(1, page_flips_); 268 EXPECT_EQ(1, page_flips_);
295 } 269 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_controller.cc ('k') | ui/ozone/platform/drm/gpu/page_flip_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698