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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 10675011: Rename the remaining usage of Monitor to Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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/monitor/secondary_monitor_view.cc ('k') | ash/screen_ash.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 (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/monitor/monitor_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/monitor/multi_monitor_manager.h" 6 #include "ash/display/multi_display_manager.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "ui/aura/env.h" 11 #include "ui/aura/env.h"
12 #include "ui/aura/root_window.h" 12 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/event_generator.h" 13 #include "ui/aura/test/event_generator.h"
14 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
15 #include "ui/views/controls/menu/menu_controller.h" 15 #include "ui/views/controls/menu/menu_controller.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 } // namespace 61 } // namespace
62 62
63 namespace test { 63 namespace test {
64 class RootWindowControllerTest : public test::AshTestBase { 64 class RootWindowControllerTest : public test::AshTestBase {
65 public: 65 public:
66 RootWindowControllerTest() {} 66 RootWindowControllerTest() {}
67 virtual ~RootWindowControllerTest() {} 67 virtual ~RootWindowControllerTest() {}
68 68
69 virtual void SetUp() OVERRIDE { 69 virtual void SetUp() OVERRIDE {
70 internal::MonitorController::SetExtendedDesktopEnabled(true); 70 internal::DisplayController::SetExtendedDesktopEnabled(true);
71 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(true); 71 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
72 AshTestBase::SetUp(); 72 AshTestBase::SetUp();
73 } 73 }
74 74
75 virtual void TearDown() OVERRIDE { 75 virtual void TearDown() OVERRIDE {
76 AshTestBase::TearDown(); 76 AshTestBase::TearDown();
77 internal::MonitorController::SetExtendedDesktopEnabled(false); 77 internal::DisplayController::SetExtendedDesktopEnabled(false);
78 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(false); 78 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
79 } 79 }
80 80
81 private: 81 private:
82 DISALLOW_COPY_AND_ASSIGN(RootWindowControllerTest); 82 DISALLOW_COPY_AND_ASSIGN(RootWindowControllerTest);
83 }; 83 };
84 84
85 TEST_F(RootWindowControllerTest, MoveWindows_Basic) { 85 TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
86 UpdateMonitor("0+0-600x600,600+0-500x500"); 86 UpdateDisplay("0+0-600x600,600+0-500x500");
87 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 87 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
88 // Emulate virtual screen coordinate system. 88 // Emulate virtual screen coordinate system.
89 root_windows[0]->SetBounds(gfx::Rect(0, 0, 600, 600)); 89 root_windows[0]->SetBounds(gfx::Rect(0, 0, 600, 600));
90 root_windows[1]->SetBounds(gfx::Rect(600, 0, 500, 500)); 90 root_windows[1]->SetBounds(gfx::Rect(600, 0, 500, 500));
91 91
92 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); 92 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100));
93 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); 93 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow());
94 EXPECT_EQ("100x100", normal->GetWindowScreenBounds().size().ToString()); 94 EXPECT_EQ("100x100", normal->GetWindowScreenBounds().size().ToString());
95 95
96 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); 96 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100));
(...skipping 10 matching lines...) Expand all
107 EXPECT_EQ("100x100", minimized->GetWindowScreenBounds().size().ToString()); 107 EXPECT_EQ("100x100", minimized->GetWindowScreenBounds().size().ToString());
108 108
109 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100)); 109 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100));
110 fullscreen->SetFullscreen(true); 110 fullscreen->SetFullscreen(true);
111 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); 111 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow());
112 #if !defined(OS_WIN) 112 #if !defined(OS_WIN)
113 // TODO(oshima): Window reports smaller screen size. Investigate why. 113 // TODO(oshima): Window reports smaller screen size. Investigate why.
114 EXPECT_EQ("500x500", fullscreen->GetWindowScreenBounds().size().ToString()); 114 EXPECT_EQ("500x500", fullscreen->GetWindowScreenBounds().size().ToString());
115 #endif 115 #endif
116 116
117 UpdateMonitor("0+0-600x600"); 117 UpdateDisplay("0+0-600x600");
118 118
119 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); 119 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow());
120 EXPECT_EQ("100x100", normal->GetWindowScreenBounds().size().ToString()); 120 EXPECT_EQ("100x100", normal->GetWindowScreenBounds().size().ToString());
121 121
122 // Maximized area on primary monitor has 2px (given as 122 // Maximized area on primary display has 2px (given as
123 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. 123 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom.
124 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); 124 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow());
125 EXPECT_EQ("600x598", maximized->GetWindowScreenBounds().size().ToString()); 125 EXPECT_EQ("600x598", maximized->GetWindowScreenBounds().size().ToString());
126 126
127 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); 127 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow());
128 EXPECT_EQ("100x100", minimized->GetWindowScreenBounds().size().ToString()); 128 EXPECT_EQ("100x100", minimized->GetWindowScreenBounds().size().ToString());
129 129
130 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); 130 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow());
131 EXPECT_TRUE(fullscreen->IsFullscreen()); 131 EXPECT_TRUE(fullscreen->IsFullscreen());
132 EXPECT_EQ("600x600", fullscreen->GetWindowScreenBounds().size().ToString()); 132 EXPECT_EQ("600x600", fullscreen->GetWindowScreenBounds().size().ToString());
133 } 133 }
134 134
135 TEST_F(RootWindowControllerTest, MoveWindows_Modal) { 135 TEST_F(RootWindowControllerTest, MoveWindows_Modal) {
136 UpdateMonitor("0+0-500x500,500+0-500x500"); 136 UpdateDisplay("0+0-500x500,500+0-500x500");
137 137
138 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 138 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
139 // Emulate virtual screen coordinate system. 139 // Emulate virtual screen coordinate system.
140 root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); 140 root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500));
141 root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); 141 root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500));
142 142
143 views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100)); 143 views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100));
144 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); 144 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow());
145 EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView())); 145 EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView()));
146 146
147 views::Widget* modal = CreateModalWidget(gfx::Rect(650, 10, 100, 100)); 147 views::Widget* modal = CreateModalWidget(gfx::Rect(650, 10, 100, 100));
148 EXPECT_EQ(root_windows[1], modal->GetNativeView()->GetRootWindow()); 148 EXPECT_EQ(root_windows[1], modal->GetNativeView()->GetRootWindow());
149 EXPECT_TRUE(GetModalContainer(root_windows[1])->Contains( 149 EXPECT_TRUE(GetModalContainer(root_windows[1])->Contains(
150 modal->GetNativeView())); 150 modal->GetNativeView()));
151 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 151 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
152 152
153 aura::test::EventGenerator generator_1st(root_windows[0]); 153 aura::test::EventGenerator generator_1st(root_windows[0]);
154 generator_1st.ClickLeftButton(); 154 generator_1st.ClickLeftButton();
155 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 155 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
156 156
157 UpdateMonitor("0+0-500x500"); 157 UpdateDisplay("0+0-500x500");
158 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); 158 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow());
159 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 159 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
160 generator_1st.ClickLeftButton(); 160 generator_1st.ClickLeftButton();
161 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 161 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
162 } 162 }
163 163
164 } // namespace test 164 } // namespace test
165 } // namespace ash 165 } // namespace ash
OLDNEW
« no previous file with comments | « ash/monitor/secondary_monitor_view.cc ('k') | ash/screen_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698