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

Unified Diff: ui/android/view_android_unittests.cc

Issue 2861413002: Refined DCHECK preventing multiple event forwarders in VA tree path (Closed)
Patch Set: nit Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/android/view_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/view_android_unittests.cc
diff --git a/ui/android/view_android_unittests.cc b/ui/android/view_android_unittests.cc
index 77c9bcae16534428660684bb80c2c99af788a641..f3c95de0b70ac41cadd1885ba1a568250a08aa82 100644
--- a/ui/android/view_android_unittests.cc
+++ b/ui/android/view_android_unittests.cc
@@ -166,4 +166,37 @@ TEST_F(ViewAndroidBoundsTest, MatchesViewsWithOffset) {
ExpectHit(client3_);
}
+TEST(ViewAndroidTest, ChecksMultipleEventForwarders) {
+ ViewAndroid parent;
+ ViewAndroid child;
+ parent.GetEventForwarder();
+ child.GetEventForwarder();
+ EXPECT_DEATH(parent.AddChild(&child), "Check failed:");
+
+ ViewAndroid parent2;
+ ViewAndroid child2;
+ parent2.GetEventForwarder();
+ parent2.AddChild(&child2);
+ EXPECT_DEATH(child2.GetEventForwarder(), "Check failed:");
+
+ ViewAndroid window;
+ ViewAndroid wcv1, wcv2;
+ ViewAndroid rwhv1a, rwhv1b, rwhv2;
+ wcv1.GetEventForwarder();
+ wcv2.GetEventForwarder();
+
+ window.AddChild(&wcv1);
+ wcv1.AddChild(&rwhv1a);
+ wcv1.AddChild(&rwhv1b);
+
+ wcv2.AddChild(&rwhv2);
+
+ // window should be able to add wcv2 since there's only one event forwarder
+ // in the path window - wcv2* - rwvh2
+ window.AddChild(&wcv2);
+
+ // Additional event forwarder will cause failure.
+ EXPECT_DEATH(rwhv2.GetEventForwarder(), "Check failed:");
+}
+
} // namespace ui
« no previous file with comments | « ui/android/view_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698