0

Change OS_APPLE to OS_MAC in ui/views

All the files under ui/views should be used with toolkit views
which is not used on iOS. So a more accurate macro for these
should be OS_MAC as iOS is by default excluded.

Bug: none
Change-Id: I30e2468e2d7b5d7b91b447798f9dff3ded1890f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2853618
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#876736}
This commit is contained in:
Wei Li
2021-04-27 20:35:42 +00:00
committed by Chromium LUCI CQ
parent 2d6916a41c
commit 1e6d8927fd
67 changed files with 232 additions and 232 deletions
ui/views
accessibility
accessible_pane_view_unittest.cc
bubble
controls
examples
focus
layout
style
test
view_unittest.ccviews_delegate.ccviews_delegate.h
widget
window

@ -298,7 +298,7 @@ gfx::NativeViewAccessible AXVirtualView::ChildAtIndex(int index) {
return nullptr;
}
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
gfx::NativeViewAccessible AXVirtualView::GetNSWindow() {
NOTREACHED();
return nullptr;

@ -262,11 +262,11 @@ void ViewAXPlatformNodeDelegate::NotifyAccessibilityEvent(
ax_platform_node_->NotifyAccessibilityEvent(event_type);
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
void ViewAXPlatformNodeDelegate::AnnounceText(const std::u16string& text) {
ax_platform_node_->AnnounceText(text);
}
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
const ui::AXNodeData& ViewAXPlatformNodeDelegate::GetData() const {
// Clear the data, then populate it.

@ -54,7 +54,7 @@ class ViewAXPlatformNodeDelegate : public ViewAccessibility,
bool IsAccessibilityEnabled() const override;
gfx::NativeViewAccessible GetNativeObject() const override;
void NotifyAccessibilityEvent(ax::mojom::Event event_type) override;
#if defined(OS_APPLE)
#if defined(OS_MAC)
void AnnounceText(const std::u16string& text) override;
#endif

@ -896,13 +896,13 @@ TEST_F(ViewAXPlatformNodeDelegateMenuTest, MenuTest) {
EXPECT_EQ(submenu_item->GetData().GetHasPopup(), ax::mojom::HasPopup::kMenu);
EXPECT_EQ(submenu_item->GetPosInSet(), 2);
EXPECT_EQ(submenu_item->GetSetSize(), 7);
#if defined(OS_APPLE)
#if defined(OS_MAC)
// A virtual child with role menu is exposed so that VoiceOver treats a
// MenuItemView of type kSubMenu as a submenu rather than an item.
EXPECT_EQ(submenu_item->GetChildCount(), 1);
#else
EXPECT_EQ(submenu_item->GetChildCount(), 0);
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
EXPECT_EQ(submenu_item->GetIndexInParent(), 1);
// MenuItemView::Type::kActionableSubMenu
@ -921,13 +921,13 @@ TEST_F(ViewAXPlatformNodeDelegateMenuTest, MenuTest) {
ax::mojom::HasPopup::kMenu);
EXPECT_EQ(actionable_submenu_item->GetPosInSet(), 3);
EXPECT_EQ(actionable_submenu_item->GetSetSize(), 7);
#if defined(OS_APPLE)
#if defined(OS_MAC)
// A virtual child with role menu is exposed so that VoiceOver treats a
// MenuItemView of type kActionableSubMenu as a submenu rather than an item.
EXPECT_EQ(actionable_submenu_item->GetChildCount(), 1);
#else
EXPECT_EQ(actionable_submenu_item->GetChildCount(), 0);
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
EXPECT_EQ(actionable_submenu_item->GetIndexInParent(), 2);
// MenuItemView::Type::kCheckbox

@ -135,7 +135,7 @@ TEST_F(AccessiblePaneViewTest, SetPaneFocusAndRestore) {
// predictable. On Mac, Deactivate() is not implemented. Note that
// TestBarView calls set_allow_deactivate_on_esc(true), which is only
// otherwise used in Ash.
#if !defined(OS_APPLE) || BUILDFLAG(IS_CHROMEOS_ASH)
#if !defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH)
// Esc should deactivate the widget.
test_view_bar->AcceleratorPressed(test_view_bar->escape_key());
EXPECT_TRUE(widget_main->IsActive());

@ -69,7 +69,7 @@ class VIEWS_EXPORT BubbleBorder : public Border {
NO_SHADOW,
SHADOW_COUNT,
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, the native window server should provide its own shadow for
// windows that could overlap the browser window.
DIALOG_SHADOW = NO_SHADOW,

@ -35,7 +35,7 @@
#include "ui/base/win/shell.h"
#endif
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/views/widget/widget_utils_mac.h"
#else
#include "ui/aura/window.h"
@ -133,7 +133,7 @@ Widget* CreateBubbleWidget(BubbleDialogDelegate* bubble) {
bubble->OnBeforeBubbleWidgetInit(&bubble_params, bubble_widget);
DCHECK(bubble_params.parent || !bubble->has_parent());
bubble_widget->Init(std::move(bubble_params));
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// On Mac, having a parent window creates a permanent stacking order, so
// there's no need to do this. Also, calling StackAbove() on Mac shows the
// bubble implicitly, for which the bubble is currently not ready.
@ -185,7 +185,7 @@ class BubbleDialogDelegate::AnchorViewObserver : public ViewObserver {
// This class is responsible for observing events on a BubbleDialogDelegate's
// anchor widget and notifying the BubbleDialogDelegate of them.
#if defined(OS_APPLE)
#if defined(OS_MAC)
class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver {
#else
class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
@ -196,7 +196,7 @@ class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
AnchorWidgetObserver(BubbleDialogDelegate* owner, Widget* widget)
: owner_(owner) {
widget_observation_.Observe(widget);
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
window_observation_.Observe(widget->GetNativeWindow());
#endif
}
@ -204,7 +204,7 @@ class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
// WidgetObserver:
void OnWidgetDestroying(Widget* widget) override {
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
DCHECK(window_observation_.IsObservingSource(widget->GetNativeWindow()));
window_observation_.Reset();
#endif
@ -222,7 +222,7 @@ class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
owner_->OnAnchorBoundsChanged();
}
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// aura::WindowObserver:
void OnWindowTransformed(aura::Window* window,
ui::PropertyChangeReason reason) override {
@ -242,7 +242,7 @@ class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
BubbleDialogDelegate* owner_;
base::ScopedObservation<views::Widget, views::WidgetObserver>
widget_observation_{this};
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
base::ScopedObservation<aura::Window, aura::WindowObserver>
window_observation_{this};
#endif
@ -472,7 +472,7 @@ void BubbleDialogDelegate::OnAnchorWidgetDestroying() {
}
void BubbleDialogDelegate::OnBubbleWidgetActivationChanged(bool active) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Install |mac_bubble_closer_| the first time the widget becomes active.
if (active && !mac_bubble_closer_) {
mac_bubble_closer_ = std::make_unique<ui::BubbleCloser>(
@ -565,7 +565,7 @@ gfx::Rect BubbleDialogDelegate::GetAnchorRect() const {
anchor_rect_ = GetAnchorView()->GetAnchorBoundsInScreen();
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// GetAnchorBoundsInScreen returns values that take anchor widget's
// translation into account, so undo that here. Without this, features which
// apply transforms on windows such as ChromeOS overview mode will see bubbles
@ -773,7 +773,7 @@ void BubbleDialogDelegate::SetAnchorRect(const gfx::Rect& rect) {
void BubbleDialogDelegate::SizeToContents() {
gfx::Rect bubble_bounds = GetBubbleBounds();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// GetBubbleBounds() doesn't take the Mac NativeWindow's style mask into
// account, so we need to adjust the size.
gfx::Size actual_size =

@ -21,7 +21,7 @@
#include "ui/views/widget/widget_observer.h"
#include "ui/views/window/dialog_delegate.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/base/cocoa/bubble_closer.h"
#endif
@ -351,7 +351,7 @@ class VIEWS_EXPORT BubbleDialogDelegate : public DialogDelegate,
// Pointer to this bubble's ClientView.
ClientView* client_view_ = nullptr;
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Special handler for close_on_deactivate() on Mac. Window (de)activation is
// suppressed by the WindowServer when clicking rapidly, so the bubble must
// monitor clicks as well for the desired behavior.

@ -614,13 +614,13 @@ TEST_F(BubbleDialogDelegateViewTest, VisibleAnchorChanges) {
Widget* bubble_widget =
BubbleDialogDelegateView::CreateBubble(bubble_delegate);
bubble_widget->Show();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// All child widgets make the parent paint as active on Mac.
// See https://crbug.com/1046540
EXPECT_TRUE(anchor_widget->ShouldPaintAsActive());
#else
EXPECT_FALSE(anchor_widget->ShouldPaintAsActive());
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
bubble_delegate->SetAnchorView(anchor_widget->GetContentsView());
EXPECT_TRUE(anchor_widget->ShouldPaintAsActive());

@ -352,7 +352,7 @@ gfx::Size BubbleFrameView::GetMaximumSize() const {
// the OS doesn't give the user controls to resize a bubble.
return gfx::Size();
#else
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Allow BubbleFrameView dialogs to be resizable on Mac.
if (GetWidget()->widget_delegate()->CanResize()) {
gfx::Size client_size = GetWidget()->client_view()->GetMaximumSize();
@ -360,7 +360,7 @@ gfx::Size BubbleFrameView::GetMaximumSize() const {
return client_size;
return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size();
}
#endif // OS_APPLE
#endif // OS_MAC
// Non-dialog bubbles should be non-resizable, so its max size is its
// preferred size.
return GetPreferredSize();

@ -239,7 +239,7 @@ int Button::GetTriggerableEventFlags() const {
void Button::SetRequestFocusOnPress(bool value) {
// On Mac, buttons should not request focus on a mouse press. Hence keep the
// default value i.e. false.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
if (request_focus_on_press_ == value)
return;
request_focus_on_press_ = value;

@ -284,7 +284,7 @@ TEST_F(ButtonTest, HoverStateOnVisibilityChange) {
// Disabling cursor events occurs for touch events and the Ash magnifier. There
// is no touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE) || defined(USE_AURA)
#if !defined(OS_MAC) || defined(USE_AURA)
aura::test::TestCursorClient cursor_client(GetRootWindow(widget()));
// In Aura views, no new hover effects are invoked if mouse events
@ -302,7 +302,7 @@ TEST_F(ButtonTest, HoverStateOnVisibilityChange) {
button()->SetVisible(true);
EXPECT_EQ(Button::STATE_NORMAL, button()->GetState());
#endif // !defined(OS_APPLE) || defined(USE_AURA)
#endif // !defined(OS_MAC) || defined(USE_AURA)
}
// Tests that the hover state is preserved during a view hierarchy update of a
@ -388,7 +388,7 @@ TEST_F(ButtonTest, NotifyActionNoClick) {
}
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE) || defined(USE_AURA)
#if !defined(OS_MAC) || defined(USE_AURA)
namespace {
@ -428,7 +428,7 @@ TEST_F(ButtonTest, GestureEventsRespectDisabledState) {
EXPECT_EQ(Button::STATE_DISABLED, button()->GetState());
}
#endif // !defined(OS_APPLE) || defined(USE_AURA)
#endif // !defined(OS_MAC) || defined(USE_AURA)
// Ensure subclasses of Button are correctly recognized as Button.
TEST_F(ButtonTest, AsButton) {
@ -800,7 +800,7 @@ TEST_F(ButtonTest, ActionOnSpace) {
ui::KeyEvent space_press(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE);
EXPECT_TRUE(button()->OnKeyPressed(space_press));
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_EQ(Button::STATE_NORMAL, button()->GetState());
EXPECT_TRUE(button()->pressed());
#else
@ -810,7 +810,7 @@ TEST_F(ButtonTest, ActionOnSpace) {
ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE);
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_FALSE(button()->OnKeyReleased(space_release));
#else
EXPECT_TRUE(button()->OnKeyReleased(space_release));
@ -830,7 +830,7 @@ TEST_F(ButtonTest, ActionOnReturn) {
ui::KeyEvent return_press(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE);
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_FALSE(button()->OnKeyPressed(return_press));
EXPECT_EQ(Button::STATE_NORMAL, button()->GetState());
EXPECT_FALSE(button()->pressed());

@ -500,7 +500,7 @@ TEST_F(MenuButtonTest, DraggableMenuButtonDoesNotActivateOnDrag) {
#endif // USE_AURA
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE) || defined(USE_AURA)
#if !defined(OS_MAC) || defined(USE_AURA)
// Tests if the callback is notified correctly when a gesture tap happens on a
// MenuButton that has a callback.
@ -547,7 +547,7 @@ TEST_F(MenuButtonTest, TouchFeedbackDuringTapCancel) {
EXPECT_FALSE(button()->clicked());
}
#endif // !defined(OS_APPLE) || defined(USE_AURA)
#endif // !defined(OS_MAC) || defined(USE_AURA)
TEST_F(MenuButtonTest, InkDropHoverWhenShowingMenu) {
ConfigureMenuButton(std::make_unique<PressStateButton>(false));

@ -72,7 +72,7 @@ class TransparentButton : public Button {
~TransparentButton() override = default;
bool OnMousePressed(const ui::MouseEvent& mouse_event) override {
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// On Mac, comboboxes do not take focus on mouse click, but on other
// platforms they do.
parent()->RequestFocus();
@ -104,7 +104,7 @@ class TransparentButton : public Button {
DISALLOW_COPY_AND_ASSIGN(TransparentButton);
};
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Returns the next or previous valid index (depending on |increment|'s value).
// Skips separator or disabled indices. Returns -1 if there is no valid adjacent
// index.
@ -240,7 +240,7 @@ Combobox::Combobox(ui::ComboboxModel* model, int text_context, int text_style)
base::BindRepeating(&Combobox::ArrowButtonPressed,
base::Unretained(this)))) {
SetModel(model);
#if defined(OS_APPLE)
#if defined(OS_MAC)
SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
#else
SetFocusBehavior(FocusBehavior::ALWAYS);
@ -430,7 +430,7 @@ bool Combobox::OnKeyPressed(const ui::KeyEvent& e) {
bool show_menu = false;
int new_index = kNoSelection;
switch (e.key_code()) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
case ui::VKEY_DOWN:
case ui::VKEY_UP:
case ui::VKEY_SPACE:
@ -476,7 +476,7 @@ bool Combobox::OnKeyPressed(const ui::KeyEvent& e) {
case ui::VKEY_SPACE:
show_menu = true;
break;
#endif // OS_APPLE
#endif // OS_MAC
default:
return false;
}

@ -285,7 +285,7 @@ class ComboboxTest : public ViewsTestBase {
DISALLOW_COPY_AND_ASSIGN(ComboboxTest);
};
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Tests whether the various Mac specific keyboard shortcuts invoke the dropdown
// menu or not.
TEST_F(ComboboxTest, KeyTestMac) {
@ -359,7 +359,7 @@ TEST_F(ComboboxTest, DisabilityTest) {
// On Mac, key events can't change the currently selected index directly for a
// combobox.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Tests the behavior of various keyboard shortcuts on the currently selected
// index.
@ -504,7 +504,7 @@ TEST_F(ComboboxTest, SkipMultipleSeparatorsAtEnd) {
PressKey(ui::VKEY_END);
EXPECT_EQ(6, combobox_->GetSelectedIndex());
}
#endif // !OS_APPLE
#endif // !OS_MAC
TEST_F(ComboboxTest, GetTextForRowTest) {
std::set<int> separators;
@ -839,7 +839,7 @@ TEST_F(ComboboxTest, MenuModel) {
EXPECT_EQ(ui::MenuModel::TYPE_SEPARATOR,
menu_model->GetTypeAt(kSeparatorIndex));
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Comboboxes on Mac should have checkmarks, with the selected item checked,
EXPECT_EQ(ui::MenuModel::TYPE_CHECK, menu_model->GetTypeAt(0));
EXPECT_EQ(ui::MenuModel::TYPE_CHECK, menu_model->GetTypeAt(1));

@ -198,7 +198,7 @@ void EditableComboboxTest::InitWidget() {
container->AddChildView(dummy_focusable_view_);
widget_->Show();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// The event loop needs to be flushed here, otherwise in various tests:
// 1. The actual showing of the native window backing the widget gets delayed
// until a spin of the event loop.
@ -270,7 +270,7 @@ void EditableComboboxTest::SendKeyEvent(ui::KeyboardCode key_code,
const bool alt,
const bool shift,
const bool ctrl_cmd) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
bool command = ctrl_cmd;
bool control = false;
#else
@ -407,7 +407,7 @@ TEST_F(EditableComboboxTest, EndOrHomeMovesToBeginningOrEndOfText) {
EXPECT_EQ(u"xabcy", combobox_->GetText());
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
TEST_F(EditableComboboxTest, AltLeftOrRightMovesToNextWords) {
InitEditableCombobox();

@ -51,7 +51,7 @@ namespace views {
namespace {
#if defined(OS_APPLE)
#if defined(OS_MAC)
const int kControlCommandModifier = ui::EF_COMMAND_DOWN;
#else
const int kControlCommandModifier = ui::EF_CONTROL_DOWN;
@ -789,8 +789,8 @@ TEST_F(LabelTest, MultiLineSizing) {
required_size.width() + border.width());
}
#if !defined(OS_APPLE)
// TODO(warx): Remove !defined(OS_APPLE) once SetMaxLines() is applied to MAC
#if !defined(OS_MAC)
// TODO(warx): Remove !defined(OS_MAC) once SetMaxLines() is applied to MAC
// (crbug.com/758720).
TEST_F(LabelTest, MultiLineSetMaxLines) {
// Ensure SetMaxLines clamps the line count of a string with returns.

@ -221,7 +221,7 @@ void Link::ConfigureFocus() {
if (GetText().empty()) {
SetFocusBehavior(FocusBehavior::NEVER);
} else {
#if defined(OS_APPLE)
#if defined(OS_MAC)
SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
#else
SetFocusBehavior(FocusBehavior::ALWAYS);

@ -77,7 +77,7 @@ namespace views {
namespace {
#if defined(OS_APPLE)
#if defined(OS_MAC)
bool AcceleratorShouldCancelMenu(const ui::Accelerator& accelerator) {
// Since AcceleratorShouldCancelMenu() is called quite early in key
// event handling, it is actually invoked for modifier keys themselves
@ -522,7 +522,7 @@ void MenuController::Run(Widget* parent,
menu_pre_target_handler_ = MenuPreTargetHandler::Create(this, owner_);
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
menu_cocoa_watcher_ = std::make_unique<MenuCocoaWatcherMac>(base::BindOnce(
&MenuController::Cancel, this->AsWeakPtr(), ExitType::kAll));
#endif
@ -554,7 +554,7 @@ void MenuController::Run(Widget* parent,
}
void MenuController::Cancel(ExitType type) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
menu_closure_animation_.reset();
#endif
@ -1205,7 +1205,7 @@ ui::PostDispatchAction MenuController::OnWillDispatchKeyEvent(
base::WeakPtr<MenuController> this_ref = AsWeakPtr();
if (event->type() == ui::ET_KEY_PRESSED) {
bool key_handled = false;
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Special handling for Option-Up and Option-Down, which should behave like
// Home and End respectively in menus.
if ((event->flags() & ui::EF_ALT_DOWN)) {
@ -1252,7 +1252,7 @@ ui::PostDispatchAction MenuController::OnWillDispatchKeyEvent(
ui::Accelerator accelerator(*event);
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (AcceleratorShouldCancelMenu(accelerator)) {
Cancel(ExitType::kAll);
return ui::POST_DISPATCH_PERFORM_DEFAULT;
@ -1319,7 +1319,7 @@ void MenuController::TurnOffMenuSelectionHoldForTest() {
}
void MenuController::OnMenuItemDestroying(MenuItemView* menu_item) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (menu_closure_animation_ && menu_closure_animation_->item() == menu_item)
menu_closure_animation_.reset();
#endif
@ -1564,7 +1564,7 @@ bool MenuController::OnKeyPressed(const ui::KeyEvent& event) {
break;
// On Mac, treat space the same as return.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
case ui::VKEY_SPACE:
SendAcceleratorToHotTrackedView(event.flags());
break;
@ -1576,7 +1576,7 @@ bool MenuController::OnKeyPressed(const ui::KeyEvent& event) {
// Fallthrough to accept or dismiss combobox menus on F4, like windows.
FALLTHROUGH;
case ui::VKEY_RETURN:
#if defined(OS_APPLE)
#if defined(OS_MAC)
case ui::VKEY_SPACE:
#endif
// An odd special case: if a prefix selection is in flight, space should
@ -1620,7 +1620,7 @@ bool MenuController::OnKeyPressed(const ui::KeyEvent& event) {
CloseSubmenu();
break;
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
case ui::VKEY_APPS: {
Button* hot_view = GetFirstHotTrackedView(pending_state_.item);
if (hot_view) {
@ -1728,7 +1728,7 @@ void MenuController::UpdateInitialLocation(const gfx::Rect& bounds,
}
void MenuController::Accept(MenuItemView* item, int event_flags) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
menu_closure_animation_ = std::make_unique<MenuClosureAnimationMac>(
item, item->GetParentMenuItem()->GetSubmenu(),
base::BindOnce(&MenuController::ReallyAccept, base::Unretained(this),
@ -1742,7 +1742,7 @@ void MenuController::Accept(MenuItemView* item, int event_flags) {
void MenuController::ReallyAccept(MenuItemView* item, int event_flags) {
DCHECK(!for_drop_);
result_ = item;
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Reset the closure animation since it's now finished - this also unblocks
// input events for the menu.
menu_closure_animation_.reset();
@ -2915,7 +2915,7 @@ void MenuController::RepostEventAndCancel(SubmenuView* source,
if (last_part.type != MenuPart::Type::kNone)
exit_type = ExitType::kOutermost;
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
// When doing a menu closure animation, target the deepest submenu - that way
// MenuClosureAnimationMac will fade out all the menus in sync, rather than
// the shallowest menu only.
@ -3243,7 +3243,7 @@ void MenuController::UnregisterAlertedItem(MenuItemView* item) {
}
bool MenuController::CanProcessInputEvents() const {
#if defined(OS_APPLE)
#if defined(OS_MAC)
return !menu_closure_animation_;
#else
return true;

@ -29,7 +29,7 @@
#include "ui/views/controls/menu/menu_delegate.h"
#include "ui/views/widget/widget_observer.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/views/controls/menu/menu_closure_animation_mac.h"
#include "ui/views/controls/menu/menu_cocoa_watcher_mac.h"
#endif
@ -778,7 +778,7 @@ class VIEWS_EXPORT MenuController
// A mask of the EventFlags for the mouse buttons currently pressed.
int current_mouse_pressed_state_ = 0;
#if defined(OS_APPLE)
#if defined(OS_MAC)
std::unique_ptr<MenuClosureAnimationMac> menu_closure_animation_;
std::unique_ptr<MenuCocoaWatcherMac> menu_cocoa_watcher_;
#endif

@ -2795,7 +2795,7 @@ TEST_F(MenuControllerTest, AccessibilityEmitsSelectChildrenChanged) {
EXPECT_EQ(ax_counter.GetCount(ax::mojom::Event::kSelectedChildrenChanged), 2);
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
// This test exercises a Mac-specific behavior, by which hotkeys using modifiers
// cause menus to close and the hotkeys to be handled by the browser window.
// This specific test case tries using cmd-ctrl-f, which normally means

@ -24,7 +24,7 @@
#include "ui/views/widget/native_widget_private.h"
#include "ui/views/widget/widget.h"
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
#include "ui/aura/window.h"
#endif
@ -32,7 +32,7 @@ namespace views {
namespace internal {
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// This class adds itself as the pre target handler for the |window|
// passed in. It currently handles touch events and forwards them to the
// controller. Reason for this approach is views does not get raw touch
@ -79,7 +79,7 @@ class PreMenuEventDispatchHandler : public ui::EventHandler,
DISALLOW_COPY_AND_ASSIGN(PreMenuEventDispatchHandler);
};
#endif // OS_APPLE
#endif // OS_MAC
void TransferGesture(ui::GestureRecognizer* gesture_recognizer,
gfx::NativeView source,
@ -145,7 +145,7 @@ void MenuHost::InitMenuHost(Widget* parent,
#endif
Init(std::move(params));
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
pre_dispatch_handler_ =
std::make_unique<internal::PreMenuEventDispatchHandler>(
menu_controller, submenu_, GetNativeView());
@ -215,7 +215,7 @@ void MenuHost::DestroyMenuHost() {
HideMenuHost();
destroying_ = true;
static_cast<MenuHostRootView*>(GetRootView())->ClearSubmenu();
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
pre_dispatch_handler_.reset();
#endif
Close();

@ -98,7 +98,7 @@ class MenuHost : public Widget, public WidgetObserver {
// If true and capture is lost we don't notify the delegate.
bool ignore_capture_lost_;
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Handles raw touch events at the moment.
std::unique_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_;
#endif

@ -53,9 +53,9 @@
#include "ui/views/views_features.h"
#include "ui/views/widget/widget.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/views/accessibility/view_accessibility.h"
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
namespace views {
@ -406,7 +406,7 @@ SubmenuView* MenuItemView::CreateSubmenu() {
if (!submenu_) {
submenu_ = new SubmenuView(this);
#if defined(OS_APPLE)
#if defined(OS_MAC)
// All MenuItemViews of Type kSubMenu have a respective SubmenuView.
// However, in the Views hierarchy, this SubmenuView is not a child of the
// MenuItemView. This confuses VoiceOver, because it expects the submenu
@ -416,7 +416,7 @@ SubmenuView* MenuItemView::CreateSubmenu() {
std::make_unique<AXVirtualView>();
virtual_child->GetCustomData().role = ax::mojom::Role::kMenu;
GetViewAccessibility().AddVirtualChildView(std::move(virtual_child));
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
// Initialize the submenu indicator icon (arrow).
submenu_arrow_image_view_ = AddChildView(std::make_unique<ImageView>());

@ -73,7 +73,7 @@ bool IsAltPressed() {
namespace internal {
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
MenuRunnerImplInterface* MenuRunnerImplInterface::Create(
ui::MenuModel* menu_model,
int32_t run_types,
@ -270,7 +270,7 @@ bool MenuRunnerImpl::ShouldShowMnemonics(int32_t run_types) {
show_mnemonics |= ui::win::IsAltPressed();
#elif defined(USE_X11) || defined(USE_OZONE)
show_mnemonics |= IsAltPressed();
#elif defined(OS_APPLE)
#elif defined(OS_MAC)
show_mnemonics = false;
#endif
return show_mnemonics;

@ -266,7 +266,7 @@ TEST_F(MenuRunnerTest, PrefixSelect) {
// This test is Mac-specific: Mac is the only platform where VKEY_SPACE
// activates menu items.
#if defined(OS_APPLE)
#if defined(OS_MAC)
TEST_F(MenuRunnerTest, SpaceActivatesItem) {
if (!MenuConfig::instance().all_menus_use_prefix_selection)
return;
@ -291,7 +291,7 @@ TEST_F(MenuRunnerTest, SpaceActivatesItem) {
EXPECT_EQ(1, delegate->on_menu_closed_called());
EXPECT_NE(nullptr, delegate->on_menu_closed_menu());
}
#endif // OS_APPLE
#endif // OS_MAC
// Tests that attempting to nest a menu within a drag-and-drop menu does not
// cause a crash. Instead the drag and drop action should be canceled, and the

@ -17,7 +17,7 @@
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_utils.h"
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
#include "ui/aura/window.h"
#endif
@ -147,7 +147,7 @@ void ResizeAreaTest::TearDown() {
}
// TODO(tdanderson): Enable these tests on OSX. See crbug.com/710475.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Verifies the correct calls have been made to
// TestResizeAreaDelegate::OnResize() for a sequence of mouse events
// corresponding to a successful resize operation.
@ -201,6 +201,6 @@ TEST_F(ResizeAreaTest, NoDragOnGestureTap) {
EXPECT_EQ(0, resize_amount());
}
#endif // !defined(OS_APPLE)
#endif // !defined(OS_MAC)
} // namespace views

@ -489,7 +489,7 @@ void ScrollView::Layout() {
// if its OverlapsContent matches other bar's.
if (horizontal_scroll_bar_mode_ == ScrollBarMode::kEnabled &&
vertical_scroll_bar_mode_ == ScrollBarMode::kEnabled) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, scrollbars may update their style one at a time, so they may
// temporarily be of different types. Refuse to lay out at this point.
if (horiz_sb_->OverlapsContent() != vert_sb_->OverlapsContent())

@ -30,7 +30,7 @@
#include "ui/views/test/widget_test.h"
#include "ui/views/view_test_api.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/base/test/scoped_preferred_scroller_style_mac.h"
#endif
@ -247,7 +247,7 @@ class ScrollViewTest : public ViewsTestBase {
}
protected:
#if defined(OS_APPLE)
#if defined(OS_MAC)
void SetOverlayScrollersEnabled(bool enabled) {
// Ensure the old scroller override is destroyed before creating a new one.
// Otherwise, the swizzlers are interleaved and restore incorrect methods.
@ -295,7 +295,7 @@ class WidgetScrollViewTest : public test::WidgetTest,
// Adds a ScrollView with the given |contents_view| and does layout.
ScrollView* AddScrollViewWithContents(std::unique_ptr<View> contents,
bool commit_layers = true) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
scroller_style_ = std::make_unique<ui::test::ScopedPreferredScrollerStyle>(
use_overlay_scrollers_);
#endif
@ -371,7 +371,7 @@ class WidgetScrollViewTest : public test::WidgetTest,
base::RepeatingClosure quit_closure_;
#if defined(OS_APPLE)
#if defined(OS_MAC)
std::unique_ptr<ui::test::ScopedPreferredScrollerStyle> scroller_style_;
#endif
@ -1185,7 +1185,7 @@ TEST_F(ScrollViewTest, DontCreateLayerOnViewportIfLayerOnScrollViewCreated) {
EXPECT_FALSE(test_api.contents_viewport()->layer());
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Tests the overlay scrollbars on Mac. Ensure that they show up properly and
// do not overlap each other.
TEST_F(ScrollViewTest, CocoaOverlayScrollBars) {
@ -1351,7 +1351,7 @@ TEST_F(WidgetScrollViewTest, ScrollersOnRest) {
EXPECT_EQ(gfx::ScrollOffset(x_offset, y_offset), test_api.CurrentOffset());
}
#endif // OS_APPLE
#endif // OS_MAC
// Test that increasing the size of the viewport "below" scrolled content causes
// the content to scroll up so that it still fills the viewport.

@ -391,7 +391,7 @@ ScrollBar::ScrollBar(bool is_horiz)
///////////////////////////////////////////////////////////////////////////////
// ScrollBar, private:
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// static
base::RetainingOneShotTimer* ScrollBar::GetHideTimerForTesting(
ScrollBar* scroll_bar) {

@ -220,7 +220,7 @@ TEST_F(ScrollBarViewsTest, RightClickOpensMenu) {
EXPECT_NE(nullptr, scrollbar_->menu_runner_);
}
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
TEST_F(ScrollBarViewsTest, TestPageScrollingByPress) {
ui::test::EventGenerator generator(GetRootWindow(widget_.get()));
EXPECT_EQ(0, scrollbar_->GetPosition());

@ -74,7 +74,7 @@ float GetNearestAllowedValue(const base::flat_set<float>& allowed_values,
Slider::Slider(SliderListener* listener) : listener_(listener) {
highlight_animation_.SetSlideDuration(base::TimeDelta::FromMilliseconds(150));
SetFlipCanvasOnPaintForRTLUI(true);
#if defined(OS_APPLE)
#if defined(OS_MAC)
SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
#else
SetFocusBehavior(FocusBehavior::ALWAYS);

@ -287,7 +287,7 @@ TEST_P(SliderTest, NukeAllowedValues) {
}
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE) || defined(USE_AURA)
#if !defined(OS_MAC) || defined(USE_AURA)
// Test the slider location after a tap gesture.
TEST_P(SliderTest, SliderValueForTapGesture) {
@ -460,7 +460,7 @@ TEST_P(SliderTest, SliderRaisesA11yEvents) {
EXPECT_EQ(1, ax_counter.GetCount(ax::mojom::Event::kValueChanged));
}
#endif // !defined(OS_APPLE) || defined(USE_AURA)
#endif // !defined(OS_MAC) || defined(USE_AURA)
INSTANTIATE_TEST_SUITE_P(All,
SliderTest,

@ -78,7 +78,7 @@ void Tab::SetSelected(bool selected) {
contents_->SetVisible(selected);
contents_->parent()->InvalidateLayout();
SetState(selected ? State::kActive : State::kInactive);
#if defined(OS_APPLE)
#if defined(OS_MAC)
SetFocusBehavior(selected ? FocusBehavior::ACCESSIBLE_ONLY
: FocusBehavior::NEVER);
#else

@ -86,7 +86,7 @@ ui::NativeTheme::ColorId selected_text_color_id(bool has_focus) {
// Whether the platform "command" key is down.
bool IsCmdOrCtrl(const ui::Event& event) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
return event.IsCommandDown();
#else
return event.IsControlDown();
@ -503,7 +503,7 @@ bool TableView::OnKeyPressed(const ui::KeyEvent& event) {
return true;
case ui::VKEY_UP:
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (event.IsAltDown()) {
if (GetRowCount())
SelectByViewIndex(0);
@ -516,7 +516,7 @@ bool TableView::OnKeyPressed(const ui::KeyEvent& event) {
return true;
case ui::VKEY_DOWN:
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (event.IsAltDown()) {
if (GetRowCount())
SelectByViewIndex(GetRowCount() - 1);

@ -132,7 +132,7 @@ class TableViewTestHelper {
namespace {
#if defined(OS_APPLE)
#if defined(OS_MAC)
constexpr int kCtrlOrCmdMask = ui::EF_COMMAND_DOWN;
#else
constexpr int kCtrlOrCmdMask = ui::EF_CONTROL_DOWN;
@ -1465,7 +1465,7 @@ TEST_P(TableViewTest, SelectionNoSelectOnRemove) {
}
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Verifies selection works by way of a gesture.
TEST_P(TableViewTest, SelectOnTap) {
// Initially no selection.

@ -87,7 +87,7 @@
#include "ui/wm/core/ime_util_chromeos.h"
#endif
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/base/cocoa/defaults_utils.h"
#include "ui/base/cocoa/secure_password_input.h"
#endif
@ -211,7 +211,7 @@ base::TimeDelta Textfield::GetCaretBlinkInterval() {
? base::TimeDelta()
: base::TimeDelta::FromMilliseconds(system_value);
}
#elif defined(OS_APPLE)
#elif defined(OS_MAC)
base::TimeDelta system_value;
if (ui::TextInsertionCaretBlinkPeriod(&system_value))
return system_value;
@ -242,7 +242,7 @@ Textfield::Textfield()
if (use_focus_ring_)
focus_ring_ = FocusRing::Install(this);
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Do not map accelerators on Mac. E.g. They might not reflect custom
// keybindings that a user has set. But also on Mac, these commands dispatch
// via the "responder chain" when the OS searches through menu items in the
@ -1079,11 +1079,11 @@ void Textfield::OnFocus() {
if (focus_reason_ == ui::TextInputClient::FOCUS_REASON_NONE)
focus_reason_ = ui::TextInputClient::FOCUS_REASON_OTHER;
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD)
password_input_enabler_ =
std::make_unique<ui::ScopedPasswordInputEnabler>();
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
GetRenderText()->set_focused(true);
if (GetInputMethod())
@ -1118,9 +1118,9 @@ void Textfield::OnBlur() {
SchedulePaint();
View::OnBlur();
#if defined(OS_APPLE)
#if defined(OS_MAC)
password_input_enabler_.reset();
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
}
gfx::Point Textfield::GetKeyboardContextMenuLocation() {
@ -1732,7 +1732,7 @@ bool Textfield::IsTextEditCommandEnabled(ui::TextEditCommand command) const {
case ui::TextEditCommand::SCROLL_PAGE_UP:
// On Mac, the textfield should respond to Up/Down arrows keys and
// PageUp/PageDown.
#if defined(OS_APPLE)
#if defined(OS_MAC)
return true;
#else
return GetRenderText()->multiline();
@ -2163,7 +2163,7 @@ ui::TextEditCommand Textfield::GetCommandForKeyEvent(
return ui::TextEditCommand::INVALID_COMMAND;
const bool shift = event.IsShiftDown();
#if defined(OS_APPLE)
#if defined(OS_MAC)
const bool command = event.IsCommandDown();
#endif
const bool control = event.IsControlDown() || event.IsCommandDown();
@ -2214,7 +2214,7 @@ ui::TextEditCommand Textfield::GetCommandForKeyEvent(
return ui::TextEditCommand::
MOVE_TO_BEGINNING_OF_LINE_AND_MODIFY_SELECTION;
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
return ui::TextEditCommand::SCROLL_TO_BEGINNING_OF_DOCUMENT;
#else
return ui::TextEditCommand::MOVE_TO_BEGINNING_OF_LINE;
@ -2222,13 +2222,13 @@ ui::TextEditCommand Textfield::GetCommandForKeyEvent(
case ui::VKEY_END:
if (shift)
return ui::TextEditCommand::MOVE_TO_END_OF_LINE_AND_MODIFY_SELECTION;
#if defined(OS_APPLE)
#if defined(OS_MAC)
return ui::TextEditCommand::SCROLL_TO_END_OF_DOCUMENT;
#else
return ui::TextEditCommand::MOVE_TO_END_OF_LINE;
#endif
case ui::VKEY_UP:
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (control && shift) {
return ui::TextEditCommand::
MOVE_PARAGRAPH_BACKWARD_AND_MODIFY_SELECTION;
@ -2244,7 +2244,7 @@ ui::TextEditCommand Textfield::GetCommandForKeyEvent(
: ui::TextEditCommand::INVALID_COMMAND;
#endif
case ui::VKEY_DOWN:
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (control && shift) {
return ui::TextEditCommand::MOVE_PARAGRAPH_FORWARD_AND_MODIFY_SELECTION;
}

@ -53,11 +53,11 @@ namespace base {
class TimeDelta;
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
namespace ui {
class ScopedPasswordInputEnabler;
}
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
namespace views {
@ -85,7 +85,7 @@ class VIEWS_EXPORT Textfield : public View,
kLastCommandId = kSelectAll,
};
#if defined(OS_APPLE)
#if defined(OS_MAC)
static constexpr gfx::SelectionBehavior kLineSelectionBehavior =
gfx::SELECTION_EXTEND;
static constexpr gfx::SelectionBehavior kWordSelectionBehavior =
@ -756,10 +756,10 @@ class VIEWS_EXPORT Textfield : public View,
// View containing the text cursor.
View* cursor_view_ = nullptr;
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Used to track active password input sessions.
std::unique_ptr<ui::ScopedPasswordInputEnabler> password_input_enabler_;
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
// How this textfield was focused.
ui::TextInputClient::FocusReason focus_reason_ =

@ -236,7 +236,7 @@ TEST_F(TextfieldModelTest, EditString_ComplexScript) {
model.SetText(u"ABC\xFF80\xFF9E", 0);
model.MoveCursorTo(model.text().length());
model.Backspace();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, the entire cluster should be deleted to match
// NSTextField behavior.
EXPECT_EQ(u"ABC", model.text());
@ -251,7 +251,7 @@ TEST_F(TextfieldModelTest, EditString_ComplexScript) {
model.SetText(u"\U0001F466\U0001F3FE", 0);
model.MoveCursorTo(model.text().length());
model.Backspace();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, the entire emoji should be deleted to match NSTextField
// behavior.
EXPECT_EQ(u"", model.text());

@ -72,7 +72,7 @@
#include "ui/wm/core/ime_util_chromeos.h"
#endif
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/base/cocoa/secure_password_input.h"
#include "ui/base/cocoa/text_services_context_menu.h"
#endif
@ -218,7 +218,7 @@ ui::EventDispatchDetails MockInputMethod::DispatchKeyEvent(ui::KeyEvent* key) {
// On Mac, emulate InputMethodMac behavior for character events. Composition
// still needs to be mocked, since it's not possible to generate test events
// which trigger the appropriate NSResponder action messages for composition.
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (key->is_char())
return DispatchKeyEventPostIME(key);
#endif
@ -335,7 +335,7 @@ class TestTextfield : public views::Textfield {
// ui::TextInputClient:
void InsertChar(const ui::KeyEvent& e) override {
views::Textfield::InsertChar(e);
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, characters are inserted directly rather than attempting to get a
// unicode character from the ui::KeyEvent (which isn't always possible).
key_received_ = true;
@ -498,7 +498,7 @@ ui::MenuModel* TextfieldTest::GetContextMenuModel() {
}
bool TextfieldTest::TestingNativeMac() const {
#if defined(OS_APPLE)
#if defined(OS_MAC)
return true;
#else
return false;
@ -574,7 +574,7 @@ void TextfieldTest::SendKeyEvent(char16_t ch, int flags, bool from_vk) {
std::vector<uint8_t>(ui::kPropertyFromVKSize);
event.SetProperties(properties);
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
event_generator_->Dispatch(&event);
#else
input_method_->DispatchKeyEvent(&event);
@ -724,7 +724,7 @@ void TextfieldTest::VerifyTextfieldContextMenuContents(
int menu_index = 0;
#if defined(OS_APPLE)
#if defined(OS_MAC)
if (textfield_has_selection) {
EXPECT_TRUE(menu->IsEnabledAt(menu_index++ /* Look Up "Selection" */));
EXPECT_TRUE(menu->IsEnabledAt(menu_index++ /* Separator */));
@ -977,7 +977,7 @@ TEST_F(TextfieldTest, KeyTestControlModifier) {
}
#endif
#if defined(OS_WIN) || defined(OS_APPLE)
#if defined(OS_WIN) || defined(OS_MAC)
#define MAYBE_KeysWithModifiersTest KeysWithModifiersTest
#else
// TODO(crbug.com/645104): Implement keyboard layout changing for other
@ -1061,7 +1061,7 @@ TEST_F(TextfieldTest, ControlAndSelectTest) {
SendHomeEvent(true);
// On Mac, the existing selection should be extended.
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_STR_EQ("ZERO two three", textfield_->GetSelectedText());
#else
EXPECT_STR_EQ("ZERO ", textfield_->GetSelectedText());
@ -1092,7 +1092,7 @@ TEST_F(TextfieldTest, WordSelection) {
// On Mac, the selection should reduce to a caret when the selection direction
// changes for a word selection.
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_EQ(gfx::Range(6), textfield_->GetSelectedRange());
#else
EXPECT_STR_EQ("345", textfield_->GetSelectedText());
@ -1100,7 +1100,7 @@ TEST_F(TextfieldTest, WordSelection) {
#endif
SendWordEvent(ui::VKEY_LEFT, true);
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_STR_EQ("345", textfield_->GetSelectedText());
#else
EXPECT_STR_EQ("12 345", textfield_->GetSelectedText());
@ -1125,7 +1125,7 @@ TEST_F(TextfieldTest, LineSelection) {
// Select line towards left. On Mac, the existing selection should be extended
// to cover the whole line.
SendHomeEvent(true);
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_EQ(textfield_->GetText(), textfield_->GetSelectedText());
#else
EXPECT_STR_EQ("12 345", textfield_->GetSelectedText());
@ -1134,7 +1134,7 @@ TEST_F(TextfieldTest, LineSelection) {
// Select line towards right.
SendEndEvent(true);
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_EQ(textfield_->GetText(), textfield_->GetSelectedText());
#else
EXPECT_STR_EQ("67 89", textfield_->GetSelectedText());
@ -1151,7 +1151,7 @@ TEST_F(TextfieldTest, MoveUpDownAndModifySelection) {
// commands.
SendKeyEvent(ui::VKEY_UP);
EXPECT_TRUE(textfield_->key_received());
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_TRUE(textfield_->key_handled());
EXPECT_EQ(gfx::Range(0), textfield_->GetSelectedRange());
#else
@ -1161,7 +1161,7 @@ TEST_F(TextfieldTest, MoveUpDownAndModifySelection) {
SendKeyEvent(ui::VKEY_DOWN);
EXPECT_TRUE(textfield_->key_received());
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_TRUE(textfield_->key_handled());
EXPECT_EQ(gfx::Range(11), textfield_->GetSelectedRange());
#else
@ -1191,7 +1191,7 @@ TEST_F(TextfieldTest, MovePageUpDownAndModifySelection) {
// MOVE_PAGE_[UP/DOWN] and the associated selection commands should only be
// enabled on Mac.
#if defined(OS_APPLE)
#if defined(OS_MAC)
textfield_->SetText(u"12 34567 89");
textfield_->SetEditableSelectionRange(gfx::Range(6));
@ -1243,7 +1243,7 @@ TEST_F(TextfieldTest, MoveParagraphForwardBackwardAndModifySelection) {
ui::TextEditCommand::MOVE_PARAGRAPH_BACKWARD_AND_MODIFY_SELECTION);
// On Mac, the selection should reduce to a caret when the selection direction
// is reversed for MOVE_PARAGRAPH_[FORWARD/BACKWARD]_AND_MODIFY_SELECTION.
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_EQ(gfx::Range(6), textfield_->GetSelectedRange());
#else
EXPECT_EQ(gfx::Range(6, 0), textfield_->GetSelectedRange());
@ -1255,7 +1255,7 @@ TEST_F(TextfieldTest, MoveParagraphForwardBackwardAndModifySelection) {
test_api_->ExecuteTextEditCommand(
ui::TextEditCommand::MOVE_PARAGRAPH_FORWARD_AND_MODIFY_SELECTION);
#if defined(OS_APPLE)
#if defined(OS_MAC)
EXPECT_EQ(gfx::Range(6), textfield_->GetSelectedRange());
#else
EXPECT_EQ(gfx::Range(6, 11), textfield_->GetSelectedRange());
@ -1465,7 +1465,7 @@ TEST_F(TextfieldTest, TextInputType_InsertionTest) {
SendKeyEvent(ui::VKEY_A);
EXPECT_EQ(-1, textfield_->GetPasswordCharRevealIndex());
SendKeyEvent(kHebrewLetterSamekh, ui::EF_NONE, true /* from_vk */);
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Don't verifies the password character reveal on MacOS, because on MacOS,
// the text insertion is not done through TextInputClient::InsertChar().
EXPECT_EQ(1, textfield_->GetPasswordCharRevealIndex());
@ -2416,7 +2416,7 @@ TEST_F(TextfieldTest, UndoRedoTest) {
// Ctrl+Y is bound to "Yank" and Cmd+Y is bound to "Show full history". So, on
// Mac, Cmd+Shift+Z is sent for the tests above and the Ctrl+Y test below is
// skipped.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Test that Ctrl+Y works for Redo, as well as Ctrl+Shift+Z.
TEST_F(TextfieldTest, RedoWithCtrlY) {
@ -2433,11 +2433,11 @@ TEST_F(TextfieldTest, RedoWithCtrlY) {
EXPECT_STR_EQ("a", textfield_->GetText());
}
#endif // !defined(OS_APPLE)
#endif // !defined(OS_MAC)
// Non-Mac platforms don't have a key binding for Yank. Since this test is only
// run on Mac, it uses some Mac specific key bindings.
#if defined(OS_APPLE)
#if defined(OS_MAC)
TEST_F(TextfieldTest, Yank) {
InitTextfield(2);
@ -2496,7 +2496,7 @@ TEST_F(TextfieldTest, Yank) {
EXPECT_STR_EQ("efabefeef", textfield_->GetText());
}
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
TEST_F(TextfieldTest, CutCopyPaste) {
InitTextfield();
@ -3567,7 +3567,7 @@ TEST_F(TextfieldTouchSelectionTest, TouchSelectionInUnfocusableTextfield) {
}
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if defined(OS_APPLE)
#if defined(OS_MAC)
#define MAYBE_TapOnSelection DISABLED_TapOnSelection
#else
#define MAYBE_TapOnSelection TapOnSelection
@ -3839,7 +3839,7 @@ TEST_F(TextfieldTest, EmojiItem_FieldWithText) {
InitTextfield();
EXPECT_TRUE(textfield_->context_menu_controller());
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, when there is text, the "Look up" item (+ separator) takes the top
// position, and emoji comes after.
constexpr int kExpectedEmojiIndex = 2;
@ -3859,7 +3859,7 @@ TEST_F(TextfieldTest, EmojiItem_FieldWithText) {
l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_EMOJI));
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Tests to see if the BiDi submenu items are updated correctly when the
// textfield's text direction is changed.
TEST_F(TextfieldTest, TextServicesContextMenuTextDirectionTest) {
@ -3926,7 +3926,7 @@ TEST_F(TextfieldTest, SecurePasswordInput) {
textfield_->OnBlur();
EXPECT_FALSE(ui::ScopedPasswordInputEnabler::IsPasswordInputEnabled());
}
#endif // defined(OS_APPLE)
#endif // defined(OS_MAC)
TEST_F(TextfieldTest, AccessibilitySelectionEvents) {
const std::string& kText = "abcdef";
@ -4115,7 +4115,7 @@ TEST_F(TextfieldTest, ScrollCommands) {
InitTextfield();
// Scroll commands are only available on Mac.
#if defined(OS_APPLE)
#if defined(OS_MAC)
textfield_->SetText(u"12 34567 89");
textfield_->SetEditableSelectionRange(gfx::Range(6));

@ -84,7 +84,7 @@ TreeView::TreeView()
drawing_provider_(std::make_unique<TreeViewDrawingProvider>()) {
// Always focusable, even on Mac (consistent with NSOutlineView).
SetFocusBehavior(FocusBehavior::ALWAYS);
#if defined(OS_APPLE)
#if defined(OS_MAC)
constexpr bool kUseMdIcons = true;
#else
constexpr bool kUseMdIcons = false;

@ -50,7 +50,7 @@ bool ViewsTextServicesContextMenuBase::GetAcceleratorForCommandId(
#if defined(OS_WIN)
*accelerator = ui::Accelerator(ui::VKEY_OEM_PERIOD, ui::EF_COMMAND_DOWN);
return true;
#elif defined(OS_APPLE)
#elif defined(OS_MAC)
*accelerator = ui::Accelerator(ui::VKEY_SPACE,
ui::EF_COMMAND_DOWN | ui::EF_CONTROL_DOWN);
return true;
@ -85,7 +85,7 @@ bool ViewsTextServicesContextMenuBase::SupportsCommand(int command_id) const {
return command_id == IDS_CONTENT_CONTEXT_EMOJI;
}
#if !defined(OS_APPLE) && !BUILDFLAG(IS_CHROMEOS_ASH)
#if !defined(OS_MAC) && !BUILDFLAG(IS_CHROMEOS_ASH)
// static
std::unique_ptr<ViewsTextServicesContextMenu>
ViewsTextServicesContextMenu::Create(ui::SimpleMenuModel* menu,

@ -34,7 +34,7 @@ class VIEWS_EXPORT ViewsTextServicesContextMenuBase
bool SupportsCommand(int command_id) const override;
protected:
#if defined(OS_APPLE) || BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_MAC) || BUILDFLAG(IS_CHROMEOS_ASH)
Textfield* client() { return client_; }
const Textfield* client() const { return client_; }
#endif

@ -317,7 +317,7 @@ void DialogExample::ContentsChanged(Textfield* sender,
void DialogExample::OnPerformAction() {
bool enable = bubble_->GetChecked() || GetModalType() != ui::MODAL_TYPE_CHILD;
#if defined(OS_APPLE)
#if defined(OS_MAC)
enable = enable && GetModalType() != ui::MODAL_TYPE_SYSTEM;
#endif
show_->SetEnabled(enable);

@ -13,7 +13,7 @@
#include "ui/views/examples/examples_window_with_content.h"
#include "ui/views_content_client/views_content_client.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "sandbox/mac/seatbelt_exec.h"
#endif
@ -69,7 +69,7 @@ int main(int argc, const char** argv) {
if (views::examples::CheckCommandLineUsage())
return 0;
#if defined(OS_APPLE)
#if defined(OS_MAC)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
// ViewsContentClient expects a const char** argv and
// CreateFromArgumentsResult expects a regular char** argv. Given this is a

@ -343,9 +343,9 @@ void FocusManager::SetFocusedViewWithReason(View* view,
// Change this to DCHECK once it's resolved.
CHECK(!view || ContainsView(view));
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// TODO(warx): There are some AccessiblePaneViewTest failed on macosx.
// crbug.com/650859. Remove !defined(OS_APPLE) once that is fixed.
// crbug.com/650859. Remove !defined(OS_MAC) once that is fixed.
//
// If the widget isn't active store the focused view and then attempt to
// activate the widget. If activation succeeds |view| will be focused.
@ -532,7 +532,7 @@ bool FocusManager::ProcessAccelerator(const ui::Accelerator& accelerator) {
if (delegate_ && delegate_->ProcessAccelerator(accelerator))
return true;
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On MacOS accelerators are processed when a bubble is opened without
// manual redirection to bubble anchor widget. Including redirect on MacOS
// breaks processing accelerators by the bubble itself.
@ -597,7 +597,7 @@ bool FocusManager::IsFocusable(View* view) const {
DCHECK(view);
// |keyboard_accessible_| is only used on Mac.
#if defined(OS_APPLE)
#if defined(OS_MAC)
return keyboard_accessible_ ? view->IsAccessibilityFocusable()
: view->IsFocusable();
#else

@ -765,7 +765,7 @@ TEST_F(FocusManagerTest, StoreFocusedView) {
GetFocusManager()->ClearFocus();
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Test that the correct view is restored if full keyboard access is changed.
TEST_F(FocusManagerTest, StoreFocusedViewFullKeyboardAccess) {
View* view1 = new View;

@ -16,7 +16,7 @@ namespace views {
FocusSearch::FocusSearch(View* root, bool cycle, bool accessibility_mode)
: root_(root), cycle_(cycle), accessibility_mode_(accessibility_mode) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, only the keyboard accessibility mode defined in FocusManager is
// used. No special accessibility mode should be applicable for a
// FocusTraversable.

@ -625,7 +625,7 @@ TEST_F(FocusTraversalTest, NormalTraversal) {
AdvanceEntireFocusLoop(kTraversalIDs, true);
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Test focus traversal with full keyboard access off on Mac.
TEST_F(FocusTraversalTest, NormalTraversalMac) {
GetFocusManager()->SetKeyboardAccessible(false);
@ -681,7 +681,7 @@ TEST_F(FocusTraversalTest, FullKeyboardToggle) {
EXPECT_EQ(THUMBNAIL_CONTAINER_ID,
GetFocusManager()->GetFocusedView()->GetID());
}
#endif // OS_APPLE
#endif // OS_MAC
TEST_F(FocusTraversalTest, TraversalWithNonEnabledViews) {
const int kDisabledIDs[] = {

@ -4789,7 +4789,7 @@ TEST_F(AnimatingLayoutManagerRealtimeTest,
// TODO(dfried): figure out why these tests absolutely do not animate properly
// on Mac. Whatever magic makes the compositor animation runner go doesn't seem
// to want to work on Mac in non-browsertests :(
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Test fixture for testing sequences of the following four actions:
// * animating layout manager configured on host view
@ -4984,6 +4984,6 @@ TEST_F(AnimatingLayoutManagerSequenceTest,
ExpectResetToLayout();
}
#endif // !defined(OS_APPLE)
#endif // !defined(OS_MAC)
} // namespace views

@ -34,7 +34,7 @@ const bool PlatformStyle::kIsOkButtonLeading = false;
const float PlatformStyle::kFocusHaloThickness = 2.f;
const float PlatformStyle::kFocusHaloInset = -1.f;
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
const int PlatformStyle::kMinLabelButtonWidth = 70;
const int PlatformStyle::kMinLabelButtonHeight = 33;
@ -85,7 +85,7 @@ gfx::Range PlatformStyle::RangeToDeleteBackwards(const std::u16string& text,
return gfx::Range(cursor_position, previous_grapheme_index);
}
#endif // OS_APPLE
#endif // OS_MAC
#if !BUILDFLAG(ENABLE_DESKTOP_AURA) || \
(!defined(OS_LINUX) && !defined(OS_CHROMEOS))

@ -14,7 +14,7 @@
#include "ui/views/style/typography.h"
#include "ui/views/view.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "base/mac/mac_util.h"
#endif
@ -147,7 +147,7 @@ int TypographyProvider::GetLineHeight(int context, int style) const {
// static
gfx::Font::Weight TypographyProvider::MediumWeightForUI() {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// System fonts are not user-configurable on Mac, so there's a simpler check.
// However, 10.11 do not ship with a MEDIUM weight system font. In that
// case, trying to use MEDIUM there will give a bold font, which will look

@ -10,7 +10,7 @@
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/views/controls/menu/menu_controller.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/views/controls/menu/menu_closure_animation_mac.h"
#endif
@ -81,13 +81,13 @@ void MenuControllerTestApi::SetShowing(bool showing) {
}
void DisableMenuClosureAnimations() {
#if defined(OS_APPLE)
#if defined(OS_MAC)
MenuClosureAnimationMac::DisableAnimationsForTesting();
#endif
}
void WaitForMenuClosureAnimation() {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// TODO(https://crbug.com/982815): Replace this with Quit+Run.
base::RunLoop().RunUntilIdle();
#endif

@ -10,7 +10,7 @@
#if defined(USE_AURA)
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#include "ui/views/widget/native_widget_aura.h"
#elif defined(OS_APPLE)
#elif defined(OS_MAC)
#include "ui/views/widget/native_widget_mac.h"
#endif
@ -21,7 +21,7 @@ NativeWidget* CreatePlatformNativeWidgetImpl(
Widget* widget,
uint32_t type,
bool* destroyed) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
return new TestPlatformNativeWidget<NativeWidgetMac>(
widget, type == kStubCapture, destroyed);
#else

@ -37,7 +37,7 @@ class TestViewsDelegate : public ViewsDelegate {
void set_context(gfx::NativeWindow context) { context_ = context; }
#endif
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Allows tests to provide a ContextFactory via the ViewsDelegate interface.
void set_context_factory(ui::ContextFactory* context_factory) {
context_factory_ = context_factory;
@ -57,12 +57,12 @@ class TestViewsDelegate : public ViewsDelegate {
#endif
void OnBeforeWidgetInit(Widget::InitParams* params,
internal::NativeWidgetDelegate* delegate) override;
#if defined(OS_APPLE)
#if defined(OS_MAC)
ui::ContextFactory* GetContextFactory() override;
#endif
private:
#if defined(OS_APPLE)
#if defined(OS_MAC)
ui::ContextFactory* context_factory_ = nullptr;
#endif
bool use_desktop_native_widgets_ = false;

@ -24,7 +24,7 @@
#if BUILDFLAG(ENABLE_DESKTOP_AURA)
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#endif
#elif defined(OS_APPLE)
#elif defined(OS_MAC)
#include "ui/views/widget/native_widget_mac.h"
#endif
@ -144,7 +144,7 @@ void ViewsTestBase::SimulateNativeDestroy(Widget* widget) {
test_helper_->SimulateNativeDestroy(widget);
}
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
int ViewsTestBase::GetSystemReservedHeightAtTopOfScreen() {
return 0;
}
@ -157,7 +157,7 @@ gfx::NativeWindow ViewsTestBase::GetContext() {
NativeWidget* ViewsTestBase::CreateNativeWidgetForTest(
const Widget::InitParams& init_params,
internal::NativeWidgetDelegate* delegate) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
return new test::TestPlatformNativeWidget<NativeWidgetMac>(delegate, false,
nullptr);
#elif defined(USE_AURA)

@ -2285,7 +2285,7 @@ TEST_F(ViewTest, HandleAccelerator) {
// TODO(themblsha): Bring this up on non-Mac platforms. It currently fails
// because TestView::AcceleratorPressed() is not called. See
// http://crbug.com/667757.
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Test that BridgedContentView correctly handles Accelerator key events when
// subject to OS event dispatch.
TEST_F(ViewTest, ActivateAcceleratorOnMac) {
@ -2328,11 +2328,11 @@ TEST_F(ViewTest, ActivateAcceleratorOnMac) {
key_down_accelerator.modifiers());
EXPECT_EQ(view->accelerator_count_map_[key_down_accelerator], 1);
}
#endif // OS_APPLE
#endif // OS_MAC
// TODO(crbug.com/667757): these tests were initially commented out when getting
// aura to run. Figure out if still valuable and either nuke or fix.
#if defined(OS_APPLE)
#if defined(OS_MAC)
TEST_F(ViewTest, ActivateAccelerator) {
ui::Accelerator return_accelerator(ui::VKEY_RETURN, ui::EF_NONE);
TestViewWidget test_widget(CreateParams(Widget::InitParams::TYPE_POPUP),
@ -2414,7 +2414,7 @@ TEST_F(ViewTest, ViewInHiddenWidgetWithAccelerator) {
EXPECT_FALSE(focus_manager->ProcessAccelerator(return_accelerator));
EXPECT_EQ(1, view->accelerator_count_map_[return_accelerator]);
}
#endif // OS_APPLE
#endif // OS_MAC
////////////////////////////////////////////////////////////////////////////////
// Native view hierachy

@ -117,7 +117,7 @@ bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
return false;
}
#if defined(OS_APPLE)
#if defined(OS_MAC)
ui::ContextFactory* ViewsDelegate::GetContextFactory() {
return nullptr;
}

@ -29,7 +29,7 @@ class Rect;
} // namespace gfx
namespace ui {
#if defined(OS_APPLE)
#if defined(OS_MAC)
class ContextFactory;
#endif
class TouchEditingControllerFactory;
@ -165,7 +165,7 @@ class VIEWS_EXPORT ViewsDelegate {
// maximized windows; otherwise to restored windows.
virtual bool WindowManagerProvidesTitleBar(bool maximized);
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Returns the context factory for new windows.
virtual ui::ContextFactory* GetContextFactory();
#endif

@ -22,7 +22,7 @@
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_delegate.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#error This file must not be included on macOS; Chromium Mac doesn't use Aura.
#endif

@ -113,7 +113,7 @@ class PreEventDispatchHandler : public ui::EventHandler {
if (owner_->GetFocusManager()) // Can be NULL in unittests.
v = owner_->GetFocusManager()->GetFocusedView();
// macOS doesn't have keyboard-triggered context menus.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Special case to handle keyboard-triggered context menus.
if (v && v->GetEnabled() &&
((event->key_code() == ui::VKEY_APPS) ||
@ -267,7 +267,7 @@ void RootView::DeviceScaleFactorChanged(float old_device_scale_factor,
// Accessibility ---------------------------------------------------------------
void RootView::AnnounceText(const std::u16string& text) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
gfx::NativeViewAccessible native = GetViewAccessibility().GetNativeObject();
auto* ax_node = ui::AXPlatformNode::FromNativeViewAccessible(native);
if (ax_node)

@ -119,7 +119,7 @@ class TestContextMenuController : public ContextMenuController {
// and VKEY_APPS) by the pre-target handler installed on RootView.
TEST_F(RootViewTest, ContextMenuFromKeyEvent) {
// This behavior is intentionally unsupported on macOS.
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
Widget widget;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
@ -851,7 +851,7 @@ TEST_F(RootViewDesktopNativeWidgetTest, SingleLayoutDuringInit) {
widget->CloseNow();
}
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Tests that AnnounceText sets up the correct text value on the hidden view,
// and that the resulting hidden view actually stays hidden.
@ -881,7 +881,7 @@ TEST_F(RootViewTest, AnnounceTextTest) {
node_data.GetString16Attribute(ax::mojom::StringAttribute::kName));
}
#endif // !defined(OS_APPLE)
#endif // !defined(OS_MAC)
TEST_F(RootViewTest, MouseEventDispatchedToClosestEnabledView) {
Widget widget;

@ -183,7 +183,7 @@ ui::WindowShowState GetWidgetShowState(const Widget* widget) {
// Give the OS an opportunity to process messages for an activation change, when
// there is actually no change expected (e.g. ShowInactive()).
void RunPendingMessagesForActiveStatusChange() {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, a single spin is *usually* enough. It isn't when a widget is shown
// and made active in two steps, so tests should follow up with a ShowSync()
// or ActivateSync to ensure a consistent state.
@ -210,7 +210,7 @@ void ShowSync(Widget* widget) {
}
void DeactivateSync(Widget* widget) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Deactivation of a window isn't a concept on Mac: If an application is
// active and it has any activatable windows, then one of them is always
// active. But we can simulate deactivation (e.g. as if another application
@ -813,7 +813,7 @@ TEST_F(WidgetTestInteractive, FullscreenMaximizedWindowBounds) {
}
#endif // defined(OS_WIN)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
// Tests whether the focused window is set correctly when a modal window is
// created and destroyed. When it is destroyed it should focus the owner window.
TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) {
@ -855,7 +855,7 @@ TEST_F(DesktopWidgetTestInteractive, WindowModalWindowDestroyedActivationTest) {
EXPECT_EQ(gfx::kNullNativeView, focus_changes[1]);
EXPECT_EQ(modal_native_view, focus_changes[2]);
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Window modal dialogs on Mac are "sheets", which animate to close before
// activating their parent widget.
views::test::WidgetActivationWaiter waiter(&top_level_widget, true);
@ -1040,7 +1040,7 @@ TEST_F(WidgetTestInteractive, ShowAfterShowInactive) {
EXPECT_EQ(GetWidgetShowState(widget.get()), ui::SHOW_STATE_NORMAL);
}
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
TEST_F(WidgetTestInteractive, InactiveWidgetDoesNotGrabActivation) {
WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget());
ShowSync(widget.get());
@ -1056,13 +1056,13 @@ TEST_F(WidgetTestInteractive, InactiveWidgetDoesNotGrabActivation) {
EXPECT_EQ(GetWidgetShowState(widget2.get()), ui::SHOW_STATE_INACTIVE);
EXPECT_EQ(GetWidgetShowState(widget.get()), ui::SHOW_STATE_NORMAL);
}
#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
// ExitFullscreenRestoreState doesn't use DesktopAura widgets. On Mac, there are
// currently only Desktop widgets and fullscreen changes have to coordinate with
// the OS. See BridgedNativeWidgetUITest for native Mac fullscreen tests.
// Maximize on mac is also (intentionally) a no-op.
#if defined(OS_APPLE)
#if defined(OS_MAC)
#define MAYBE_ExitFullscreenRestoreState DISABLED_ExitFullscreenRestoreState
#else
#define MAYBE_ExitFullscreenRestoreState ExitFullscreenRestoreState
@ -1208,7 +1208,7 @@ TEST_F(DesktopWidgetTestInteractive, MinimizeAndActivateFocus) {
#endif // defined(OS_WIN)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
// Tests that minimizing a widget causes the gesture_handler
// to be cleared when the widget is minimized.
TEST_F(DesktopWidgetTestInteractive, EventHandlersClearedOnWidgetMinimize) {
@ -1383,7 +1383,7 @@ TEST_F(WidgetCaptureTest, Capture) {
TestCapture(false);
}
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
// See description in TestCapture(). Creates DesktopNativeWidget.
TEST_F(WidgetCaptureTest, CaptureDesktopNativeWidget) {
TestCapture(true);
@ -1651,7 +1651,7 @@ TEST_F(WidgetCaptureTest, GrabUngrab) {
// Disabled on Mac. Desktop Mac doesn't have system modal windows since Carbon
// was deprecated. It does have application modal windows, but only Ash requests
// those.
#if defined(OS_APPLE)
#if defined(OS_MAC)
#define MAYBE_SystemModalWindowReleasesCapture \
DISABLED_SystemModalWindowReleasesCapture
#elif BUILDFLAG(IS_CHROMEOS_ASH)
@ -1706,7 +1706,7 @@ TEST_F(WidgetCaptureTest, MAYBE_SystemModalWindowReleasesCapture) {
// Regression test for http://crbug.com/382421 (Linux-Aura issue).
// TODO(pkotwicz): Make test pass on CrOS and Windows.
// TODO(tapted): Investigate for toolkit-views on Mac http;//crbug.com/441064.
#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_APPLE)
#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(OS_MAC)
#define MAYBE_MouseExitOnCaptureGrab DISABLED_MouseExitOnCaptureGrab
#else
#define MAYBE_MouseExitOnCaptureGrab MouseExitOnCaptureGrab
@ -1801,7 +1801,7 @@ TEST_F(WidgetCaptureTest, SetCaptureToNonToplevel) {
child->AddObserver(&observer);
child->Show();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, activation is asynchronous. A single trip to the runloop should be
// sufficient. On Aura platforms, note that since the child widget isn't top-
// level, the aura window manager gets asked whether the widget is active, not
@ -1912,7 +1912,7 @@ class WidgetInputMethodInteractiveTest : public DesktopWidgetTestInteractive {
DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest);
};
#if defined(OS_APPLE)
#if defined(OS_MAC)
#define MAYBE_Activation DISABLED_Activation
#else
#define MAYBE_Activation Activation
@ -1957,7 +1957,7 @@ TEST_F(WidgetInputMethodInteractiveTest, OneWindow) {
// Widget::Deactivate() doesn't work for CrOS, because it uses NWA instead of
// DNWA (which just activates the last active window) and involves the
// AuraTestHelper which sets the input method as DummyInputMethod.
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
DeactivateSync(widget.get());
EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE,
widget->GetInputMethod()->GetTextInputType());
@ -2005,7 +2005,7 @@ TEST_F(WidgetInputMethodInteractiveTest, TwoWindows) {
// Widget::Deactivate() doesn't work for CrOS, because it uses NWA instead of
// DNWA (which just activates the last active window) and involves the
// AuraTestHelper which sets the input method as DummyInputMethod.
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
DeactivateSync(parent.get());
EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE,
parent->GetInputMethod()->GetTextInputType());

@ -54,7 +54,7 @@
#include "ui/views/win/hwnd_util.h"
#endif
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "base/mac/mac_util.h"
#endif
@ -897,7 +897,7 @@ class WidgetObserverTest : public WidgetTest, public WidgetObserver {
};
// This test appears to be flaky on Mac.
#if defined(OS_APPLE)
#if defined(OS_MAC)
#define MAYBE_ActivationChange DISABLED_ActivationChange
#else
#define MAYBE_ActivationChange ActivationChange
@ -1408,7 +1408,7 @@ TEST_F(DesktopWidgetTest, MAYBE_GetRestoredBounds) {
toplevel->Maximize();
RunPendingMessages();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Current expectation on Mac is to do nothing on Maximize.
EXPECT_EQ(toplevel->GetWindowBoundsInScreen(), toplevel->GetRestoredBounds());
#else
@ -1848,7 +1848,7 @@ class MousePressEventConsumer : public ui::EventHandler {
} // namespace
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE) || defined(USE_AURA)
#if !defined(OS_MAC) || defined(USE_AURA)
// Test that mouse presses and mouse releases are dispatched normally when a
// touch is down.
@ -1876,7 +1876,7 @@ TEST_F(WidgetTest, MouseEventDispatchWhileTouchIsDown) {
widget->CloseNow();
}
#endif // !defined(OS_APPLE) || defined(USE_AURA)
#endif // !defined(OS_MAC) || defined(USE_AURA)
// Tests that when there is no active capture, that a mouse press causes capture
// to be set.
@ -2255,7 +2255,7 @@ TEST_F(WidgetTest, WidgetDeleted_InOnMousePressed) {
}
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if !defined(OS_APPLE) || defined(USE_AURA)
#if !defined(OS_MAC) || defined(USE_AURA)
TEST_F(WidgetTest, WidgetDeleted_InDispatchGestureEvent) {
Widget* widget = new Widget;
@ -2279,7 +2279,7 @@ TEST_F(WidgetTest, WidgetDeleted_InDispatchGestureEvent) {
// Yay we did not crash!
}
#endif // !defined(OS_APPLE) || defined(USE_AURA)
#endif // !defined(OS_MAC) || defined(USE_AURA)
// See description of RunGetNativeThemeFromDestructor() for details.
class GetNativeThemeFromDestructorView : public WidgetDelegateView {
@ -2436,7 +2436,7 @@ TEST_F(WidgetTest, CloseWidgetWhileAnimating) {
// Test Widget::CloseAllSecondaryWidgets works as expected across platforms.
// ChromeOS doesn't implement or need CloseAllSecondaryWidgets() since
// everything is under a single root window.
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
TEST_F(DesktopWidgetTest, CloseAllSecondaryWidgets) {
Widget* widget1 = CreateTopLevelNativeWidget();
Widget* widget2 = CreateTopLevelNativeWidget();
@ -2503,7 +2503,7 @@ TEST_F(WidgetTest, NoCrashOnWidgetDeleteWithPendingEvents) {
generator->MoveMouseTo(10, 10);
// No touch on desktop Mac. Tracked in http://crbug.com/445520.
#if defined(OS_APPLE)
#if defined(OS_MAC)
generator->ClickLeftButton();
#else
generator->PressTouch();
@ -3846,7 +3846,7 @@ class WidgetShadowTest : public WidgetTest {
bool force_child_ = false;
private:
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
void InitControllers() {}
#else
class TestFocusRules : public wm::BaseFocusRules {
@ -3870,13 +3870,13 @@ class WidgetShadowTest : public WidgetTest {
std::unique_ptr<wm::FocusController> focus_controller_;
std::unique_ptr<wm::ShadowController> shadow_controller_;
#endif // !BUILDFLAG(ENABLE_DESKTOP_AURA) && !defined(OS_APPLE)
#endif // !BUILDFLAG(ENABLE_DESKTOP_AURA) && !defined(OS_MAC)
DISALLOW_COPY_AND_ASSIGN(WidgetShadowTest);
};
// Disabled on Mac: All drop shadows are managed out of process for now.
#if defined(OS_APPLE)
#if defined(OS_MAC)
#define MAYBE_ShadowsInRootWindow DISABLED_ShadowsInRootWindow
#else
#define MAYBE_ShadowsInRootWindow ShadowsInRootWindow
@ -4007,7 +4007,7 @@ TEST_F(DesktopWidgetTest, WindowModalOwnerDestroyedEnabledTest) {
#endif // defined(OS_WIN)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#if BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
namespace {
@ -4049,7 +4049,7 @@ class CompositingWidgetTest : public DesktopWidgetTest {
const Widget::InitParams::WindowOpacity opacity) {
opacity_ = opacity;
for (const auto& widget_type : widget_types_) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Tooltips are native on Mac. See NativeWidgetNSWindowBridge::Init.
if (widget_type == Widget::InitParams::TYPE_TOOLTIP)
continue;
@ -4066,7 +4066,7 @@ class CompositingWidgetTest : public DesktopWidgetTest {
widget_type == Widget::InitParams::TYPE_CONTROL)
continue;
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Mac always always has a compositing window manager, but doesn't have
// transparent titlebars which is what ShouldWindowContentsBeTransparent()
// is currently used for. Asking for transparency should get it. Note that
@ -4116,7 +4116,7 @@ TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetTranslucent) {
CheckAllWidgetsForOpacity(Widget::InitParams::WindowOpacity::kTranslucent);
}
#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_APPLE)
#endif // BUILDFLAG(ENABLE_DESKTOP_AURA) || defined(OS_MAC)
} // namespace test
} // namespace views

@ -156,7 +156,7 @@ TEST_F(CustomFrameViewTest, MaximizeRevealsRestoreButton) {
widget()->Maximize();
custom_frame_view()->Layout();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// Restore buttons do not exist on Mac. The maximize button is instead a kind
// of toggle, but has no effect on frame decorations.
EXPECT_FALSE(restore_button()->GetVisible());
@ -209,7 +209,7 @@ TEST_F(CustomFrameViewTest, LargerEdgeButtonsWhenMaximized) {
widget()->Maximize();
custom_frame_view()->Layout();
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, "Maximize" should not alter the frame. Only fullscreen does that.
EXPECT_EQ(close_button()->bounds().width(),
close_button_initial_bounds.width());

@ -103,7 +103,7 @@ Widget::InitParams DialogDelegate::GetDialogWidgetInitParams(
if (!dialog || dialog->use_custom_frame()) {
params.opacity = Widget::InitParams::WindowOpacity::kTranslucent;
params.remove_standard_frame = true;
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// Except on Mac, the bubble frame includes its own shadow; remove any
// native shadowing. On Mac, the window server provides the shadow.
params.shadow_type = views::Widget::InitParams::ShadowType::kNone;

@ -21,7 +21,7 @@
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
#if defined(OS_APPLE)
#if defined(OS_MAC)
#include "ui/base/test/scoped_fake_full_keyboard_access.h"
#endif
@ -396,7 +396,7 @@ TEST_F(DialogTest, InitialFocusWithDeactivatedWidget) {
// If the initially focused View provided is unfocusable, check the next
// available focusable View is focused.
TEST_F(DialogTest, UnfocusableInitialFocus) {
#if defined(OS_APPLE)
#if defined(OS_MAC)
// On Mac, make all buttons unfocusable by turning off full keyboard access.
// This is the more common configuration, and if a dialog has a focusable
// textfield, tree or table, that should obtain focus instead.
@ -409,7 +409,7 @@ TEST_F(DialogTest, UnfocusableInitialFocus) {
dialog->AddChildView(textfield);
Widget* dialog_widget = CreateDialogWidget(dialog);
#if !defined(OS_APPLE)
#if !defined(OS_MAC)
// For non-Mac, turn off focusability on all the dialog's buttons manually.
// This achieves the same effect as disabling full keyboard access.
dialog->GetOkButton()->SetFocusBehavior(View::FocusBehavior::NEVER);