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/shell_test_api.h" | 8 #include "ash/test/shell_test_api.h" |
9 #include "ash/test/test_activation_delegate.h" | 9 #include "ash/test/test_activation_delegate.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 root_window->SetTransform(transform); | 589 root_window->SetTransform(transform); |
590 | 590 |
591 test::TestActivationDelegate d1; | 591 test::TestActivationDelegate d1; |
592 aura::test::TestWindowDelegate wd; | 592 aura::test::TestWindowDelegate wd; |
593 scoped_ptr<aura::Window> w1( | 593 scoped_ptr<aura::Window> w1( |
594 CreateTestWindowInShellWithDelegate(&wd, 1, gfx::Rect(0, 10, 50, 50))); | 594 CreateTestWindowInShellWithDelegate(&wd, 1, gfx::Rect(0, 10, 50, 50))); |
595 d1.SetWindow(w1.get()); | 595 d1.SetWindow(w1.get()); |
596 w1->Show(); | 596 w1->Show(); |
597 | 597 |
598 gfx::Point miss_point(5, 5); | 598 gfx::Point miss_point(5, 5); |
599 transform.TransformPoint(miss_point); | 599 transform.TransformPoint(&miss_point); |
600 ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, | 600 ui::MouseEvent mouseev1(ui::ET_MOUSE_PRESSED, |
601 miss_point, | 601 miss_point, |
602 miss_point, | 602 miss_point, |
603 ui::EF_LEFT_MOUSE_BUTTON); | 603 ui::EF_LEFT_MOUSE_BUTTON); |
604 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev1); | 604 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev1); |
605 EXPECT_EQ(NULL, aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); | 605 EXPECT_EQ(NULL, aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); |
606 ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, | 606 ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, |
607 miss_point, | 607 miss_point, |
608 miss_point, | 608 miss_point, |
609 ui::EF_LEFT_MOUSE_BUTTON); | 609 ui::EF_LEFT_MOUSE_BUTTON); |
610 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup); | 610 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup); |
611 | 611 |
612 gfx::Point hit_point(5, 15); | 612 gfx::Point hit_point(5, 15); |
613 transform.TransformPoint(hit_point); | 613 transform.TransformPoint(&hit_point); |
614 ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, | 614 ui::MouseEvent mouseev2(ui::ET_MOUSE_PRESSED, |
615 hit_point, | 615 hit_point, |
616 hit_point, | 616 hit_point, |
617 ui::EF_LEFT_MOUSE_BUTTON); | 617 ui::EF_LEFT_MOUSE_BUTTON); |
618 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev2); | 618 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev2); |
619 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 619 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
620 EXPECT_EQ(w1.get(), | 620 EXPECT_EQ(w1.get(), |
621 aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); | 621 aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); |
622 } | 622 } |
623 | 623 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 // Mouse move should show the cursor. | 828 // Mouse move should show the cursor. |
829 observer_a.reset(); | 829 observer_a.reset(); |
830 observer_b.reset(); | 830 observer_b.reset(); |
831 generator.MoveMouseTo(50, 50); | 831 generator.MoveMouseTo(50, 50); |
832 EXPECT_TRUE(observer_a.did_visibility_change()); | 832 EXPECT_TRUE(observer_a.did_visibility_change()); |
833 EXPECT_FALSE(observer_b.did_visibility_change()); | 833 EXPECT_FALSE(observer_b.did_visibility_change()); |
834 EXPECT_TRUE(observer_a.is_cursor_visible()); | 834 EXPECT_TRUE(observer_a.is_cursor_visible()); |
835 } | 835 } |
836 | 836 |
837 } // namespace ash | 837 } // namespace ash |
OLD | NEW |