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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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/launcher/launcher_view_unittest.cc ('k') | ash/screen_ash.h » ('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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/multi_display_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"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 UpdateDisplay("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 88
89 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); 89 views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100));
90 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); 90 EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow());
91 EXPECT_EQ("650,10 100x100", normal->GetWindowScreenBounds().ToString()); 91 EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString());
92 EXPECT_EQ("50,10 100x100", 92 EXPECT_EQ("50,10 100x100",
93 normal->GetNativeView()->GetRootWindowBounds().ToString()); 93 normal->GetNativeView()->GetBoundsInRootWindow().ToString());
94 94
95 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); 95 views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100));
96 maximized->Maximize(); 96 maximized->Maximize();
97 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); 97 EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow());
98 #if !defined(OS_WIN) 98 #if !defined(OS_WIN)
99 // TODO(oshima): Window reports smaller screen size. Investigate why. 99 // TODO(oshima): Window reports smaller screen size. Investigate why.
100 EXPECT_EQ("600,0 500x500", maximized->GetWindowScreenBounds().ToString()); 100 EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString());
101 EXPECT_EQ("0,0 500x500", 101 EXPECT_EQ("0,0 500x500",
102 maximized->GetNativeView()->GetRootWindowBounds().ToString()); 102 maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
103 #endif 103 #endif
104 104
105 views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); 105 views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100));
106 minimized->Minimize(); 106 minimized->Minimize();
107 EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); 107 EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow());
108 EXPECT_EQ("800,10 100x100", 108 EXPECT_EQ("800,10 100x100",
109 minimized->GetWindowScreenBounds().ToString()); 109 minimized->GetWindowBoundsInScreen().ToString());
110 110
111 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100)); 111 views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100));
112 fullscreen->SetFullscreen(true); 112 fullscreen->SetFullscreen(true);
113 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); 113 EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow());
114 #if !defined(OS_WIN) 114 #if !defined(OS_WIN)
115 // TODO(oshima): Window reports smaller screen size. Investigate why. 115 // TODO(oshima): Window reports smaller screen size. Investigate why.
116 EXPECT_EQ("600,0 500x500", 116 EXPECT_EQ("600,0 500x500",
117 fullscreen->GetWindowScreenBounds().ToString()); 117 fullscreen->GetWindowBoundsInScreen().ToString());
118 EXPECT_EQ("0,0 500x500", 118 EXPECT_EQ("0,0 500x500",
119 fullscreen->GetNativeView()->GetRootWindowBounds().ToString()); 119 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString());
120 #endif 120 #endif
121 121
122 UpdateDisplay("0+0-600x600"); 122 UpdateDisplay("0+0-600x600");
123 123
124 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); 124 EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow());
125 EXPECT_EQ("50,10 100x100", normal->GetWindowScreenBounds().ToString()); 125 EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString());
126 EXPECT_EQ("50,10 100x100", 126 EXPECT_EQ("50,10 100x100",
127 normal->GetNativeView()->GetRootWindowBounds().ToString()); 127 normal->GetNativeView()->GetBoundsInRootWindow().ToString());
128 128
129 // Maximized area on primary display has 2px (given as 129 // Maximized area on primary display has 2px (given as
130 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. 130 // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom.
131 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); 131 EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow());
132 EXPECT_EQ("0,0 600x598", 132 EXPECT_EQ("0,0 600x598",
133 maximized->GetWindowScreenBounds().ToString()); 133 maximized->GetWindowBoundsInScreen().ToString());
134 EXPECT_EQ("0,0 600x598", 134 EXPECT_EQ("0,0 600x598",
135 maximized->GetNativeView()->GetRootWindowBounds().ToString()); 135 maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
136 136
137 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); 137 EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow());
138 EXPECT_EQ("200,10 100x100", 138 EXPECT_EQ("200,10 100x100",
139 minimized->GetWindowScreenBounds().ToString()); 139 minimized->GetWindowBoundsInScreen().ToString());
140 140
141 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); 141 EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow());
142 EXPECT_TRUE(fullscreen->IsFullscreen()); 142 EXPECT_TRUE(fullscreen->IsFullscreen());
143 EXPECT_EQ("0,0 600x600", 143 EXPECT_EQ("0,0 600x600",
144 fullscreen->GetWindowScreenBounds().ToString()); 144 fullscreen->GetWindowBoundsInScreen().ToString());
145 EXPECT_EQ("0,0 600x600", 145 EXPECT_EQ("0,0 600x600",
146 fullscreen->GetNativeView()->GetRootWindowBounds().ToString()); 146 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString());
147 147
148 // Test if the restore bounds are correctly updated. 148 // Test if the restore bounds are correctly updated.
149 wm::RestoreWindow(maximized->GetNativeView()); 149 wm::RestoreWindow(maximized->GetNativeView());
150 EXPECT_EQ("100,10 100x100", maximized->GetWindowScreenBounds().ToString()); 150 EXPECT_EQ("100,10 100x100", maximized->GetWindowBoundsInScreen().ToString());
151 EXPECT_EQ("100,10 100x100", 151 EXPECT_EQ("100,10 100x100",
152 maximized->GetNativeView()->GetRootWindowBounds().ToString()); 152 maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
153 153
154 fullscreen->SetFullscreen(false); 154 fullscreen->SetFullscreen(false);
155 EXPECT_EQ("300,10 100x100", 155 EXPECT_EQ("300,10 100x100",
156 fullscreen->GetWindowScreenBounds().ToString()); 156 fullscreen->GetWindowBoundsInScreen().ToString());
157 EXPECT_EQ("300,10 100x100", 157 EXPECT_EQ("300,10 100x100",
158 fullscreen->GetNativeView()->GetRootWindowBounds().ToString()); 158 fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString());
159 } 159 }
160 160
161 TEST_F(RootWindowControllerTest, MoveWindows_Modal) { 161 TEST_F(RootWindowControllerTest, MoveWindows_Modal) {
162 UpdateDisplay("0+0-500x500,500+0-500x500"); 162 UpdateDisplay("0+0-500x500,500+0-500x500");
163 163
164 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 164 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
165 // Emulate virtual screen coordinate system. 165 // Emulate virtual screen coordinate system.
166 root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); 166 root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500));
167 root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); 167 root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500));
168 168
(...skipping 13 matching lines...) Expand all
182 182
183 UpdateDisplay("0+0-500x500"); 183 UpdateDisplay("0+0-500x500");
184 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); 184 EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow());
185 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 185 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
186 generator_1st.ClickLeftButton(); 186 generator_1st.ClickLeftButton();
187 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); 187 EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView()));
188 } 188 }
189 189
190 } // namespace test 190 } // namespace test
191 } // namespace ash 191 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_view_unittest.cc ('k') | ash/screen_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698