| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "ash/shell_window_ids.h" | 6 #include "ash/shell_window_ids.h" |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "ash/test/test_activation_delegate.h" | 8 #include "ash/test/test_activation_delegate.h" |
| 9 #include "ash/wm/activation_controller.h" | 9 #include "ash/wm/activation_controller.h" |
| 10 #include "ash/wm/cursor_manager.h" | 10 #include "ash/wm/cursor_manager.h" |
| 11 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 12 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
| 13 #include "ui/aura/client/activation_delegate.h" | 13 #include "ui/aura/client/activation_delegate.h" |
| 14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
| 15 #include "ui/aura/focus_manager.h" | 15 #include "ui/aura/focus_manager.h" |
| 16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/shared/compound_event_filter.h" | |
| 18 #include "ui/aura/shared/input_method_event_filter.h" | |
| 19 #include "ui/aura/test/aura_test_base.h" | 17 #include "ui/aura/test/aura_test_base.h" |
| 20 #include "ui/aura/test/event_generator.h" | 18 #include "ui/aura/test/event_generator.h" |
| 21 #include "ui/aura/test/test_event_filter.h" | 19 #include "ui/aura/test/test_event_filter.h" |
| 22 #include "ui/aura/test/test_window_delegate.h" | 20 #include "ui/aura/test/test_window_delegate.h" |
| 23 #include "ui/aura/test/test_windows.h" | 21 #include "ui/aura/test/test_windows.h" |
| 24 #include "ui/base/cursor/cursor.h" | 22 #include "ui/base/cursor/cursor.h" |
| 25 #include "ui/base/events/event.h" | 23 #include "ui/base/events/event.h" |
| 26 #include "ui/base/hit_test.h" | 24 #include "ui/base/hit_test.h" |
| 27 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
| 26 #include "ui/views/corewm/compound_event_filter.h" |
| 27 #include "ui/views/corewm/input_method_event_filter.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 base::TimeDelta getTime() { | 31 base::TimeDelta getTime() { |
| 32 return base::Time::NowFromSystemTime() - base::Time(); | 32 return base::Time::NowFromSystemTime() - base::Time(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 namespace ash { | 37 namespace ash { |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Creates a window and make it active | 518 // Creates a window and make it active |
| 519 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindow( | 519 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindow( |
| 520 SK_ColorWHITE, -1, gfx::Rect(0, 0, 100, 100), NULL)); | 520 SK_ColorWHITE, -1, gfx::Rect(0, 0, 100, 100), NULL)); |
| 521 wm::ActivateWindow(w1.get()); | 521 wm::ActivateWindow(w1.get()); |
| 522 | 522 |
| 523 // Creates two addition filters | 523 // Creates two addition filters |
| 524 scoped_ptr<aura::test::TestEventFilter> f1(new aura::test::TestEventFilter); | 524 scoped_ptr<aura::test::TestEventFilter> f1(new aura::test::TestEventFilter); |
| 525 scoped_ptr<aura::test::TestEventFilter> f2(new aura::test::TestEventFilter); | 525 scoped_ptr<aura::test::TestEventFilter> f2(new aura::test::TestEventFilter); |
| 526 | 526 |
| 527 // Adds them to root window event filter. | 527 // Adds them to root window event filter. |
| 528 aura::shared::CompoundEventFilter* env_filter = | 528 views::corewm::CompoundEventFilter* env_filter = |
| 529 Shell::GetInstance()->env_filter(); | 529 Shell::GetInstance()->env_filter(); |
| 530 env_filter->AddFilter(f1.get()); | 530 env_filter->AddFilter(f1.get()); |
| 531 env_filter->AddFilter(f2.get()); | 531 env_filter->AddFilter(f2.get()); |
| 532 | 532 |
| 533 // Dispatches mouse and keyboard events. | 533 // Dispatches mouse and keyboard events. |
| 534 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); | 534 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); |
| 535 root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); | 535 root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); |
| 536 ui::MouseEvent mouse_pressed( | 536 ui::MouseEvent mouse_pressed( |
| 537 ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); | 537 ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); |
| 538 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); | 538 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 EXPECT_TRUE(cursor_manager->cursor_visible()); | 630 EXPECT_TRUE(cursor_manager->cursor_visible()); |
| 631 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); | 631 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); |
| 632 EXPECT_FALSE(cursor_manager->cursor_visible()); | 632 EXPECT_FALSE(cursor_manager->cursor_visible()); |
| 633 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); | 633 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); |
| 634 EXPECT_TRUE(cursor_manager->cursor_visible()); | 634 EXPECT_TRUE(cursor_manager->cursor_visible()); |
| 635 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2); | 635 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2); |
| 636 EXPECT_TRUE(cursor_manager->cursor_visible()); | 636 EXPECT_TRUE(cursor_manager->cursor_visible()); |
| 637 } | 637 } |
| 638 | 638 |
| 639 } // namespace ash | 639 } // namespace ash |
| OLD | NEW |