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

Unified Diff: ui/views/corewm/compound_event_filter_unittest.cc

Issue 11275139: Move ui\aura\shared to ui\views\corewm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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/corewm/compound_event_filter.cc ('k') | ui/views/corewm/input_method_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/compound_event_filter_unittest.cc
===================================================================
--- ui/views/corewm/compound_event_filter_unittest.cc (revision 167200)
+++ ui/views/corewm/compound_event_filter_unittest.cc (working copy)
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura/shared/compound_event_filter.h"
+#include "ui/views/corewm/compound_event_filter.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/cursor_client.h"
@@ -51,35 +51,37 @@
}
-namespace aura {
+namespace views {
+namespace corewm {
namespace {
// An event filter that consumes all gesture events.
-class ConsumeGestureEventFilter : public EventFilter {
+class ConsumeGestureEventFilter : public aura::EventFilter {
public:
ConsumeGestureEventFilter() {}
virtual ~ConsumeGestureEventFilter() {}
private:
// Overridden from EventFilter.
- virtual bool PreHandleKeyEvent(Window* target, ui::KeyEvent* event) OVERRIDE {
+ virtual bool PreHandleKeyEvent(aura::Window* target,
+ ui::KeyEvent* event) OVERRIDE {
return false;
}
- virtual bool PreHandleMouseEvent(Window* target,
+ virtual bool PreHandleMouseEvent(aura::Window* target,
ui::MouseEvent* event) OVERRIDE {
return false;
}
virtual ui::EventResult PreHandleTouchEvent(
- Window* target,
+ aura::Window* target,
ui::TouchEvent* event) OVERRIDE {
return ui::ER_UNHANDLED;
}
virtual ui::EventResult PreHandleGestureEvent(
- Window* target,
+ aura::Window* target,
ui::GestureEvent* event) OVERRIDE {
return ui::ER_CONSUMED;
}
@@ -89,16 +91,13 @@
} // namespace
-namespace test {
+typedef aura::test::AuraTestBase CompoundEventFilterTest;
-typedef AuraTestBase CompoundEventFilterTest;
-
TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
- scoped_ptr<shared::CompoundEventFilter> compound_filter(
- new shared::CompoundEventFilter());
+ scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
- TestWindowDelegate delegate;
- scoped_ptr<Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
+ aura::test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
gfx::Rect(5, 5, 100, 100), NULL));
window->Show();
window->SetCapture();
@@ -145,11 +144,10 @@
// Tests that tapping a window gives the window focus.
TEST_F(CompoundEventFilterTest, GestureFocusesWindow) {
- scoped_ptr<shared::CompoundEventFilter> compound_filter(
- new shared::CompoundEventFilter());
+ scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
- TestWindowDelegate delegate;
- scoped_ptr<Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
+ aura::test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
gfx::Rect(5, 5, 100, 100), NULL));
window->Show();
@@ -157,7 +155,7 @@
EXPECT_FALSE(window->HasFocus());
// Tap on the window should give it focus.
- EventGenerator generator(root_window(), gfx::Point(50, 50));
+ aura::test::EventGenerator generator(root_window(), gfx::Point(50, 50));
generator.PressTouch();
EXPECT_TRUE(window->HasFocus());
aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
@@ -166,13 +164,12 @@
// Tests that if an event filter consumes a gesture, then it doesn't focus the
// window.
TEST_F(CompoundEventFilterTest, FilterConsumedGesture) {
- scoped_ptr<shared::CompoundEventFilter> compound_filter(
- new shared::CompoundEventFilter());
- scoped_ptr<EventFilter> gesture_filter(new ConsumeGestureEventFilter());
+ scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
+ scoped_ptr<aura::EventFilter> gesture_filter(new ConsumeGestureEventFilter);
compound_filter->AddFilter(gesture_filter.get());
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
- TestWindowDelegate delegate;
- scoped_ptr<Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
+ aura::test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
gfx::Rect(5, 5, 100, 100), NULL));
window->Show();
@@ -181,7 +178,7 @@
// Tap on the window should not focus it since the filter will be consuming
// the gestures.
- EventGenerator generator(root_window(), gfx::Point(50, 50));
+ aura::test::EventGenerator generator(root_window(), gfx::Point(50, 50));
generator.PressTouch();
EXPECT_FALSE(window->HasFocus());
@@ -189,5 +186,5 @@
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
}
-} // namespace test
-} // namespace aura
+} // namespace corewm
+} // namespace views
« no previous file with comments | « ui/views/corewm/compound_event_filter.cc ('k') | ui/views/corewm/input_method_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698