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

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

Issue 1985973002: Defer compositor context creation to the thread. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: contextfactory: . 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/surface_display_output_surface.h" 5 #include "cc/surfaces/surface_display_output_surface.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "cc/surfaces/onscreen_display_client.h" 9 #include "cc/surfaces/onscreen_display_client.h"
10 #include "cc/surfaces/surface_id_allocator.h" 10 #include "cc/surfaces/surface_id_allocator.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)), 56 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)),
57 allocator_(0), 57 allocator_(0),
58 display_size_(1920, 1080), 58 display_size_(1920, 1080),
59 display_rect_(display_size_), 59 display_rect_(display_size_),
60 display_client_(&surface_manager_, 60 display_client_(&surface_manager_,
61 &bitmap_manager_, 61 &bitmap_manager_,
62 &gpu_memory_buffer_manager_, 62 &gpu_memory_buffer_manager_,
63 renderer_settings_, 63 renderer_settings_,
64 task_runner_, 64 task_runner_,
65 allocator_.id_namespace()), 65 allocator_.id_namespace()),
66 context_provider_(TestContextProvider::Create()), 66 surface_display_output_surface_(
67 surface_display_output_surface_(&surface_manager_, 67 &surface_manager_,
68 &allocator_, 68 &allocator_,
69 context_provider_, 69 base::MakeUnique<TestContextProvider::Factory>(),
70 nullptr) { 70 nullptr) {
71 surface_manager_.RegisterSurfaceIdNamespace(allocator_.id_namespace()); 71 surface_manager_.RegisterSurfaceIdNamespace(allocator_.id_namespace());
72 output_surface_ = display_client_.output_surface(); 72 output_surface_ = display_client_.output_surface();
73 display_client_.set_surface_output_surface( 73 display_client_.set_surface_output_surface(
74 &surface_display_output_surface_); 74 &surface_display_output_surface_);
75 surface_display_output_surface_.set_display_client(&display_client_); 75 surface_display_output_surface_.set_display_client(&display_client_);
76 76
77 // Set the Display's begin frame source like a real browser compositor 77 // Set the Display's begin frame source like a real browser compositor
78 // output surface would. 78 // output surface would.
79 begin_frame_source_.reset( 79 begin_frame_source_.reset(
80 new BackToBackBeginFrameSource(task_runner_.get())); 80 new BackToBackBeginFrameSource(task_runner_.get()));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 const gfx::Size display_size_; 123 const gfx::Size display_size_;
124 const gfx::Rect display_rect_; 124 const gfx::Rect display_rect_;
125 FakeOutputSurface* output_surface_; 125 FakeOutputSurface* output_surface_;
126 SurfaceManager surface_manager_; 126 SurfaceManager surface_manager_;
127 TestSharedBitmapManager bitmap_manager_; 127 TestSharedBitmapManager bitmap_manager_;
128 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; 128 TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
129 RendererSettings renderer_settings_; 129 RendererSettings renderer_settings_;
130 FakeOnscreenDisplayClient display_client_; 130 FakeOnscreenDisplayClient display_client_;
131 131
132 scoped_refptr<TestContextProvider> context_provider_;
133
134 FakeOutputSurfaceClient surface_display_output_surface_client_; 132 FakeOutputSurfaceClient surface_display_output_surface_client_;
135 SurfaceDisplayOutputSurface surface_display_output_surface_; 133 SurfaceDisplayOutputSurface surface_display_output_surface_;
136 }; 134 };
137 135
138 TEST_F(SurfaceDisplayOutputSurfaceTest, DamageTriggersSwapBuffers) { 136 TEST_F(SurfaceDisplayOutputSurfaceTest, DamageTriggersSwapBuffers) {
139 SwapBuffersWithDamage(display_rect_); 137 SwapBuffersWithDamage(display_rect_);
140 EXPECT_EQ(1u, output_surface_->num_sent_frames()); 138 EXPECT_EQ(1u, output_surface_->num_sent_frames());
141 task_runner_->RunUntilIdle(); 139 task_runner_->RunUntilIdle();
142 EXPECT_EQ(2u, output_surface_->num_sent_frames()); 140 EXPECT_EQ(2u, output_surface_->num_sent_frames());
143 } 141 }
(...skipping 28 matching lines...) Expand all
172 EXPECT_EQ(1u, output_surface_->num_sent_frames()); 170 EXPECT_EQ(1u, output_surface_->num_sent_frames());
173 171
174 SwapBuffersWithDamage(gfx::Rect()); 172 SwapBuffersWithDamage(gfx::Rect());
175 EXPECT_EQ(1u, output_surface_->num_sent_frames()); 173 EXPECT_EQ(1u, output_surface_->num_sent_frames());
176 task_runner_->RunUntilIdle(); 174 task_runner_->RunUntilIdle();
177 EXPECT_EQ(1u, output_surface_->num_sent_frames()); 175 EXPECT_EQ(1u, output_surface_->num_sent_frames());
178 } 176 }
179 177
180 } // namespace 178 } // namespace
181 } // namespace cc 179 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698