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

Side by Side Diff: cc/surfaces/display_unittest.cc

Issue 1996783002: Make cc::SurfaceId unguessable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed more build targets Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "cc/surfaces/display.h" 5 #include "cc/surfaces/display.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/test/null_task_runner.h" 9 #include "base/test/null_task_runner.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 SetUpContext(nullptr); 188 SetUpContext(nullptr);
189 TestDisplayClient client; 189 TestDisplayClient client;
190 RendererSettings settings; 190 RendererSettings settings;
191 settings.partial_swap_enabled = true; 191 settings.partial_swap_enabled = true;
192 settings.finish_rendering_on_resize = true; 192 settings.finish_rendering_on_resize = true;
193 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr, 193 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr,
194 settings, id_allocator_.id_namespace()); 194 settings, id_allocator_.id_namespace());
195 display.Initialize(std::move(output_surface_), task_runner_.get()); 195 display.Initialize(std::move(output_surface_), task_runner_.get());
196 TestDisplayScheduler& scheduler = display.scheduler(); 196 TestDisplayScheduler& scheduler = display.scheduler();
197 197
198 SurfaceId surface_id(id_allocator_.GenerateId()); 198 SurfaceId surface_id;
199 surface_id = id_allocator_.GenerateId();
199 EXPECT_FALSE(scheduler.damaged); 200 EXPECT_FALSE(scheduler.damaged);
200 EXPECT_FALSE(scheduler.has_new_root_surface); 201 EXPECT_FALSE(scheduler.has_new_root_surface);
201 display.SetSurfaceId(surface_id, 1.f); 202 display.SetSurfaceId(surface_id, 1.f);
202 EXPECT_FALSE(scheduler.damaged); 203 EXPECT_FALSE(scheduler.damaged);
203 EXPECT_FALSE(scheduler.display_resized_); 204 EXPECT_FALSE(scheduler.display_resized_);
204 EXPECT_TRUE(scheduler.has_new_root_surface); 205 EXPECT_TRUE(scheduler.has_new_root_surface);
205 206
206 scheduler.ResetDamageForTest(); 207 scheduler.ResetDamageForTest();
207 display.Resize(gfx::Size(100, 100)); 208 display.Resize(gfx::Size(100, 100));
208 EXPECT_FALSE(scheduler.damaged); 209 EXPECT_FALSE(scheduler.damaged);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 MOCK_METHOD0(shallowFinishCHROMIUM, void()); 445 MOCK_METHOD0(shallowFinishCHROMIUM, void());
445 }; 446 };
446 447
447 TEST_F(DisplayTest, Finish) { 448 TEST_F(DisplayTest, Finish) {
448 std::unique_ptr<MockedContext> context(new MockedContext()); 449 std::unique_ptr<MockedContext> context(new MockedContext());
449 MockedContext* context_ptr = context.get(); 450 MockedContext* context_ptr = context.get();
450 SetUpContext(std::move(context)); 451 SetUpContext(std::move(context));
451 452
452 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); 453 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0);
453 454
454 SurfaceId surface_id(id_allocator_.GenerateId()); 455 SurfaceId surface_id;
456 surface_id = id_allocator_.GenerateId();
455 457
456 TestDisplayClient client; 458 TestDisplayClient client;
457 RendererSettings settings; 459 RendererSettings settings;
458 settings.partial_swap_enabled = true; 460 settings.partial_swap_enabled = true;
459 settings.finish_rendering_on_resize = true; 461 settings.finish_rendering_on_resize = true;
460 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr, 462 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr,
461 settings, surface_id.id_namespace()); 463 settings, surface_id.id_namespace);
462 display.Initialize(std::move(output_surface_), task_runner_.get()); 464 display.Initialize(std::move(output_surface_), task_runner_.get());
463 465
464 display.SetSurfaceId(surface_id, 1.f); 466 display.SetSurfaceId(surface_id, 1.f);
465 467
466 display.Resize(gfx::Size(100, 100)); 468 display.Resize(gfx::Size(100, 100));
467 factory_.Create(surface_id); 469 factory_.Create(surface_id);
468 470
469 { 471 {
470 RenderPassList pass_list; 472 RenderPassList pass_list;
471 std::unique_ptr<RenderPass> pass = RenderPass::Create(); 473 std::unique_ptr<RenderPass> pass = RenderPass::Create();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 511
510 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); 512 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM());
511 display.Resize(gfx::Size(250, 250)); 513 display.Resize(gfx::Size(250, 250));
512 testing::Mock::VerifyAndClearExpectations(context_ptr); 514 testing::Mock::VerifyAndClearExpectations(context_ptr);
513 515
514 factory_.Destroy(surface_id); 516 factory_.Destroy(surface_id);
515 } 517 }
516 518
517 } // namespace 519 } // namespace
518 } // namespace cc 520 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698