Commit 8f34427c authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

Fixes to get Views versions of message_center_unittests passing on Mac.

This enables the views version of the message_center, in preparation
for removing the Cocoa implementation.

Fixes:
- Use an EventGenerator in tests, rather than manually synthesizing
  events.
- NotificationInputContainerMD::HandleKeyEvent() now explicitly clears
  the text input field when handling VKEY_RETURN, as the test expects
  this.
- Disabling notifications is no longer handled in
  NotificationViewMD::ButtonPressed(), since it wasn't the button
  Listener for the block_all_button_ (the
  NotificationControlButtonsView is). Disabling is now handled in
  ToggleInlineSettings() instead.
- The SlideOut tests are disabled on Mac because the test framework
  doesn't support synthesizing gesture scroll events.

Bug: 739386
Change-Id: Id841779233662111f52d491ba78e5315422003b4
Reviewed-on: https://chromium-review.googlesource.com/c/1341091
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609514}
parent 72a0f319
...@@ -110,9 +110,7 @@ jumbo_component("message_center") { ...@@ -110,9 +110,7 @@ jumbo_component("message_center") {
] ]
} }
# On Mac, toolkit-views builds still use the Cocoa UI. Keep this in sync if (toolkit_views) {
# with message_center_unittests below.
if (toolkit_views && !is_mac) {
sources += [ sources += [
"views/bounded_label.cc", "views/bounded_label.cc",
"views/bounded_label.h", "views/bounded_label.h",
...@@ -122,6 +120,7 @@ jumbo_component("message_center") { ...@@ -122,6 +120,7 @@ jumbo_component("message_center") {
"views/message_popup_collection.h", "views/message_popup_collection.h",
"views/message_popup_view.cc", "views/message_popup_view.cc",
"views/message_popup_view.h", "views/message_popup_view.h",
"views/message_popup_view_mac.mm",
"views/message_view.cc", "views/message_view.cc",
"views/message_view.h", "views/message_view.h",
"views/message_view_factory.cc", "views/message_view_factory.cc",
...@@ -247,7 +246,7 @@ if (enable_message_center) { ...@@ -247,7 +246,7 @@ if (enable_message_center) {
deps += [ "//ui/gfx:test_support" ] deps += [ "//ui/gfx:test_support" ]
} }
if (toolkit_views && !is_mac) { if (toolkit_views) {
sources += [ sources += [
"views/bounded_label_unittest.cc", "views/bounded_label_unittest.cc",
"views/message_popup_collection_unittest.cc", "views/message_popup_collection_unittest.cc",
......
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_paths.h"
#include "ui/gl/test/gl_surface_test_support.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "base/test/mock_chrome_application_mac.h" #include "base/test/mock_chrome_application_mac.h"
#else
#include "ui/gl/test/gl_surface_test_support.h"
#endif #endif
namespace { namespace {
...@@ -31,9 +30,8 @@ class MessageCenterTestSuite : public base::TestSuite { ...@@ -31,9 +30,8 @@ class MessageCenterTestSuite : public base::TestSuite {
void Initialize() override { void Initialize() override {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
mock_cr_app::RegisterMockCrApp(); mock_cr_app::RegisterMockCrApp();
#else
gl::GLSurfaceTestSupport::InitializeOneOff();
#endif #endif
gl::GLSurfaceTestSupport::InitializeOneOff();
base::TestSuite::Initialize(); base::TestSuite::Initialize();
ui::RegisterPathProvider(); ui::RegisterPathProvider();
......
...@@ -83,11 +83,13 @@ void MessagePopupView::UpdateContents(const Notification& notification) { ...@@ -83,11 +83,13 @@ void MessagePopupView::UpdateContents(const Notification& notification) {
} }
} }
#if !defined(OS_MACOSX)
float MessagePopupView::GetOpacity() const { float MessagePopupView::GetOpacity() const {
if (!IsWidgetValid()) if (!IsWidgetValid())
return 0.f; return 0.f;
return GetWidget()->GetLayer()->opacity(); return GetWidget()->GetLayer()->opacity();
} }
#endif
void MessagePopupView::SetPopupBounds(const gfx::Rect& bounds) { void MessagePopupView::SetPopupBounds(const gfx::Rect& bounds) {
if (!IsWidgetValid()) if (!IsWidgetValid())
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ui/message_center/views/message_popup_view.h"
#import <Cocoa/Cocoa.h>
#include "ui/views/widget/widget.h"
namespace message_center {
float MessagePopupView::GetOpacity() const {
if (!IsWidgetValid())
return 0.f;
return [GetWidget()->GetNativeWindow().GetNativeNSWindow() alphaValue];
}
} // namespace message_center
...@@ -437,6 +437,7 @@ bool NotificationInputContainerMD::HandleKeyEvent(views::Textfield* sender, ...@@ -437,6 +437,7 @@ bool NotificationInputContainerMD::HandleKeyEvent(views::Textfield* sender,
event.key_code() == ui::VKEY_RETURN) { event.key_code() == ui::VKEY_RETURN) {
delegate_->OnNotificationInputSubmit( delegate_->OnNotificationInputSubmit(
textfield_->GetProperty(kTextfieldIndexKey), textfield_->text()); textfield_->GetProperty(kTextfieldIndexKey), textfield_->text());
textfield_->SetText(base::string16());
return true; return true;
} }
return event.type() == ui::ET_KEY_RELEASED; return event.type() == ui::ET_KEY_RELEASED;
...@@ -748,8 +749,6 @@ void NotificationViewMD::ButtonPressed(views::Button* sender, ...@@ -748,8 +749,6 @@ void NotificationViewMD::ButtonPressed(views::Button* sender,
} }
if (sender == settings_done_button_) { if (sender == settings_done_button_) {
if (block_all_button_->checked())
MessageCenter::Get()->DisableNotification(id);
ToggleInlineSettings(event); ToggleInlineSettings(event);
return; return;
} }
...@@ -1214,6 +1213,9 @@ void NotificationViewMD::ToggleInlineSettings(const ui::Event& event) { ...@@ -1214,6 +1213,9 @@ void NotificationViewMD::ToggleInlineSettings(const ui::Event& event) {
bool inline_settings_visible = !settings_row_->visible(); bool inline_settings_visible = !settings_row_->visible();
if (!inline_settings_visible && block_all_button_->checked())
MessageCenter::Get()->DisableNotification(notification_id());
settings_row_->SetVisible(inline_settings_visible); settings_row_->SetVisible(inline_settings_visible);
content_row_->SetVisible(!inline_settings_visible); content_row_->SetVisible(!inline_settings_visible);
......
...@@ -431,9 +431,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonsStateTest) { ...@@ -431,9 +431,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonsStateTest) {
gfx::Point cursor_location(1, 1); gfx::Point cursor_location(1, 1);
views::View::ConvertPointToWidget(notification_view()->action_buttons_[0], views::View::ConvertPointToWidget(notification_view()->action_buttons_[0],
&cursor_location); &cursor_location);
ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, ui::test::EventGenerator generator(
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); GetRootWindow(notification_view()->GetWidget()));
widget()->OnMouseEvent(&move); generator.MoveMouseTo(cursor_location);
EXPECT_EQ(views::Button::STATE_HOVERED, EXPECT_EQ(views::Button::STATE_HOVERED,
notification_view()->action_buttons_[0]->state()); notification_view()->action_buttons_[0]->state());
...@@ -446,9 +446,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonsStateTest) { ...@@ -446,9 +446,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonsStateTest) {
// Now construct a mouse move event 1 pixel outside the boundary of the // Now construct a mouse move event 1 pixel outside the boundary of the
// widget. // widget.
cursor_location = gfx::Point(-1, -1); cursor_location = gfx::Point(-1, -1);
move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, views::View::ConvertPointToWidget(notification_view()->action_buttons_[0],
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); &cursor_location);
widget()->OnMouseEvent(&move); generator.MoveMouseTo(cursor_location);
EXPECT_EQ(views::Button::STATE_NORMAL, EXPECT_EQ(views::Button::STATE_NORMAL,
notification_view()->action_buttons_[0]->state()); notification_view()->action_buttons_[0]->state());
...@@ -475,11 +475,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonCountTest) { ...@@ -475,11 +475,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonCountTest) {
gfx::Point cursor_location(1, 1); gfx::Point cursor_location(1, 1);
views::View::ConvertPointToScreen(notification_view()->action_buttons_[0], views::View::ConvertPointToScreen(notification_view()->action_buttons_[0],
&cursor_location); &cursor_location);
ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, ui::test::EventGenerator generator(
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); GetRootWindow(notification_view()->GetWidget()));
ui::EventDispatchDetails details = generator.MoveMouseTo(cursor_location);
views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move);
EXPECT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(views::Button::STATE_HOVERED, EXPECT_EQ(views::Button::STATE_HOVERED,
notification_view()->action_buttons_[0]->state()); notification_view()->action_buttons_[0]->state());
...@@ -496,9 +494,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonCountTest) { ...@@ -496,9 +494,9 @@ TEST_F(NotificationViewMDTest, UpdateButtonCountTest) {
// Now construct a mouse move event 1 pixel outside the boundary of the // Now construct a mouse move event 1 pixel outside the boundary of the
// widget. // widget.
cursor_location = gfx::Point(-1, -1); cursor_location = gfx::Point(-1, -1);
move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, views::View::ConvertPointToScreen(notification_view()->action_buttons_[0],
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); &cursor_location);
widget()->OnMouseEvent(&move); generator.MoveMouseTo(cursor_location);
EXPECT_EQ(views::Button::STATE_NORMAL, EXPECT_EQ(views::Button::STATE_NORMAL,
notification_view()->action_buttons_[0]->state()); notification_view()->action_buttons_[0]->state());
...@@ -667,7 +665,14 @@ TEST_F(NotificationViewMDTest, TestInlineReplyRemovedByUpdate) { ...@@ -667,7 +665,14 @@ TEST_F(NotificationViewMDTest, TestInlineReplyRemovedByUpdate) {
EXPECT_FALSE(notification_view()->actions_row_->visible()); EXPECT_FALSE(notification_view()->actions_row_->visible());
} }
TEST_F(NotificationViewMDTest, SlideOut) { // Synthetic scroll events are not supported on Mac in the views
// test framework.
#if defined(OS_MACOSX)
#define MAYBE_SlideOut DISABLED_SlideOut
#else
#define MAYBE_SlideOut SlideOut
#endif
TEST_F(NotificationViewMDTest, MAYBE_SlideOut) {
ui::ScopedAnimationDurationScaleMode zero_duration_scope( ui::ScopedAnimationDurationScaleMode zero_duration_scope(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
...@@ -689,7 +694,12 @@ TEST_F(NotificationViewMDTest, SlideOut) { ...@@ -689,7 +694,12 @@ TEST_F(NotificationViewMDTest, SlideOut) {
EXPECT_TRUE(IsRemovedAfterIdle(kDefaultNotificationId)); EXPECT_TRUE(IsRemovedAfterIdle(kDefaultNotificationId));
} }
TEST_F(NotificationViewMDTest, SlideOutNested) { #if defined(OS_MACOSX)
#define MAYBE_SlideOutNested DISABLED_SlideOutNested
#else
#define MAYBE_SlideOutNested SlideOutNested
#endif
TEST_F(NotificationViewMDTest, MAYBE_SlideOutNested) {
notification_view()->SetIsNested(); notification_view()->SetIsNested();
ui::ScopedAnimationDurationScaleMode zero_duration_scope( ui::ScopedAnimationDurationScaleMode zero_duration_scope(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
...@@ -710,7 +720,12 @@ TEST_F(NotificationViewMDTest, SlideOutNested) { ...@@ -710,7 +720,12 @@ TEST_F(NotificationViewMDTest, SlideOutNested) {
EXPECT_TRUE(IsRemovedAfterIdle(kDefaultNotificationId)); EXPECT_TRUE(IsRemovedAfterIdle(kDefaultNotificationId));
} }
TEST_F(NotificationViewMDTest, DisableSlideForcibly) { #if defined(OS_MACOSX)
#define MAYBE_DisableSlideForcibly DISABLED_DisableSlideForcibly
#else
#define MAYBE_DisableSlideForcibly DisableSlideForcibly
#endif
TEST_F(NotificationViewMDTest, MAYBE_DisableSlideForcibly) {
ui::ScopedAnimationDurationScaleMode zero_duration_scope( ui::ScopedAnimationDurationScaleMode zero_duration_scope(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
...@@ -965,13 +980,14 @@ TEST_F(NotificationViewMDTest, InlineSettings) { ...@@ -965,13 +980,14 @@ TEST_F(NotificationViewMDTest, InlineSettings) {
notification->set_type(NOTIFICATION_TYPE_SIMPLE); notification->set_type(NOTIFICATION_TYPE_SIMPLE);
UpdateNotificationViews(*notification); UpdateNotificationViews(*notification);
ui::test::EventGenerator generator(GetRootWindow(widget()));
// Inline settings will be shown by clicking settings button. // Inline settings will be shown by clicking settings button.
EXPECT_FALSE(notification_view()->settings_row_->visible()); EXPECT_FALSE(notification_view()->settings_row_->visible());
gfx::Point settings_cursor_location(1, 1); gfx::Point settings_cursor_location(1, 1);
views::View::ConvertPointToScreen( views::View::ConvertPointToTarget(
notification_view()->control_buttons_view_->settings_button(), notification_view()->control_buttons_view_->settings_button(),
&settings_cursor_location); notification_view(), &settings_cursor_location);
ui::test::EventGenerator generator(GetRootWindow(widget()));
generator.MoveMouseTo(settings_cursor_location); generator.MoveMouseTo(settings_cursor_location);
generator.ClickLeftButton(); generator.ClickLeftButton();
EXPECT_TRUE(notification_view()->settings_row_->visible()); EXPECT_TRUE(notification_view()->settings_row_->visible());
...@@ -986,8 +1002,9 @@ TEST_F(NotificationViewMDTest, InlineSettings) { ...@@ -986,8 +1002,9 @@ TEST_F(NotificationViewMDTest, InlineSettings) {
// Construct a mouse click event 1 pixel inside the done button. // Construct a mouse click event 1 pixel inside the done button.
gfx::Point done_cursor_location(1, 1); gfx::Point done_cursor_location(1, 1);
views::View::ConvertPointToScreen(notification_view()->settings_done_button_, views::View::ConvertPointToTarget(
&done_cursor_location); notification_view()->control_buttons_view_->settings_button(),
notification_view(), &done_cursor_location);
generator.MoveMouseTo(done_cursor_location); generator.MoveMouseTo(done_cursor_location);
generator.ClickLeftButton(); generator.ClickLeftButton();
...@@ -1001,7 +1018,8 @@ TEST_F(NotificationViewMDTest, InlineSettings) { ...@@ -1001,7 +1018,8 @@ TEST_F(NotificationViewMDTest, InlineSettings) {
// Construct a mouse click event 1 pixel inside the block all button. // Construct a mouse click event 1 pixel inside the block all button.
gfx::Point block_cursor_location(1, 1); gfx::Point block_cursor_location(1, 1);
views::View::ConvertPointToScreen(notification_view()->block_all_button_, views::View::ConvertPointToTarget(notification_view()->block_all_button_,
notification_view(),
&block_cursor_location); &block_cursor_location);
generator.MoveMouseTo(block_cursor_location); generator.MoveMouseTo(block_cursor_location);
generator.ClickLeftButton(); generator.ClickLeftButton();
...@@ -1019,7 +1037,8 @@ TEST_F(NotificationViewMDTest, TestClick) { ...@@ -1019,7 +1037,8 @@ TEST_F(NotificationViewMDTest, TestClick) {
UpdateNotificationViews(*notification); UpdateNotificationViews(*notification);
widget()->Show(); widget()->Show();
ui::test::EventGenerator generator(GetRootWindow(widget())); ui::test::EventGenerator generator(
GetRootWindow(notification_view()->GetWidget()));
// Collapse the notification if it's expanded. // Collapse the notification if it's expanded.
if (notification_view()->expanded_) if (notification_view()->expanded_)
...@@ -1029,7 +1048,6 @@ TEST_F(NotificationViewMDTest, TestClick) { ...@@ -1029,7 +1048,6 @@ TEST_F(NotificationViewMDTest, TestClick) {
// Now construct a mouse click event 2 pixel inside from the bottom. // Now construct a mouse click event 2 pixel inside from the bottom.
gfx::Point cursor_location(notification_view()->size().width() / 2, gfx::Point cursor_location(notification_view()->size().width() / 2,
notification_view()->size().height() - 2); notification_view()->size().height() - 2);
views::View::ConvertPointToScreen(notification_view(), &cursor_location);
generator.MoveMouseTo(cursor_location); generator.MoveMouseTo(cursor_location);
generator.ClickLeftButton(); generator.ClickLeftButton();
...@@ -1053,7 +1071,6 @@ TEST_F(NotificationViewMDTest, TestClickExpanded) { ...@@ -1053,7 +1071,6 @@ TEST_F(NotificationViewMDTest, TestClickExpanded) {
// Now construct a mouse click event 2 pixel inside from the bottom. // Now construct a mouse click event 2 pixel inside from the bottom.
gfx::Point cursor_location(notification_view()->size().width() / 2, gfx::Point cursor_location(notification_view()->size().width() / 2,
notification_view()->size().height() - 2); notification_view()->size().height() - 2);
views::View::ConvertPointToScreen(notification_view(), &cursor_location);
generator.MoveMouseTo(cursor_location); generator.MoveMouseTo(cursor_location);
generator.ClickLeftButton(); generator.ClickLeftButton();
......
...@@ -488,16 +488,15 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) { ...@@ -488,16 +488,15 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) {
EXPECT_EQ(views::Button::STATE_NORMAL, EXPECT_EQ(views::Button::STATE_NORMAL,
notification_view()->action_buttons_[1]->state()); notification_view()->action_buttons_[1]->state());
ui::test::EventGenerator generator(
GetRootWindow(notification_view()->GetWidget()));
// Now construct a mouse move event 1 pixel inside the boundary of the action // Now construct a mouse move event 1 pixel inside the boundary of the action
// button. // button.
gfx::Point cursor_location(1, 1); gfx::Point cursor_location(1, 1);
views::View::ConvertPointToScreen(notification_view()->action_buttons_[0], views::View::ConvertPointToTarget(notification_view()->action_buttons_[0],
&cursor_location); notification_view(), &cursor_location);
ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, generator.MoveMouseTo(cursor_location);
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
ui::EventDispatchDetails details =
views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move);
EXPECT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(views::Button::STATE_HOVERED, EXPECT_EQ(views::Button::STATE_HOVERED,
notification_view()->action_buttons_[0]->state()); notification_view()->action_buttons_[0]->state());
...@@ -514,9 +513,8 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) { ...@@ -514,9 +513,8 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) {
// Now construct a mouse move event 1 pixel outside the boundary of the // Now construct a mouse move event 1 pixel outside the boundary of the
// widget. // widget.
cursor_location = gfx::Point(-1, -1); cursor_location = gfx::Point(-1, -1);
move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, views::View::ConvertPointToScreen(notification_view(), &cursor_location);
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); generator.MoveMouseTo(cursor_location);
widget()->OnMouseEvent(&move);
EXPECT_EQ(views::Button::STATE_NORMAL, EXPECT_EQ(views::Button::STATE_NORMAL,
notification_view()->action_buttons_[0]->state()); notification_view()->action_buttons_[0]->state());
...@@ -536,25 +534,23 @@ TEST_F(NotificationViewTest, SettingsButtonTest) { ...@@ -536,25 +534,23 @@ TEST_F(NotificationViewTest, SettingsButtonTest) {
EXPECT_TRUE(NULL != GetSettingsButton()); EXPECT_TRUE(NULL != GetSettingsButton());
EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->state()); EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->state());
ui::test::EventGenerator generator(GetRootWindow(widget()));
// Now construct a mouse move event 1 pixel inside the boundary of the action // Now construct a mouse move event 1 pixel inside the boundary of the action
// button. // button.
gfx::Point cursor_location(1, 1); gfx::Point cursor_location(1, 1);
views::View::ConvertPointToScreen(GetSettingsButton(), &cursor_location); views::View::ConvertPointToTarget(GetSettingsButton(), notification_view(),
ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, &cursor_location);
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); generator.MoveMouseTo(cursor_location);
widget()->OnMouseEvent(&move);
ui::EventDispatchDetails details =
views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move);
EXPECT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(views::Button::STATE_HOVERED, GetSettingsButton()->state()); EXPECT_EQ(views::Button::STATE_HOVERED, GetSettingsButton()->state());
// Now construct a mouse move event 1 pixel outside the boundary of the // Now construct a mouse move event 1 pixel outside the boundary of the
// widget. // widget.
cursor_location = gfx::Point(-1, -1); cursor_location = gfx::Point(-1, -1);
move = ui::MouseEvent(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, views::View::ConvertPointToTarget(GetSettingsButton(), notification_view(),
ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); &cursor_location);
widget()->OnMouseEvent(&move); generator.MoveMouseTo(cursor_location);
EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->state()); EXPECT_EQ(views::Button::STATE_NORMAL, GetSettingsButton()->state());
} }
...@@ -647,7 +643,14 @@ TEST_F(NotificationViewTest, FormatContextMessageTest) { ...@@ -647,7 +643,14 @@ TEST_F(NotificationViewTest, FormatContextMessageTest) {
EXPECT_TRUE(result_utf8.find("hello") == std::string::npos); EXPECT_TRUE(result_utf8.find("hello") == std::string::npos);
} }
TEST_F(NotificationViewTest, SlideOut) { // Synthetic scroll events are not supported on Mac in the views
// test framework.
#if defined(OS_MACOSX)
#define MAYBE_SlideOut DISABLED_SlideOut
#else
#define MAYBE_SlideOut SlideOut
#endif
TEST_F(NotificationViewTest, MAYBE_SlideOut) {
ui::ScopedAnimationDurationScaleMode zero_duration_scope( ui::ScopedAnimationDurationScaleMode zero_duration_scope(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
...@@ -670,7 +673,12 @@ TEST_F(NotificationViewTest, SlideOut) { ...@@ -670,7 +673,12 @@ TEST_F(NotificationViewTest, SlideOut) {
EXPECT_TRUE(IsRemovedAfterIdle(notification_id)); EXPECT_TRUE(IsRemovedAfterIdle(notification_id));
} }
TEST_F(NotificationViewTest, SlideOutNested) { #if defined(OS_MACOSX)
#define MAYBE_SlideOutNested DISABLED_SlideOutNested
#else
#define MAYBE_SlideOutNested SlideOutNested
#endif
TEST_F(NotificationViewTest, MAYBE_SlideOutNested) {
ui::ScopedAnimationDurationScaleMode zero_duration_scope( ui::ScopedAnimationDurationScaleMode zero_duration_scope(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
......
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