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

Side by Side Diff: ash/extended_desktop_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/display/secondary_display_view.cc ('k') | ash/monitor/monitor_controller.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/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/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/window_cycle_controller.h" 9 #include "ash/wm/window_cycle_controller.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "ui/aura/client/activation_client.h" 11 #include "ui/aura/client/activation_client.h"
12 #include "ui/aura/client/capture_client.h" 12 #include "ui/aura/client/capture_client.h"
13 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
14 #include "ui/aura/focus_manager.h" 14 #include "ui/aura/focus_manager.h"
15 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
16 #include "ui/aura/test/event_generator.h" 16 #include "ui/aura/test/event_generator.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 }; 51 };
52 52
53 } // namespace 53 } // namespace
54 54
55 class ExtendedDesktopTest : public test::AshTestBase { 55 class ExtendedDesktopTest : public test::AshTestBase {
56 public: 56 public:
57 ExtendedDesktopTest() {} 57 ExtendedDesktopTest() {}
58 virtual ~ExtendedDesktopTest() {} 58 virtual ~ExtendedDesktopTest() {}
59 59
60 virtual void SetUp() OVERRIDE { 60 virtual void SetUp() OVERRIDE {
61 internal::MonitorController::SetExtendedDesktopEnabled(true); 61 internal::DisplayController::SetExtendedDesktopEnabled(true);
62 AshTestBase::SetUp(); 62 AshTestBase::SetUp();
63 } 63 }
64 64
65 virtual void TearDown() OVERRIDE { 65 virtual void TearDown() OVERRIDE {
66 AshTestBase::TearDown(); 66 AshTestBase::TearDown();
67 internal::MonitorController::SetExtendedDesktopEnabled(false); 67 internal::DisplayController::SetExtendedDesktopEnabled(false);
68 } 68 }
69 69
70 protected: 70 protected:
71 internal::MultiMonitorManager* monitor_manager() { 71 internal::MultiDisplayManager* display_manager() {
72 return static_cast<internal::MultiMonitorManager*>( 72 return static_cast<internal::MultiDisplayManager*>(
73 aura::Env::GetInstance()->monitor_manager()); 73 aura::Env::GetInstance()->display_manager());
74 } 74 }
75 75
76 private: 76 private:
77 DISALLOW_COPY_AND_ASSIGN(ExtendedDesktopTest); 77 DISALLOW_COPY_AND_ASSIGN(ExtendedDesktopTest);
78 }; 78 };
79 79
80 // Test conditions that root windows in extended desktop mode 80 // Test conditions that root windows in extended desktop mode
81 // must satisfy. 81 // must satisfy.
82 TEST_F(ExtendedDesktopTest, Basic) { 82 TEST_F(ExtendedDesktopTest, Basic) {
83 UpdateMonitor("0+0-1000x600,1001+0-600x400"); 83 UpdateDisplay("0+0-1000x600,1001+0-600x400");
84 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 84 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
85 85
86 // All root windows must have the root window controller. 86 // All root windows must have the root window controller.
87 ASSERT_EQ(2U, root_windows.size()); 87 ASSERT_EQ(2U, root_windows.size());
88 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); 88 for (Shell::RootWindowList::const_iterator iter = root_windows.begin();
89 iter != root_windows.end(); ++iter) { 89 iter != root_windows.end(); ++iter) {
90 EXPECT_TRUE(wm::GetRootWindowController(*iter) != NULL); 90 EXPECT_TRUE(wm::GetRootWindowController(*iter) != NULL);
91 } 91 }
92 // Make sure root windows share the same controllers. 92 // Make sure root windows share the same controllers.
93 EXPECT_EQ(root_windows[0]->GetFocusManager(), 93 EXPECT_EQ(root_windows[0]->GetFocusManager(),
94 root_windows[1]->GetFocusManager()); 94 root_windows[1]->GetFocusManager());
95 EXPECT_EQ(aura::client::GetActivationClient(root_windows[0]), 95 EXPECT_EQ(aura::client::GetActivationClient(root_windows[0]),
96 aura::client::GetActivationClient(root_windows[1])); 96 aura::client::GetActivationClient(root_windows[1]));
97 EXPECT_EQ(aura::client::GetCaptureClient(root_windows[0]), 97 EXPECT_EQ(aura::client::GetCaptureClient(root_windows[0]),
98 aura::client::GetCaptureClient(root_windows[1])); 98 aura::client::GetCaptureClient(root_windows[1]));
99 } 99 }
100 100
101 TEST_F(ExtendedDesktopTest, Activation) { 101 TEST_F(ExtendedDesktopTest, Activation) {
102 UpdateMonitor("0+0-1000x600,1001+0-600x400"); 102 UpdateDisplay("0+0-1000x600,1001+0-600x400");
103 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 103 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
104 104
105 // Move the active root window to the secondary. 105 // Move the active root window to the secondary.
106 Shell::GetInstance()->set_active_root_window(root_windows[1]); 106 Shell::GetInstance()->set_active_root_window(root_windows[1]);
107 107
108 views::Widget* widget_on_2nd = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 108 views::Widget* widget_on_2nd = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
109 EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow()); 109 EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow());
110 110
111 // Move the active root window back to the primary. 111 // Move the active root window back to the primary.
112 Shell::GetInstance()->set_active_root_window(root_windows[0]); 112 Shell::GetInstance()->set_active_root_window(root_windows[0]);
(...skipping 14 matching lines...) Expand all
127 127
128 generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 128 generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
129 generator_1st.ClickLeftButton(); 129 generator_1st.ClickLeftButton();
130 130
131 EXPECT_EQ(widget_on_1st->GetNativeView(), 131 EXPECT_EQ(widget_on_1st->GetNativeView(),
132 root_windows[0]->GetFocusManager()->GetFocusedWindow()); 132 root_windows[0]->GetFocusManager()->GetFocusedWindow());
133 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 133 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
134 } 134 }
135 135
136 TEST_F(ExtendedDesktopTest, SystemModal) { 136 TEST_F(ExtendedDesktopTest, SystemModal) {
137 UpdateMonitor("0+0-1000x600,1001+0-600x400"); 137 UpdateDisplay("0+0-1000x600,1001+0-600x400");
138 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 138 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
139 Shell::GetInstance()->set_active_root_window(root_windows[0]); 139 Shell::GetInstance()->set_active_root_window(root_windows[0]);
140 140
141 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 141 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
142 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 142 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
143 EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow()); 143 EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow());
144 144
145 // Change the active root window to 2nd. 145 // Change the active root window to 2nd.
146 Shell::GetInstance()->set_active_root_window(root_windows[1]); 146 Shell::GetInstance()->set_active_root_window(root_windows[1]);
147 147
148 // Open system modal. Make sure it's on 2nd root window and active. 148 // Open system modal. Make sure it's on 2nd root window and active.
149 views::Widget* modal_widget = views::Widget::CreateWindowWithParent( 149 views::Widget* modal_widget = views::Widget::CreateWindowWithParent(
150 new ModalWidgetDelegate(), NULL); 150 new ModalWidgetDelegate(), NULL);
151 modal_widget->Show(); 151 modal_widget->Show();
152 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); 152 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
153 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow()); 153 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow());
154 EXPECT_EQ(root_windows[1], Shell::GetActiveRootWindow()); 154 EXPECT_EQ(root_windows[1], Shell::GetActiveRootWindow());
155 155
156 // Clicking a widget on widget_on_1st monitor should not change activation. 156 // Clicking a widget on widget_on_1st display should not change activation.
157 aura::test::EventGenerator generator_1st(root_windows[0]); 157 aura::test::EventGenerator generator_1st(root_windows[0]);
158 generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 158 generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
159 generator_1st.ClickLeftButton(); 159 generator_1st.ClickLeftButton();
160 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); 160 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
161 EXPECT_EQ(root_windows[1], Shell::GetActiveRootWindow()); 161 EXPECT_EQ(root_windows[1], Shell::GetActiveRootWindow());
162 162
163 // Close system modal and so clicking a widget should work now. 163 // Close system modal and so clicking a widget should work now.
164 modal_widget->Close(); 164 modal_widget->Close();
165 generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 165 generator_1st.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
166 generator_1st.ClickLeftButton(); 166 generator_1st.ClickLeftButton();
167 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 167 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
168 EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow()); 168 EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow());
169 } 169 }
170 170
171 TEST_F(ExtendedDesktopTest, TestCursor) { 171 TEST_F(ExtendedDesktopTest, TestCursor) {
172 UpdateMonitor("0+0-1000x600,1001+0-600x400"); 172 UpdateDisplay("0+0-1000x600,1001+0-600x400");
173 Shell::GetInstance()->ShowCursor(false); 173 Shell::GetInstance()->ShowCursor(false);
174 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 174 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
175 EXPECT_FALSE(root_windows[0]->cursor_shown()); 175 EXPECT_FALSE(root_windows[0]->cursor_shown());
176 EXPECT_FALSE(root_windows[1]->cursor_shown()); 176 EXPECT_FALSE(root_windows[1]->cursor_shown());
177 Shell::GetInstance()->ShowCursor(true); 177 Shell::GetInstance()->ShowCursor(true);
178 EXPECT_TRUE(root_windows[0]->cursor_shown()); 178 EXPECT_TRUE(root_windows[0]->cursor_shown());
179 EXPECT_TRUE(root_windows[1]->cursor_shown()); 179 EXPECT_TRUE(root_windows[1]->cursor_shown());
180 180
181 EXPECT_EQ(ui::kCursorPointer, root_windows[0]->last_cursor().native_type()); 181 EXPECT_EQ(ui::kCursorPointer, root_windows[0]->last_cursor().native_type());
182 EXPECT_EQ(ui::kCursorPointer, root_windows[1]->last_cursor().native_type()); 182 EXPECT_EQ(ui::kCursorPointer, root_windows[1]->last_cursor().native_type());
183 Shell::GetInstance()->SetCursor(ui::kCursorCopy); 183 Shell::GetInstance()->SetCursor(ui::kCursorCopy);
184 EXPECT_EQ(ui::kCursorCopy, root_windows[0]->last_cursor().native_type()); 184 EXPECT_EQ(ui::kCursorCopy, root_windows[0]->last_cursor().native_type());
185 EXPECT_EQ(ui::kCursorCopy, root_windows[1]->last_cursor().native_type()); 185 EXPECT_EQ(ui::kCursorCopy, root_windows[1]->last_cursor().native_type());
186 } 186 }
187 187
188 TEST_F(ExtendedDesktopTest, CycleWindows) { 188 TEST_F(ExtendedDesktopTest, CycleWindows) {
189 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(true); 189 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
190 UpdateMonitor("0+0-700x500,0+0-500x500"); 190 UpdateDisplay("0+0-700x500,0+0-500x500");
191 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 191 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
192 // Emulate virtual screen coordinate system. 192 // Emulate virtual screen coordinate system.
193 root_windows[0]->SetBounds(gfx::Rect(0, 0, 700, 500)); 193 root_windows[0]->SetBounds(gfx::Rect(0, 0, 700, 500));
194 root_windows[1]->SetBounds(gfx::Rect(700, 0, 500, 500)); 194 root_windows[1]->SetBounds(gfx::Rect(700, 0, 500, 500));
195 195
196 WindowCycleController* controller = 196 WindowCycleController* controller =
197 Shell::GetInstance()->window_cycle_controller(); 197 Shell::GetInstance()->window_cycle_controller();
198 198
199 views::Widget* d1_w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 199 views::Widget* d1_w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
200 EXPECT_EQ(root_windows[0], d1_w1->GetNativeView()->GetRootWindow()); 200 EXPECT_EQ(root_windows[0], d1_w1->GetNativeView()->GetRootWindow());
(...skipping 27 matching lines...) Expand all
228 228
229 // Backwards 229 // Backwards
230 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); 230 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true);
231 EXPECT_TRUE(wm::IsActiveWindow(d1_w1->GetNativeView())); 231 EXPECT_TRUE(wm::IsActiveWindow(d1_w1->GetNativeView()));
232 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); 232 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true);
233 EXPECT_TRUE(wm::IsActiveWindow(d1_w2->GetNativeView())); 233 EXPECT_TRUE(wm::IsActiveWindow(d1_w2->GetNativeView()));
234 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); 234 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true);
235 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView())); 235 EXPECT_TRUE(wm::IsActiveWindow(d2_w1->GetNativeView()));
236 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true); 236 controller->HandleCycleWindow(WindowCycleController::BACKWARD, true);
237 EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView())); 237 EXPECT_TRUE(wm::IsActiveWindow(d2_w2->GetNativeView()));
238 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(false); 238 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
239 } 239 }
240 240
241 TEST_F(ExtendedDesktopTest, GetRootWindowAt) { 241 TEST_F(ExtendedDesktopTest, GetRootWindowAt) {
242 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(true); 242 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
243 UpdateMonitor("0+0-700x500,0+0-500x500"); 243 UpdateDisplay("0+0-700x500,0+0-500x500");
244 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 244 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
245 // Emulate virtual screen coordinate system. 245 // Emulate virtual screen coordinate system.
246 root_windows[0]->SetBounds(gfx::Rect(500, 0, 700, 500)); 246 root_windows[0]->SetBounds(gfx::Rect(500, 0, 700, 500));
247 root_windows[1]->SetBounds(gfx::Rect(0, 0, 500, 500)); 247 root_windows[1]->SetBounds(gfx::Rect(0, 0, 500, 500));
248 248
249 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(100, 100))); 249 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(100, 100)));
250 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(499, 100))); 250 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(499, 100)));
251 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(500, 300))); 251 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(500, 300)));
252 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(1200,300))); 252 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(1200,300)));
253 253
254 // Zero origin. 254 // Zero origin.
255 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(0, 0))); 255 EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(0, 0)));
256 256
257 // Out of range point should return the primary root window 257 // Out of range point should return the primary root window
258 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(-100, 0))); 258 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(-100, 0)));
259 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(1201, 100))); 259 EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(1201, 100)));
260 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(false); 260 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
261 } 261 }
262 262
263 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) { 263 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) {
264 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(true); 264 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
265 UpdateMonitor("0+0-700x500,0+0-500x500"); 265 UpdateDisplay("0+0-700x500,0+0-500x500");
266 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 266 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
267 // Emulate virtual screen coordinate system. 267 // Emulate virtual screen coordinate system.
268 root_windows[0]->SetBounds(gfx::Rect(500, 0, 700, 500)); 268 root_windows[0]->SetBounds(gfx::Rect(500, 0, 700, 500));
269 root_windows[1]->SetBounds(gfx::Rect(0, 0, 500, 500)); 269 root_windows[1]->SetBounds(gfx::Rect(0, 0, 500, 500));
270 270
271 // Containing rect. 271 // Containing rect.
272 EXPECT_EQ(root_windows[1], 272 EXPECT_EQ(root_windows[1],
273 Shell::GetRootWindowMatching(gfx::Rect(200, 10, 50, 50))); 273 Shell::GetRootWindowMatching(gfx::Rect(200, 10, 50, 50)));
274 EXPECT_EQ(root_windows[0], 274 EXPECT_EQ(root_windows[0],
275 Shell::GetRootWindowMatching(gfx::Rect(600, 10, 50, 50))); 275 Shell::GetRootWindowMatching(gfx::Rect(600, 10, 50, 50)));
(...skipping 14 matching lines...) Expand all
290 EXPECT_EQ(root_windows[1], 290 EXPECT_EQ(root_windows[1],
291 Shell::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0))); 291 Shell::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0)));
292 EXPECT_EQ(root_windows[0], 292 EXPECT_EQ(root_windows[0],
293 Shell::GetRootWindowMatching(gfx::Rect(600, 100, 0, 0))); 293 Shell::GetRootWindowMatching(gfx::Rect(600, 100, 0, 0)));
294 294
295 // Out of range rect should return the primary root window. 295 // Out of range rect should return the primary root window.
296 EXPECT_EQ(root_windows[0], 296 EXPECT_EQ(root_windows[0],
297 Shell::GetRootWindowMatching(gfx::Rect(-100, -300, 50, 50))); 297 Shell::GetRootWindowMatching(gfx::Rect(-100, -300, 50, 50)));
298 EXPECT_EQ(root_windows[0], 298 EXPECT_EQ(root_windows[0],
299 Shell::GetRootWindowMatching(gfx::Rect(0, 2000, 50, 50))); 299 Shell::GetRootWindowMatching(gfx::Rect(0, 2000, 50, 50)));
300 internal::MonitorController::SetVirtualScreenCoordinatesEnabled(false); 300 internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
301 } 301 }
302 302
303 TEST_F(ExtendedDesktopTest, Capture) { 303 TEST_F(ExtendedDesktopTest, Capture) {
304 UpdateMonitor("0+0-1000x600,1001+0-600x400"); 304 UpdateDisplay("0+0-1000x600,1001+0-600x400");
305 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 305 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
306 306
307 aura::test::EventCountDelegate r1_d1; 307 aura::test::EventCountDelegate r1_d1;
308 aura::test::EventCountDelegate r1_d2; 308 aura::test::EventCountDelegate r1_d2;
309 aura::test::EventCountDelegate r2_d1; 309 aura::test::EventCountDelegate r2_d1;
310 310
311 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 311 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
312 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 312 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
313 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 313 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
314 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0])); 314 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 EXPECT_EQ("1 1", r2_d1.GetMouseButtonCountsAndReset()); 346 EXPECT_EQ("1 1", r2_d1.GetMouseButtonCountsAndReset());
347 // Make sure the mouse_moved_handler_ is properly reset. 347 // Make sure the mouse_moved_handler_ is properly reset.
348 EXPECT_EQ("0 0 0", r1_d2.GetMouseMotionCountsAndReset()); 348 EXPECT_EQ("0 0 0", r1_d2.GetMouseMotionCountsAndReset());
349 EXPECT_EQ("0 0", r1_d2.GetMouseButtonCountsAndReset()); 349 EXPECT_EQ("0 0", r1_d2.GetMouseButtonCountsAndReset());
350 } 350 }
351 351
352 namespace internal { 352 namespace internal {
353 // Test if the Window::ConvertPointToWindow works across root windows. 353 // Test if the Window::ConvertPointToWindow works across root windows.
354 // TODO(oshima): Move multiple display suport and this test to aura. 354 // TODO(oshima): Move multiple display suport and this test to aura.
355 TEST_F(ExtendedDesktopTest, ConvertPoint) { 355 TEST_F(ExtendedDesktopTest, ConvertPoint) {
356 UpdateMonitor("0+0-1000x600,1001+0-600x400"); 356 UpdateDisplay("0+0-1000x600,1001+0-600x400");
357 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 357 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
358 gfx::Display& display_1 = 358 gfx::Display& display_1 =
359 monitor_manager()->FindDisplayForRootWindow(root_windows[0]); 359 display_manager()->FindDisplayForRootWindow(root_windows[0]);
360 EXPECT_EQ("0,0", display_1.bounds().origin().ToString()); 360 EXPECT_EQ("0,0", display_1.bounds().origin().ToString());
361 gfx::Display& display_2 = 361 gfx::Display& display_2 =
362 monitor_manager()->FindDisplayForRootWindow(root_windows[1]); 362 display_manager()->FindDisplayForRootWindow(root_windows[1]);
363 Shell::GetInstance()->set_active_root_window(root_windows[0]); 363 Shell::GetInstance()->set_active_root_window(root_windows[0]);
364 aura::Window* d1 = 364 aura::Window* d1 =
365 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView(); 365 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView();
366 Shell::GetInstance()->set_active_root_window(root_windows[1]); 366 Shell::GetInstance()->set_active_root_window(root_windows[1]);
367 aura::Window* d2 = 367 aura::Window* d2 =
368 CreateTestWidget(gfx::Rect(20, 20, 100, 100))->GetNativeView(); 368 CreateTestWidget(gfx::Rect(20, 20, 100, 100))->GetNativeView();
369 369
370 // TODO(oshima): 370 // TODO(oshima):
371 // This is a hack to emulate virtual screen coordinates. Cleanup this 371 // This is a hack to emulate virtual screen coordinates. Cleanup this
372 // when the virtual screen coordinates is implemented.a 372 // when the virtual screen coordinates is implemented.a
(...skipping 11 matching lines...) Expand all
384 // Convert point in the Root1's window to the Root2's window Coord. 384 // Convert point in the Root1's window to the Root2's window Coord.
385 p.SetPoint(0, 0); 385 p.SetPoint(0, 0);
386 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); 386 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p);
387 EXPECT_EQ("-500,-500", p.ToString()); 387 EXPECT_EQ("-500,-500", p.ToString());
388 p.SetPoint(0, 0); 388 p.SetPoint(0, 0);
389 aura::Window::ConvertPointToWindow(d1, d2, &p); 389 aura::Window::ConvertPointToWindow(d1, d2, &p);
390 EXPECT_EQ("-510,-510", p.ToString()); 390 EXPECT_EQ("-510,-510", p.ToString());
391 } 391 }
392 } // namespace internal 392 } // namespace internal
393 } // namespace ash 393 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/secondary_display_view.cc ('k') | ash/monitor/monitor_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698