| 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..9c10a88d6dab1a15598f0c25b7df74b68030da0e 100644
|
| --- a/ui/views/widget/widget_interactive_uitest.cc
|
| +++ b/ui/views/widget/widget_interactive_uitest.cc
|
| @@ -990,11 +990,18 @@ TEST_F(WidgetCaptureTest, FailedCaptureRequestIsNoop) {
|
| EXPECT_TRUE(mouse_view2->pressed());
|
| }
|
|
|
| -#if !defined(OS_CHROMEOS) && !defined(OS_WIN)
|
| +// 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 defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_MACOSX)
|
| +#define MAYBE_MouseExitOnCaptureGrab DISABLED_MouseExitOnCaptureGrab
|
| +#else
|
| +#define MAYBE_MouseExitOnCaptureGrab MouseExitOnCaptureGrab
|
| +#endif
|
| +
|
| // 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.
|
| -TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) {
|
| +TEST_F(WidgetCaptureTest, MAYBE_MouseExitOnCaptureGrab) {
|
| Widget widget1;
|
| Widget::InitParams params1 =
|
| CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
|
| @@ -1028,24 +1035,28 @@ TEST_F(WidgetCaptureTest, MouseExitOnCaptureGrab) {
|
| // in addition to the one generated by Chrome.
|
| EXPECT_LT(0, mouse_view1->ExitedCalls());
|
| }
|
| -#endif // !defined(OS_CHROMEOS)
|
|
|
| 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 +1084,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());
|
| }
|
|
|
|
|