Commit 45616255 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Disable menu-related translate bubble tests on Mac

NSMenus on Mac block in a nested run-loop, so any tests that open a menu
and try to do things to it or sense things on it either:
- Succeed by accident because of a race condition with app activations
- Block until the menu or another window is interacted with

Disabling these until we've either been able to make NSMenus asynchronous
to match views expectations, or found a way to test this functionality a
different way.

|AlwaysTranslateLanguageMenuItem| has an additional problem: pressing a
button halfway through closes the bubble, but on non-Mac platforms, the
test can continue due to asynchronous window closing. On Mac, the window's
content view is removed as soon as closing begins. We'll probably need
to address this by breaking it up into multiple tests and creating a way
to sense the state without relying on an object owned by the closing
bubble.

Bug: 810479,823735
Change-Id: I9d9d9ca49a3436b91d3cc99fb43ecef13d2e77c0
Reviewed-on: https://chromium-review.googlesource.com/969653Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544400}
parent 489d6d74
......@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/ui/translate/translate_bubble_model.h"
#include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
......@@ -28,6 +29,27 @@
#include "ui/views/test/views_test_base.h"
#include "ui/views/widget/widget.h"
// On Mac, menus block in a nested runloop, so any tests that trigger
// the menu either hang, or pass only because of a race condition with
// app activation. Disable until either tests can be rewritten or Mac
// menus are made asynchronous.
#if defined(OS_MACOSX)
#define MAYBE_OptionsMenuNeverTranslateLanguage \
DISABLED_OptionsMenuNeverTranslateLanguage
#define MAYBE_OptionsMenuNeverTranslateSite \
DISABLED_OptionsMenuNeverTranslateSite
#define MAYBE_OptionsMenuRespectsBlacklistSite \
DISABLED_OptionsMenuRespectsBlacklistSite
#define MAYBE_AlwaysTranslateLanguageMenuItem \
DISABLED_AlwaysTranslateLanguageMenuItem
#else
#define MAYBE_OptionsMenuNeverTranslateLanguage \
OptionsMenuNeverTranslateLanguage
#define MAYBE_OptionsMenuNeverTranslateSite OptionsMenuNeverTranslateSite
#define MAYBE_OptionsMenuRespectsBlacklistSite OptionsMenuRespectsBlacklistSite
#define MAYBE_AlwaysTranslateLanguageMenuItem AlwaysTranslateLanguageMenuItem
#endif
namespace {
class MockTranslateBubbleModel : public TranslateBubbleModel {
......@@ -223,7 +245,7 @@ TEST_F(TranslateBubbleViewTest, TranslateButton) {
EXPECT_TRUE(mock_model_->translate_called_);
}
TEST_F(TranslateBubbleViewTest, OptionsMenuNeverTranslateLanguage) {
TEST_F(TranslateBubbleViewTest, MAYBE_OptionsMenuNeverTranslateLanguage) {
CreateAndShowBubble();
EXPECT_FALSE(bubble_->GetWidget()->IsClosed());
......@@ -240,7 +262,7 @@ TEST_F(TranslateBubbleViewTest, OptionsMenuNeverTranslateLanguage) {
EXPECT_TRUE(bubble_->GetWidget()->IsClosed());
}
TEST_F(TranslateBubbleViewTest, OptionsMenuNeverTranslateSite) {
TEST_F(TranslateBubbleViewTest, MAYBE_OptionsMenuNeverTranslateSite) {
// NEVER_TRANSLATE_SITE should only show up for sites that can be blacklisted.
mock_model_->SetCanBlacklistSite(true);
CreateAndShowBubble();
......@@ -411,7 +433,7 @@ TEST_F(TranslateBubbleViewTest, CancelButtonReturningError) {
EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ERROR, bubble_->GetViewState());
}
TEST_F(TranslateBubbleViewTest, OptionsMenuRespectsBlacklistSite) {
TEST_F(TranslateBubbleViewTest, MAYBE_OptionsMenuRespectsBlacklistSite) {
mock_model_->SetCanBlacklistSite(false);
CreateAndShowBubble();
......@@ -425,7 +447,7 @@ TEST_F(TranslateBubbleViewTest, OptionsMenuRespectsBlacklistSite) {
0);
}
TEST_F(TranslateBubbleViewTest, AlwaysTranslateLanguageMenuItem) {
TEST_F(TranslateBubbleViewTest, MAYBE_AlwaysTranslateLanguageMenuItem) {
CreateAndShowBubble();
TriggerOptionsMenu();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment