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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 115453004: Moves management of transients out of Window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unneeded parens Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_selector.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 #include "ash/screen_ash.h" 6 #include "ash/screen_ash.h"
7 #include "ash/shelf/shelf.h" 7 #include "ash/shelf/shelf.h"
8 #include "ash/shelf/shelf_widget.h" 8 #include "ash/shelf/shelf_widget.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 15 matching lines...) Expand all
26 #include "ui/aura/client/cursor_client.h" 26 #include "ui/aura/client/cursor_client.h"
27 #include "ui/aura/client/focus_client.h" 27 #include "ui/aura/client/focus_client.h"
28 #include "ui/aura/root_window.h" 28 #include "ui/aura/root_window.h"
29 #include "ui/aura/test/event_generator.h" 29 #include "ui/aura/test/event_generator.h"
30 #include "ui/aura/test/test_window_delegate.h" 30 #include "ui/aura/test/test_window_delegate.h"
31 #include "ui/aura/test/test_windows.h" 31 #include "ui/aura/test/test_windows.h"
32 #include "ui/aura/window.h" 32 #include "ui/aura/window.h"
33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 33 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
34 #include "ui/gfx/rect_conversions.h" 34 #include "ui/gfx/rect_conversions.h"
35 #include "ui/gfx/transform.h" 35 #include "ui/gfx/transform.h"
36 #include "ui/views/corewm/window_util.h"
36 37
37 namespace ash { 38 namespace ash {
38 namespace internal { 39 namespace internal {
39 40
40 namespace { 41 namespace {
41 42
42 class NonActivatableActivationDelegate 43 class NonActivatableActivationDelegate
43 : public aura::client::ActivationDelegate { 44 : public aura::client::ActivationDelegate {
44 public: 45 public:
45 virtual bool ShouldActivate() const OVERRIDE { 46 virtual bool ShouldActivate() const OVERRIDE {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); 686 EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
686 } 687 }
687 688
688 // Tests that windows with modal child windows are transformed with the modal 689 // Tests that windows with modal child windows are transformed with the modal
689 // child even though not activatable themselves. 690 // child even though not activatable themselves.
690 TEST_F(WindowSelectorTest, ModalChild) { 691 TEST_F(WindowSelectorTest, ModalChild) {
691 gfx::Rect bounds(0, 0, 400, 400); 692 gfx::Rect bounds(0, 0, 400, 400);
692 scoped_ptr<aura::Window> window1(CreateWindow(bounds)); 693 scoped_ptr<aura::Window> window1(CreateWindow(bounds));
693 scoped_ptr<aura::Window> child1(CreateWindow(bounds)); 694 scoped_ptr<aura::Window> child1(CreateWindow(bounds));
694 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); 695 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW);
695 window1->AddTransientChild(child1.get()); 696 views::corewm::AddTransientChild(window1.get(), child1.get());
696 EXPECT_EQ(window1->parent(), child1->parent()); 697 EXPECT_EQ(window1->parent(), child1->parent());
697 ToggleOverview(); 698 ToggleOverview();
698 EXPECT_TRUE(window1->IsVisible()); 699 EXPECT_TRUE(window1->IsVisible());
699 EXPECT_TRUE(child1->IsVisible()); 700 EXPECT_TRUE(child1->IsVisible());
700 EXPECT_EQ(ToEnclosingRect(GetTransformedTargetBounds(child1.get())), 701 EXPECT_EQ(ToEnclosingRect(GetTransformedTargetBounds(child1.get())),
701 ToEnclosingRect(GetTransformedTargetBounds(window1.get()))); 702 ToEnclosingRect(GetTransformedTargetBounds(window1.get())));
702 ToggleOverview(); 703 ToggleOverview();
703 } 704 }
704 705
705 // Tests that clicking a modal window's parent activates the modal window in 706 // Tests that clicking a modal window's parent activates the modal window in
706 // overview. 707 // overview.
707 TEST_F(WindowSelectorTest, ClickModalWindowParent) { 708 TEST_F(WindowSelectorTest, ClickModalWindowParent) {
708 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 180, 180))); 709 scoped_ptr<aura::Window> window1(CreateWindow(gfx::Rect(0, 0, 180, 180)));
709 scoped_ptr<aura::Window> child1(CreateWindow(gfx::Rect(200, 0, 180, 180))); 710 scoped_ptr<aura::Window> child1(CreateWindow(gfx::Rect(200, 0, 180, 180)));
710 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); 711 child1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW);
711 window1->AddTransientChild(child1.get()); 712 views::corewm::AddTransientChild(window1.get(), child1.get());
712 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get())); 713 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get()));
713 EXPECT_EQ(window1->parent(), child1->parent()); 714 EXPECT_EQ(window1->parent(), child1->parent());
714 ToggleOverview(); 715 ToggleOverview();
715 // Given that their relative positions are preserved, the windows should still 716 // Given that their relative positions are preserved, the windows should still
716 // not overlap. 717 // not overlap.
717 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get())); 718 EXPECT_FALSE(WindowsOverlapping(window1.get(), child1.get()));
718 ClickWindow(window1.get()); 719 ClickWindow(window1.get());
719 EXPECT_FALSE(IsSelecting()); 720 EXPECT_FALSE(IsSelecting());
720 721
721 // Clicking on window1 should activate child1. 722 // Clicking on window1 should activate child1.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 gfx::Rect root1_rect(0, 0, 100, 100); 823 gfx::Rect root1_rect(0, 0, 100, 100);
823 gfx::Rect root2_rect(450, 0, 100, 100); 824 gfx::Rect root2_rect(450, 0, 100, 100);
824 scoped_ptr<aura::Window> unmoved1(CreateWindow(root2_rect)); 825 scoped_ptr<aura::Window> unmoved1(CreateWindow(root2_rect));
825 scoped_ptr<aura::Window> unmoved2(CreateWindow(root2_rect)); 826 scoped_ptr<aura::Window> unmoved2(CreateWindow(root2_rect));
826 scoped_ptr<aura::Window> moved1_trans_parent(CreateWindow(root1_rect)); 827 scoped_ptr<aura::Window> moved1_trans_parent(CreateWindow(root1_rect));
827 scoped_ptr<aura::Window> moved1(CreateWindow(root1_rect)); 828 scoped_ptr<aura::Window> moved1(CreateWindow(root1_rect));
828 unmoved1->SetName("unmoved1"); 829 unmoved1->SetName("unmoved1");
829 unmoved2->SetName("unmoved2"); 830 unmoved2->SetName("unmoved2");
830 moved1->SetName("moved1"); 831 moved1->SetName("moved1");
831 moved1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); 832 moved1->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW);
832 moved1_trans_parent->AddTransientChild(moved1.get()); 833 views::corewm::AddTransientChild(moved1_trans_parent.get(), moved1.get());
833 moved1_trans_parent->SetName("moved1_trans_parent"); 834 moved1_trans_parent->SetName("moved1_trans_parent");
834 835
835 EXPECT_EQ(root_windows[0], moved1->GetRootWindow()); 836 EXPECT_EQ(root_windows[0], moved1->GetRootWindow());
836 EXPECT_EQ(root_windows[0], moved1_trans_parent->GetRootWindow()); 837 EXPECT_EQ(root_windows[0], moved1_trans_parent->GetRootWindow());
837 EXPECT_EQ(root_windows[1], unmoved1->GetRootWindow()); 838 EXPECT_EQ(root_windows[1], unmoved1->GetRootWindow());
838 EXPECT_EQ(root_windows[1], unmoved2->GetRootWindow()); 839 EXPECT_EQ(root_windows[1], unmoved2->GetRootWindow());
839 wm::ActivateWindow(unmoved2.get()); 840 wm::ActivateWindow(unmoved2.get());
840 wm::ActivateWindow(unmoved1.get()); 841 wm::ActivateWindow(unmoved1.get());
841 842
842 Cycle(WindowSelector::FORWARD); 843 Cycle(WindowSelector::FORWARD);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 wm::ActivateWindow(window1.get()); 990 wm::ActivateWindow(window1.get());
990 991
991 ToggleOverview(); 992 ToggleOverview();
992 EXPECT_TRUE(IsSelecting()); 993 EXPECT_TRUE(IsSelecting());
993 UpdateDisplay("400x400"); 994 UpdateDisplay("400x400");
994 EXPECT_FALSE(IsSelecting()); 995 EXPECT_FALSE(IsSelecting());
995 } 996 }
996 997
997 } // namespace internal 998 } // namespace internal
998 } // namespace ash 999 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698