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

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

Issue 1887263002: Revert of mash: Close system tray bubble on click outside its bounds, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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/widget.cc ('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 a946d93c94e662b4e50a3a022f7a9db02efaa1ed..e9f9397c01b52c9b1ee21372f9505247c31a0063 100644
--- a/ui/views/widget/widget_interactive_uitest.cc
+++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -83,15 +83,18 @@
// A view that always processes all mouse events.
class MouseView : public View {
public:
- MouseView() {}
+ MouseView()
+ : View(),
+ entered_(0),
+ exited_(0),
+ pressed_(0) {
+ }
~MouseView() override {}
bool OnMousePressed(const ui::MouseEvent& event) override {
pressed_++;
return true;
}
-
- void OnMouseReleased(const ui::MouseEvent& event) override { released_++; }
void OnMouseEntered(const ui::MouseEvent& event) override { entered_++; }
@@ -112,14 +115,12 @@
}
int pressed() const { return pressed_; }
- int released() const { return released_; }
private:
- int entered_ = 0;
- int exited_ = 0;
-
- int pressed_ = 0;
- int released_ = 0;
+ int entered_;
+ int exited_;
+
+ int pressed_;
DISALLOW_COPY_AND_ASSIGN(MouseView);
};
@@ -365,7 +366,7 @@
toplevel->SetContentsView(container);
EXPECT_FALSE(toplevel->HasCapture());
- toplevel->SetCapture(nullptr);
+ toplevel->SetCapture(NULL);
EXPECT_TRUE(toplevel->HasCapture());
// By default, mouse release removes capture.
@@ -378,53 +379,15 @@
// Now a mouse release shouldn't remove capture.
toplevel->set_auto_release_capture(false);
- toplevel->SetCapture(nullptr);
+ toplevel->SetCapture(NULL);
EXPECT_TRUE(toplevel->HasCapture());
toplevel->OnMouseEvent(&release);
EXPECT_TRUE(toplevel->HasCapture());
toplevel->ReleaseCapture();
EXPECT_FALSE(toplevel->HasCapture());
- toplevel->CloseNow();
-}
-
-// Tests capture when auto-release is disabled and events are captured to a
-// specific view.
-TEST_F(WidgetTestInteractive, CaptureToViewWithoutAutoRelease) {
- Widget* widget = CreateTopLevelFramelessPlatformWidget();
- MouseView* target_view = new MouseView;
- widget->SetContentsView(target_view);
-
- // Set capture to a specific view.
- widget->set_auto_release_capture(false);
- widget->SetCapture(target_view);
- EXPECT_TRUE(widget->HasCapture());
-
- // A click is routed to the view and capture is not released on mouse release.
- gfx::Point point(12, 34);
- ui::MouseEvent press(ui::ET_MOUSE_PRESSED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED, point, point,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON);
- widget->OnMouseEvent(&press);
- widget->OnMouseEvent(&release);
- EXPECT_EQ(1, target_view->pressed());
- EXPECT_EQ(1, target_view->released());
-
- // Future events are still routed to the view.
- widget->OnMouseEvent(&press);
- widget->OnMouseEvent(&release);
- EXPECT_EQ(2, target_view->pressed());
- EXPECT_EQ(2, target_view->released());
-
- // Capture must be explicitly released.
- EXPECT_TRUE(widget->HasCapture());
- widget->ReleaseCapture();
- EXPECT_FALSE(widget->HasCapture());
-
- widget->CloseNow();
+ toplevel->Close();
+ RunPendingMessages();
}
TEST_F(WidgetTestInteractive, ResetCaptureOnGestureEnd) {
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698