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

Unified Diff: ui/android/view_android_unittests.cc

Issue 2861413002: Refined DCHECK preventing multiple event forwarders in VA tree path (Closed)
Patch Set: fix tests 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
« ui/android/view_android.cc ('K') | « 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..e21c2918f1f5f48cc1162d32048c2e712652582c 100644
--- a/ui/android/view_android_unittests.cc
+++ b/ui/android/view_android_unittests.cc
@@ -6,6 +6,7 @@
#include "ui/android/event_forwarder.h"
#include "ui/android/view_android.h"
#include "ui/android/view_client.h"
+#include "ui/android/window_android.h"
#include "ui/events/android/motion_event_android.h"
namespace ui {
@@ -166,4 +167,18 @@ TEST_F(ViewAndroidBoundsTest, MatchesViewsWithOffset) {
ExpectHit(client3_);
}
+TEST(ViewAndroidTest, AddChildChecksMultipleEventForwarders) {
+ ViewAndroid view1;
+ ViewAndroid view2;
+ view1.GetEventForwarder();
+ view2.GetEventForwarder();
+ EXPECT_DEATH(view1.AddChild(&view2), "Check failed:");
+
+ WindowAndroid* window = WindowAndroid::CreateForTesting();
+ view2.RemoveFromParent();
+ window->AddChild(&view1);
+ window->AddChild(&view2);
+ window->Destroy(nullptr, nullptr);
+}
+
} // namespace ui
« ui/android/view_android.cc ('K') | « ui/android/view_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698