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

Side by Side Diff: android_webview/browser/browser_view_renderer_unittest.cc

Issue 1943963003: WIP Handle AwContents needing multiple live functors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PS7 comments 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 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 #include <utility> 7 #include <utility>
8 8
9 #include "android_webview/browser/browser_view_renderer.h" 9 #include "android_webview/browser/browser_view_renderer.h"
10 #include "android_webview/browser/child_frame.h" 10 #include "android_webview/browser/child_frame.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return false; 116 return false;
117 117
118 return !constraints1.is_layer || 118 return !constraints1.is_layer ||
119 constraints1.surface_rect_empty == constraints2.surface_rect_empty; 119 constraints1.surface_rect_empty == constraints2.surface_rect_empty;
120 } 120 }
121 121
122 void OnParentDrawConstraintsUpdated() override { 122 void OnParentDrawConstraintsUpdated() override {
123 ParentCompositorDrawConstraints constraints = 123 ParentCompositorDrawConstraints constraints =
124 GetCompositorFrameConsumer()->GetParentDrawConstraintsOnUI(); 124 GetCompositorFrameConsumer()->GetParentDrawConstraintsOnUI();
125 switch (on_draw_count_) { 125 switch (on_draw_count_) {
126 case 0u:
127 EXPECT_TRUE(DrawConstraintsEquals(constraints, initial_constraints_));
boliu 2016/05/05 21:40:32 iirc leaving this out was a deliberate choice, thi
Tobias Sargeant 2016/05/06 12:41:09 We can remove the EXPECT_TRUE, however this CL add
128 break;
126 case 1u: 129 case 1u:
127 EXPECT_TRUE(DrawConstraintsEquals(constraints, new_constraints_)); 130 EXPECT_TRUE(DrawConstraintsEquals(constraints, new_constraints_));
128 break; 131 break;
129 case 3u: 132 case 3u:
130 EXPECT_TRUE(DrawConstraintsEquals(constraints, initial_constraints_)); 133 EXPECT_TRUE(DrawConstraintsEquals(constraints, initial_constraints_));
131 EndTest(); 134 EndTest();
132 break; 135 break;
133 // There will be a following 4th onDraw. But the hardware renderer won't 136 // There will be a following 4th onDraw. But the hardware renderer won't
134 // post back the draw constraints in DrawGL because the constraints 137 // post back the draw constraints in DrawGL because the constraints
135 // don't change. 138 // don't change.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 std::unique_ptr<content::SynchronousCompositor::Frame> frame( 330 std::unique_ptr<content::SynchronousCompositor::Frame> frame(
328 new content::SynchronousCompositor::Frame); 331 new content::SynchronousCompositor::Frame);
329 frame->output_surface_id = output_surface_id; 332 frame->output_surface_id = output_surface_id;
330 frame->frame = ConstructFrame(resource_id); 333 frame->frame = ConstructFrame(resource_id);
331 ++expected_return_count_[output_surface_id][resource_id]; 334 ++expected_return_count_[output_surface_id][resource_id];
332 return frame; 335 return frame;
333 } 336 }
334 337
335 void CheckResults() override { 338 void CheckResults() override {
336 OutputSurfaceResourceCountMap resource_counts; 339 OutputSurfaceResourceCountMap resource_counts;
340 browser_view_renderer_->SetCurrentCompositorFrameConsumer(nullptr);
337 render_thread_manager_.reset(); 341 render_thread_manager_.reset();
338 // Make sure resources for the last frame are returned. 342 // Make sure resources for the last frame are returned.
339 EXPECT_EQ(expected_return_count_, GetReturnedResourceCounts()); 343 EXPECT_EQ(expected_return_count_, GetReturnedResourceCounts());
340 EndTest(); 344 EndTest();
341 } 345 }
342 346
343 private: 347 private:
344 OutputSurfaceResourceCountMap expected_return_count_; 348 OutputSurfaceResourceCountMap expected_return_count_;
345 }; 349 };
346 350
347 RENDERING_TEST_F(RenderThreadManagerDeletionTest); 351 RENDERING_TEST_F(RenderThreadManagerDeletionTest);
348 352
349 } // namespace android_webview 353 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698