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

Unified Diff: cc/surfaces/display_unittest.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Address comments Created 3 years, 7 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
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink_unittest.cc ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/display_unittest.cc
diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc
index a7526b0088d7fc8d076e5f7b4fb16c03e056bf91..2966adddb06ef3c3393f02049baac3623d523d9c 100644
--- a/cc/surfaces/display_unittest.cc
+++ b/cc/surfaces/display_unittest.cc
@@ -207,7 +207,6 @@ TEST_F(DisplayTest, DisplayDamaged) {
EXPECT_EQ(gfx::Size(100, 100),
software_output_device_->viewport_pixel_size());
EXPECT_EQ(gfx::Rect(0, 0, 100, 100), software_output_device_->damage_rect());
-
{
// Only damaged portion should be swapped.
pass = RenderPass::Create();
@@ -261,6 +260,9 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass->damage_rect = gfx::Rect(10, 10, 10, 10);
pass->id = 1;
+ local_surface_id = id_allocator_.GenerateId();
+ display_->SetLocalSurfaceId(local_surface_id, 1.f);
+
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
@@ -281,6 +283,9 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass->damage_rect = gfx::Rect(10, 10, 0, 0);
pass->id = 1;
+ local_surface_id = id_allocator_.GenerateId();
+ display_->SetLocalSurfaceId(local_surface_id, 1.f);
+
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
@@ -348,6 +353,8 @@ TEST_F(DisplayTest, DisplayDamaged) {
// Resize should cause a swap if no frame was swapped at the previous size.
{
+ local_surface_id = id_allocator_.GenerateId();
+ display_->SetLocalSurfaceId(local_surface_id, 1.f);
scheduler_->swapped = false;
display_->Resize(gfx::Size(200, 200));
EXPECT_FALSE(scheduler_->swapped);
@@ -379,6 +386,8 @@ TEST_F(DisplayTest, DisplayDamaged) {
}
{
+ local_surface_id = id_allocator_.GenerateId();
+ display_->SetLocalSurfaceId(local_surface_id, 1.0f);
// Surface that's damaged completely should be resized and swapped.
pass = RenderPass::Create();
pass->output_rect = gfx::Rect(0, 0, 99, 99);
@@ -410,7 +419,8 @@ class MockedContext : public TestWebGraphicsContext3D {
};
TEST_F(DisplayTest, Finish) {
- LocalSurfaceId local_surface_id(id_allocator_.GenerateId());
+ LocalSurfaceId local_surface_id1(id_allocator_.GenerateId());
+ LocalSurfaceId local_surface_id2(id_allocator_.GenerateId());
RendererSettings settings;
settings.partial_swap_enabled = true;
@@ -425,7 +435,7 @@ TEST_F(DisplayTest, Finish) {
StubDisplayClient client;
display_->Initialize(&client, &manager_);
- display_->SetLocalSurfaceId(local_surface_id, 1.f);
+ display_->SetLocalSurfaceId(local_surface_id1, 1.f);
display_->Resize(gfx::Size(100, 100));
@@ -437,7 +447,7 @@ TEST_F(DisplayTest, Finish) {
pass->id = 1;
pass_list.push_back(std::move(pass));
- SubmitCompositorFrame(&pass_list, local_surface_id);
+ SubmitCompositorFrame(&pass_list, local_surface_id1);
}
display_->DrawAndSwap();
@@ -451,6 +461,7 @@ TEST_F(DisplayTest, Finish) {
// Another resize without a swap doesn't need to finish.
EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0);
+ display_->SetLocalSurfaceId(local_surface_id2, 1.f);
display_->Resize(gfx::Size(200, 200));
testing::Mock::VerifyAndClearExpectations(context_ptr);
@@ -463,7 +474,7 @@ TEST_F(DisplayTest, Finish) {
pass->id = 1;
pass_list.push_back(std::move(pass));
- SubmitCompositorFrame(&pass_list, local_surface_id);
+ SubmitCompositorFrame(&pass_list, local_surface_id2);
}
display_->DrawAndSwap();
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink_unittest.cc ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698