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

Unified Diff: ash/wm/window_modality_controller_unittest.cc

Issue 10763004: ash: Fix touch-event handling for modal windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix-win-aura Created 8 years, 5 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 | « ash/wm/window_modality_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_modality_controller_unittest.cc
diff --git a/ash/wm/window_modality_controller_unittest.cc b/ash/wm/window_modality_controller_unittest.cc
index fdbbb03c0eae25f9875e19942e1d1620f590d085..73ddaacfa95d1cdcc562df261e3162d4b06716f1 100644
--- a/ash/wm/window_modality_controller_unittest.cc
+++ b/ash/wm/window_modality_controller_unittest.cc
@@ -281,6 +281,66 @@ TEST_F(WindowModalityControllerTest, ChangeCapture) {
EXPECT_FALSE(view->got_press());
}
+class TouchTrackerWindowDelegate : public aura::test::TestWindowDelegate {
+ public:
+ TouchTrackerWindowDelegate() : received_touch_(false) {}
+ virtual ~TouchTrackerWindowDelegate() {}
+
+ void reset() {
+ received_touch_ = false;
+ }
+
+ bool received_touch() const { return received_touch_; }
+
+ private:
+ // Overridden from aura::test::TestWindowDelegate.
+ virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE {
+ received_touch_ = true;
+ return aura::test::TestWindowDelegate::OnTouchEvent(event);
+ }
+
+ bool received_touch_;
+
+ DISALLOW_COPY_AND_ASSIGN(TouchTrackerWindowDelegate);
+};
+
+// Modality should prevent events from being passed to the transient parent.
+TEST_F(WindowModalityControllerTest, TouchEvent) {
+ TouchTrackerWindowDelegate d1;
+ scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(&d1,
+ -1, gfx::Rect(0, 0, 100, 100), NULL));
+ TouchTrackerWindowDelegate d11;
+ scoped_ptr<aura::Window> w11(aura::test::CreateTestWindowWithDelegate(&d11,
+ -11, gfx::Rect(20, 20, 50, 50), NULL));
+
+ w1->AddTransientChild(w11.get());
+ d1.reset();
+ d11.reset();
+
+ {
+ // Clicking a point within w1 should activate that window.
+ aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
+ gfx::Point(10, 10));
+ generator.PressMoveAndReleaseTouchTo(gfx::Point(10, 10));
+ EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
+ EXPECT_TRUE(d1.received_touch());
+ EXPECT_FALSE(d11.received_touch());
+ }
+
+ w11->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW);
+ d1.reset();
+ d11.reset();
+
+ {
+ // Clicking a point within w1 should activate w11.
+ aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
+ gfx::Point(10, 10));
+ generator.PressMoveAndReleaseTouchTo(gfx::Point(10, 10));
+ EXPECT_TRUE(wm::IsActiveWindow(w11.get()));
+ EXPECT_FALSE(d1.received_touch());
+ EXPECT_FALSE(d11.received_touch());
+ }
+}
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/wm/window_modality_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698