[sheriff] Disable flaky MenuButtonTest on CrOS MSAN

Bug: 1433710
Change-Id: I9989d7d39a80612a25c069ed62e293e8e2e40d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4434509
Owners-Override: Sebastien Lalancette <seblalancette@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@google.com>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Auto-Submit: Sebastien Lalancette <seblalancette@chromium.org>
Reviewed-by: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: David Bienvenu <davidbienvenu@google.com>
Cr-Commit-Position: refs/heads/main@{#1131335}
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc
index 2c4ff9e2..3ac7e99 100644
--- a/ui/views/controls/button/menu_button_unittest.cc
+++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -309,7 +309,15 @@
 }
 
 // Tests that the ink drop center point is set from the PressedLock constructor.
-TEST_F(MenuButtonTest, InkDropCenterSetFromClickWithPressedLock) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_InkDropCenterSetFromClickWithPressedLock \
+  DISABLED_InkDropCenterSetFromClickWithPressedLock
+#else
+#define MAYBE_InkDropCenterSetFromClickWithPressedLock \
+  InkDropCenterSetFromClickWithPressedLock
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest, MAYBE_InkDropCenterSetFromClickWithPressedLock) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
 
   gfx::Point click_point(11, 7);
@@ -324,7 +332,15 @@
 }
 
 // Test that the MenuButton stays pressed while there are any PressedLocks.
-TEST_F(MenuButtonTest, ButtonStateForMenuButtonsWithPressedLocks) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_ButtonStateForMenuButtonsWithPressedLocks \
+  DISABLED_ButtonStateForMenuButtonsWithPressedLocks
+#else
+#define MAYBE_ButtonStateForMenuButtonsWithPressedLocks \
+  ButtonStateForMenuButtonsWithPressedLocks
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest, MAYBE_ButtonStateForMenuButtonsWithPressedLocks) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
   const gfx::Rect button_bounds = button()->GetBoundsInScreen();
 
@@ -386,7 +402,15 @@
 
 // Test that the MenuButton does not become pressed if it can be dragged, until
 // a release occurs.
-TEST_F(MenuButtonTest, DraggableMenuButtonActivatesOnRelease) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_DraggableMenuButtonActivatesOnRelease \
+  DISABLED_DraggableMenuButtonActivatesOnRelease
+#else
+#define MAYBE_DraggableMenuButtonActivatesOnRelease \
+  DraggableMenuButtonActivatesOnRelease
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest, MAYBE_DraggableMenuButtonActivatesOnRelease) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
   TestDragController drag_controller;
   button()->set_drag_controller(&drag_controller);
@@ -400,7 +424,16 @@
   EXPECT_EQ(Button::STATE_HOVERED, button()->last_state());
 }
 
-TEST_F(MenuButtonTest, InkDropStateForMenuButtonActivationsWithoutCallback) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_InkDropStateForMenuButtonActivationsWithoutCallback \
+  DISABLED_InkDropStateForMenuButtonActivationsWithoutCallback
+#else
+#define MAYBE_InkDropStateForMenuButtonActivationsWithoutCallback \
+  InkDropStateForMenuButtonActivationsWithoutCallback
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest,
+       MAYBE_InkDropStateForMenuButtonActivationsWithoutCallback) {
   ConfigureMenuButton(
       std::make_unique<TestMenuButton>(Button::PressedCallback()));
   ink_drop()->AnimateToState(InkDropState::ACTION_PENDING);
@@ -409,8 +442,17 @@
   EXPECT_EQ(InkDropState::HIDDEN, ink_drop()->GetTargetInkDropState());
 }
 
-TEST_F(MenuButtonTest,
-       InkDropStateForMenuButtonActivationsWithCallbackThatDoesntAcquireALock) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_InkDropStateForMenuButtonActivationsWithCallbackThatDoesntAcquireALock \
+  DISABLED_InkDropStateForMenuButtonActivationsWithCallbackThatDoesntAcquireALock
+#else
+#define MAYBE_InkDropStateForMenuButtonActivationsWithCallbackThatDoesntAcquireALock \
+  InkDropStateForMenuButtonActivationsWithCallbackThatDoesntAcquireALock
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(
+    MenuButtonTest,
+    MAYBE_InkDropStateForMenuButtonActivationsWithCallbackThatDoesntAcquireALock) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
   button()->Activate(nullptr);
 
@@ -435,7 +477,15 @@
   EXPECT_EQ(InkDropState::DEACTIVATED, ink_drop()->GetTargetInkDropState());
 }
 
-TEST_F(MenuButtonTest, InkDropStateForMenuButtonsWithPressedLocks) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_InkDropStateForMenuButtonsWithPressedLocks \
+  DISABLED_InkDropStateForMenuButtonsWithPressedLocks
+#else
+#define MAYBE_InkDropStateForMenuButtonsWithPressedLocks \
+  InkDropStateForMenuButtonsWithPressedLocks
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest, MAYBE_InkDropStateForMenuButtonsWithPressedLocks) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
 
   auto pressed_lock1 = std::make_unique<MenuButtonController::PressedLock>(
@@ -457,7 +507,14 @@
 
 // Verifies only one ink drop animation is triggered when multiple PressedLocks
 // are attached to a MenuButton.
-TEST_F(MenuButtonTest, OneInkDropAnimationForReentrantPressedLocks) {
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_OneInkDropAnimationForReentrantPressedLocks \
+  DISABLED_OneInkDropAnimationForReentrantPressedLocks
+#else
+#define MAYBE_OneInkDropAnimationForReentrantPressedLocks \
+  OneInkDropAnimationForReentrantPressedLocks
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest, MAYBE_OneInkDropAnimationForReentrantPressedLocks) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
 
   auto pressed_lock1 = std::make_unique<MenuButtonController::PressedLock>(
@@ -474,8 +531,16 @@
 
 // Verifies the InkDropState is left as ACTIVATED if a PressedLock is active
 // before another Activation occurs.
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_InkDropStateForMenuButtonWithPressedLockBeforeActivation \
+  DISABLED_InkDropStateForMenuButtonWithPressedLockBeforeActivation
+#else
+#define MAYBE_InkDropStateForMenuButtonWithPressedLockBeforeActivation \
+  InkDropStateForMenuButtonWithPressedLockBeforeActivation
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
 TEST_F(MenuButtonTest,
-       InkDropStateForMenuButtonWithPressedLockBeforeActivation) {
+       MAYBE_InkDropStateForMenuButtonWithPressedLockBeforeActivation) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
   MenuButtonController::PressedLock lock(button()->button_controller());
 
@@ -488,7 +553,15 @@
 
 // Tests that the MenuButton does not become pressed if it can be dragged, and a
 // DragDropClient is processing the events.
-TEST_F(MenuButtonTest, DraggableMenuButtonDoesNotActivateOnDrag) {
+// TODO(crbug.com/1433710): Test flaky on MSAN ChromeOS builders.
+#if BUILDFLAG(IS_CHROMEOS) && defined(MEMORY_SANITIZER)
+#define MAYBE_DraggableMenuButtonDoesNotActivateOnDrag \
+  DISABLED_DraggableMenuButtonDoesNotActivateOnDrag
+#else
+#define MAYBE_DraggableMenuButtonDoesNotActivateOnDrag \
+  DraggableMenuButtonDoesNotActivateOnDrag
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH) && defined(MEMORY_SANITIZER)
+TEST_F(MenuButtonTest, MAYBE_DraggableMenuButtonDoesNotActivateOnDrag) {
   ConfigureMenuButton(std::make_unique<TestMenuButton>());
   TestDragController drag_controller;
   button()->set_drag_controller(&drag_controller);