| Index: ui/views/widget/widget_interactive_uitest.cc
|
| diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
|
| index c37236e427ce7cb05f14b3bcf70e49b984a93b64..adb99aebab58a0a1a2f69bacd85b4e3cc7719002 100644
|
| --- a/ui/views/widget/widget_interactive_uitest.cc
|
| +++ b/ui/views/widget/widget_interactive_uitest.cc
|
| @@ -990,10 +990,11 @@ TEST_F(WidgetCaptureTest, FailedCaptureRequestIsNoop) {
|
| EXPECT_TRUE(mouse_view2->pressed());
|
| }
|
|
|
| -#if !defined(OS_CHROMEOS) && !defined(OS_WIN)
|
| +#if !defined(OS_CHROMEOS) && !defined(OS_WIN) && !defined(OS_MACOSX)
|
| // Test that a synthetic mouse exit is sent to the widget which was handling
|
| // mouse events when a different widget grabs capture.
|
| // TODO(pkotwicz): Make test pass on CrOS and Windows.
|
| +// TODO(tapted): Investigate for toolkit-views on Mac http;//crbug.com/441064.
|
| TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) {
|
| Widget widget1;
|
| Widget::InitParams params1 =
|
| @@ -1015,7 +1016,7 @@ TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) {
|
| widget2.Show();
|
| widget2.SetBounds(gfx::Rect(400, 0, 300, 300));
|
|
|
| - ui::test::EventGenerator generator(widget1.GetNativeWindow());
|
| + ui::test::EventGenerator generator(GetContext(), widget1.GetNativeWindow());
|
| generator.set_current_location(gfx::Point(100, 100));
|
| generator.MoveMouseBy(0, 0);
|
|
|
| @@ -1035,17 +1036,22 @@ namespace {
|
| // Widget observer which grabs capture when the widget is activated.
|
| class CaptureOnActivationObserver : public WidgetObserver {
|
| public:
|
| - CaptureOnActivationObserver() {
|
| - }
|
| + CaptureOnActivationObserver() : activation_observed_(false) {}
|
| ~CaptureOnActivationObserver() override {}
|
|
|
| // WidgetObserver:
|
| void OnWidgetActivationChanged(Widget* widget, bool active) override {
|
| - if (active)
|
| - widget->SetCapture(NULL);
|
| + if (active) {
|
| + widget->SetCapture(nullptr);
|
| + activation_observed_ = true;
|
| + }
|
| }
|
|
|
| + bool activation_observed() const { return activation_observed_; }
|
| +
|
| private:
|
| + bool activation_observed_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(CaptureOnActivationObserver);
|
| };
|
|
|
| @@ -1073,6 +1079,15 @@ TEST_F(WidgetCaptureTest, SetCaptureToNonToplevel) {
|
| child->AddObserver(&observer);
|
| child->Show();
|
|
|
| +#if defined(OS_MACOSX) && !defined(USE_AURA)
|
| + // 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
|
| + // the OS.
|
| + base::RunLoop().RunUntilIdle();
|
| +#endif
|
| +
|
| + EXPECT_TRUE(observer.activation_observed());
|
| EXPECT_TRUE(child->HasCapture());
|
| }
|
|
|
|
|