Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1318)

Unified Diff: ui/views/widget/widget_interactive_uitest.cc

Issue 789763002: MacViews: Implement capture using NSEvent local+global monitors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20140812-MacViews-LAYERS2-PRESQUASH
Patch Set: fix sorting Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_mac_interactive_uitest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « ui/views/widget/native_widget_mac_interactive_uitest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698