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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 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
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 "content/browser/frame_host/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 browser_context_.release()); 114 browser_context_.release());
115 base::RunLoop().RunUntilIdle(); 115 base::RunLoop().RunUntilIdle();
116 #if !defined(OS_ANDROID) 116 #if !defined(OS_ANDROID)
117 ImageTransportFactory::Terminate(); 117 ImageTransportFactory::Terminate();
118 #else 118 #else
119 ui::ContextProviderFactory::SetInstance(nullptr); 119 ui::ContextProviderFactory::SetInstance(nullptr);
120 ContextProviderFactoryImpl::Terminate(); 120 ContextProviderFactoryImpl::Terminate();
121 #endif 121 #endif
122 } 122 }
123 123
124 cc::SurfaceId surface_id() { return view_->surface_id_; } 124 cc::SurfaceId GetSurfaceId() const {
125 return cc::SurfaceId(view_->frame_sink_id_, view_->local_frame_id_);
126 }
125 127
126 protected: 128 protected:
127 base::MessageLoopForUI message_loop_; 129 base::MessageLoopForUI message_loop_;
128 std::unique_ptr<BrowserContext> browser_context_; 130 std::unique_ptr<BrowserContext> browser_context_;
129 MockRenderWidgetHostDelegate delegate_; 131 MockRenderWidgetHostDelegate delegate_;
130 132
131 // Tests should set these to NULL if they've already triggered their 133 // Tests should set these to NULL if they've already triggered their
132 // destruction. 134 // destruction.
133 RenderWidgetHostImpl* widget_host_; 135 RenderWidgetHostImpl* widget_host_;
134 RenderWidgetHostViewChildFrame* view_; 136 RenderWidgetHostViewChildFrame* view_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 gfx::Size view_size(100, 100); 172 gfx::Size view_size(100, 100);
171 gfx::Rect view_rect(view_size); 173 gfx::Rect view_rect(view_size);
172 float scale_factor = 1.f; 174 float scale_factor = 1.f;
173 175
174 view_->SetSize(view_size); 176 view_->SetSize(view_size);
175 view_->Show(); 177 view_->Show();
176 178
177 view_->OnSwapCompositorFrame( 179 view_->OnSwapCompositorFrame(
178 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 180 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
179 181
180 cc::SurfaceId id = surface_id(); 182 cc::SurfaceId id = GetSurfaceId();
181 if (!id.is_null()) { 183 if (!id.is_null()) {
182 #if !defined(OS_ANDROID) 184 #if !defined(OS_ANDROID)
183 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 185 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
184 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 186 cc::SurfaceManager* manager = factory->GetSurfaceManager();
185 cc::Surface* surface = manager->GetSurfaceForId(id); 187 cc::Surface* surface = manager->GetSurfaceForId(id);
186 EXPECT_TRUE(surface); 188 EXPECT_TRUE(surface);
187 // There should be a SurfaceSequence created by the RWHVChildFrame. 189 // There should be a SurfaceSequence created by the RWHVChildFrame.
188 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 190 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
189 #endif 191 #endif
190 192
191 // Surface ID should have been passed to CrossProcessFrameConnector to 193 // Surface ID should have been passed to CrossProcessFrameConnector to
192 // be sent to the embedding renderer. 194 // be sent to the embedding renderer.
193 EXPECT_EQ(id, test_frame_connector_->last_surface_id_received_); 195 EXPECT_EQ(id, test_frame_connector_->last_surface_id_received_);
194 EXPECT_EQ(view_size, test_frame_connector_->last_frame_size_received_); 196 EXPECT_EQ(view_size, test_frame_connector_->last_frame_size_received_);
195 EXPECT_EQ(scale_factor, test_frame_connector_->last_scale_factor_received_); 197 EXPECT_EQ(scale_factor, test_frame_connector_->last_scale_factor_received_);
196 } 198 }
197 } 199 }
198 200
199 } // namespace content 201 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698