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

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

Issue 1417423002: [Ozone-DRM] Fix double call of swap buffers callback on failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 years, 2 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
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_controller.cc ('k') | no next file » | 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 <drm_fourcc.h> 5 #include <drm_fourcc.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" 10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 EXPECT_TRUE(controller_->SchedulePageFlip( 374 EXPECT_TRUE(controller_->SchedulePageFlip(
375 planes, false /* test_only */, 375 planes, false /* test_only */,
376 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, 376 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
377 base::Unretained(this)))); 377 base::Unretained(this))));
378 378
379 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); 379 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
380 drm_->RunCallbacks(); 380 drm_->RunCallbacks();
381 EXPECT_EQ(1, page_flips_); 381 EXPECT_EQ(1, page_flips_);
382 } 382 }
383 383
384 TEST_F(HardwareDisplayControllerTest, FailPageFlipping) {
385 drm_->set_page_flip_expectation(false);
386
387 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>(
388 new MockScanoutBuffer(kDefaultModeSize)));
389 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
390 std::vector<ui::OverlayPlane> planes =
391 std::vector<ui::OverlayPlane>(1, plane1);
392 EXPECT_FALSE(controller_->SchedulePageFlip(
393 planes, false /* test_only */,
394 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
395 base::Unretained(this))));
396
397 drm_->RunCallbacks();
398 EXPECT_EQ(1, page_flips_);
399 }
400
401 TEST_F(HardwareDisplayControllerTest, FailPageFlippingDueToNoPrimaryPlane) {
402 ui::OverlayPlane plane1(
403 scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)),
404 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize),
405 gfx::RectF(0, 0, 1, 1));
406 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
407 std::vector<ui::OverlayPlane> planes =
408 std::vector<ui::OverlayPlane>(1, plane1);
409 EXPECT_FALSE(controller_->SchedulePageFlip(
410 planes, false /* test_only */,
411 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
412 base::Unretained(this))));
413
414 drm_->RunCallbacks();
415 EXPECT_EQ(1, page_flips_);
416 }
417
384 TEST_F(HardwareDisplayControllerTest, AddCrtcMidPageFlip) { 418 TEST_F(HardwareDisplayControllerTest, AddCrtcMidPageFlip) {
385 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( 419 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>(
386 new MockScanoutBuffer(kDefaultModeSize))); 420 new MockScanoutBuffer(kDefaultModeSize)));
387 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); 421 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode));
388 std::vector<ui::OverlayPlane> planes = 422 std::vector<ui::OverlayPlane> planes =
389 std::vector<ui::OverlayPlane>(1, plane1); 423 std::vector<ui::OverlayPlane>(1, plane1);
390 EXPECT_TRUE(controller_->SchedulePageFlip( 424 EXPECT_TRUE(controller_->SchedulePageFlip(
391 planes, false /* test_only */, 425 planes, false /* test_only */,
392 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, 426 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
393 base::Unretained(this)))); 427 base::Unretained(this))));
(...skipping 15 matching lines...) Expand all
409 planes, false /* test_only */, 443 planes, false /* test_only */,
410 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, 444 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback,
411 base::Unretained(this)))); 445 base::Unretained(this))));
412 446
413 controller_->RemoveCrtc(drm_, kPrimaryCrtc); 447 controller_->RemoveCrtc(drm_, kPrimaryCrtc);
414 448
415 EXPECT_EQ(1, page_flips_); 449 EXPECT_EQ(1, page_flips_);
416 drm_->RunCallbacks(); 450 drm_->RunCallbacks();
417 EXPECT_EQ(1, page_flips_); 451 EXPECT_EQ(1, page_flips_);
418 } 452 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698