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/corewm/compound_event_filter_unittest.cc

Issue 11412315: Make the cursor have separate mode for disabled mouse events and invisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 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
Index: ui/views/corewm/compound_event_filter_unittest.cc
diff --git a/ui/views/corewm/compound_event_filter_unittest.cc b/ui/views/corewm/compound_event_filter_unittest.cc
index f8af783a2a3bf8173db59183f88d94e0c7ebdcf7..e4cb5159b627634d8fee8ec8e047436fc3ede89a 100644
--- a/ui/views/corewm/compound_event_filter_unittest.cc
+++ b/ui/views/corewm/compound_event_filter_unittest.cc
@@ -20,10 +20,12 @@ base::TimeDelta GetTime() {
return base::Time::NowFromSystemTime() - base::Time();
}
-class TestVisibleClient : public aura::client::CursorClient {
+class TestCursorClient : public aura::client::CursorClient {
public:
- TestVisibleClient() : visible_(true) {}
- virtual ~TestVisibleClient() {}
+ TestCursorClient() : visible_(true), enabled_(true) {}
+ virtual ~TestCursorClient() {}
+
+ bool enabled() const { return enabled_; }
virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE {
}
@@ -36,6 +38,10 @@ class TestVisibleClient : public aura::client::CursorClient {
return visible_;
}
+ virtual void EnableCursor(bool enabled) OVERRIDE {
+ enabled_ = enabled;
+ }
+
virtual void SetDeviceScaleFactor(float scale_factor) OVERRIDE {
}
@@ -47,6 +53,7 @@ class TestVisibleClient : public aura::client::CursorClient {
private:
bool visible_;
+ bool enabled_;
};
}
@@ -84,35 +91,35 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
window->Show();
window->SetCapture();
- TestVisibleClient cursor_client;
+ TestCursorClient cursor_client;
aura::client::SetCursorClient(root_window(), &cursor_client);
ui::MouseEvent mouse0(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse0);
- EXPECT_TRUE(cursor_client.IsCursorVisible());
+ EXPECT_TRUE(cursor_client.enabled());
// This press is required for the GestureRecognizer to associate a target
// with kTouchId
ui::TouchEvent press0(
ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press0);
- EXPECT_FALSE(cursor_client.IsCursorVisible());
+ EXPECT_FALSE(cursor_client.enabled());
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 1, GetTime());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
- EXPECT_FALSE(cursor_client.IsCursorVisible());
+ EXPECT_FALSE(cursor_client.enabled());
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 1, GetTime());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
- EXPECT_FALSE(cursor_client.IsCursorVisible());
+ EXPECT_FALSE(cursor_client.enabled());
ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
- // Move the cursor again. The cursor should be visible.
+ // Move the cursor again. The cursor should be enabled.
root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
- EXPECT_TRUE(cursor_client.IsCursorVisible());
+ EXPECT_TRUE(cursor_client.enabled());
// Now activate the window and press on it again.
ui::TouchEvent press1(
@@ -120,7 +127,7 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
aura::client::GetActivationClient(
root_window())->ActivateWindow(window.get());
root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
- EXPECT_FALSE(cursor_client.IsCursorVisible());
+ EXPECT_FALSE(cursor_client.enabled());
aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
}

Powered by Google App Engine
This is Rietveld 408576698