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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2609253003: Remove ForceReclaimResources (Closed)
Patch Set: Fix tests and re-enable previous swap behavior Created 3 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 root->SetBounds(gfx::Rect(0, 0, 10, 10)); 1149 root->SetBounds(gfx::Rect(0, 0, 10, 10));
1150 root->SetVisible(true); 1150 root->SetVisible(true);
1151 WaitForCommit(); 1151 WaitForCommit();
1152 1152
1153 gfx::Rect damaged_rect(0, 0, 5, 5); 1153 gfx::Rect damaged_rect(0, 0, 5, 5);
1154 root->SchedulePaint(damaged_rect); 1154 root->SchedulePaint(damaged_rect);
1155 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds()); 1155 EXPECT_EQ(damaged_rect, root->damaged_region_for_testing().bounds());
1156 WaitForCommit(); 1156 WaitForCommit();
1157 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty()); 1157 EXPECT_TRUE(root->damaged_region_for_testing().IsEmpty());
1158 1158
1159 compositor()->SetRootLayer(nullptr); 1159 // The texture mailbox has a reference from an in-flight texture layer.
1160 root.reset(); 1160 // We clear the texture mailbox from the root layer and draw a new frame
1161 WaitForCommit(); 1161 // to ensure that the texture mailbox is released. We then draw a second
1162 // frame to ensure that the mailbox's release callback has time to run.
1163 root->SetShowSolidColorContent();
1164 Draw();
1165 Draw();
1162 } 1166 }
1163 1167
1164 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) { 1168 void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) {
1165 EXPECT_EQ(expected_color, actual_color) 1169 EXPECT_EQ(expected_color, actual_color)
1166 << "Pixel error at x=" << x << " y=" << y << "; " 1170 << "Pixel error at x=" << x << " y=" << y << "; "
1167 << "actual RGBA=(" 1171 << "actual RGBA=("
1168 << SkColorGetR(actual_color) << "," 1172 << SkColorGetR(actual_color) << ","
1169 << SkColorGetG(actual_color) << "," 1173 << SkColorGetG(actual_color) << ","
1170 << SkColorGetB(actual_color) << "," 1174 << SkColorGetB(actual_color) << ","
1171 << SkColorGetA(actual_color) << "); " 1175 << SkColorGetA(actual_color) << "); "
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 layer.set_name("foo"); 2281 layer.set_name("foo");
2278 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2282 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2279 layer.TakeDebugInfo(nullptr); 2283 layer.TakeDebugInfo(nullptr);
2280 std::string trace_format("bar,"); 2284 std::string trace_format("bar,");
2281 debug_info->AppendAsTraceFormat(&trace_format); 2285 debug_info->AppendAsTraceFormat(&trace_format);
2282 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2286 std::string expected("bar,{\"layer_name\":\"foo\"}");
2283 EXPECT_EQ(expected, trace_format); 2287 EXPECT_EQ(expected, trace_format);
2284 } 2288 }
2285 2289
2286 } // namespace ui 2290 } // namespace ui
OLDNEW
« content/test/layouttest_support.cc ('K') | « content/test/layouttest_support.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698