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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 2653593004: chromeos: Remove AshTestBase::SupportsMultipleDisplays (Closed)
Patch Set: Created 3 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
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/common/system/tray/system_tray.h" 5 #include "ash/common/system/tray/system_tray.h"
6 #include "ash/common/wm/root_window_finder.h" 6 #include "ash/common/wm/root_window_finder.h"
7 #include "ash/common/wm_window.h" 7 #include "ash/common/wm_window.h"
8 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 views::Widget* widget = new views::Widget; 161 views::Widget* widget = new views::Widget;
162 widget->Init(params); 162 widget->Init(params);
163 widget->Show(); 163 widget->Show();
164 return widget; 164 return widget;
165 } 165 }
166 }; 166 };
167 167
168 // Test conditions that root windows in extended desktop mode 168 // Test conditions that root windows in extended desktop mode
169 // must satisfy. 169 // must satisfy.
170 TEST_F(ExtendedDesktopTest, Basic) { 170 TEST_F(ExtendedDesktopTest, Basic) {
171 if (!SupportsMultipleDisplays())
172 return;
173
174 UpdateDisplay("1000x600,600x400"); 171 UpdateDisplay("1000x600,600x400");
175 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 172 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
176 173
177 // All root windows must have the root window controller. 174 // All root windows must have the root window controller.
178 ASSERT_EQ(2U, root_windows.size()); 175 ASSERT_EQ(2U, root_windows.size());
179 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); 176 for (aura::Window::Windows::const_iterator iter = root_windows.begin();
180 iter != root_windows.end(); ++iter) { 177 iter != root_windows.end(); ++iter) {
181 EXPECT_TRUE(GetRootWindowController(*iter) != nullptr); 178 EXPECT_TRUE(GetRootWindowController(*iter) != nullptr);
182 } 179 }
183 // Make sure root windows share the same controllers. 180 // Make sure root windows share the same controllers.
184 EXPECT_EQ(aura::client::GetFocusClient(root_windows[0]), 181 EXPECT_EQ(aura::client::GetFocusClient(root_windows[0]),
185 aura::client::GetFocusClient(root_windows[1])); 182 aura::client::GetFocusClient(root_windows[1]));
186 EXPECT_EQ(aura::client::GetActivationClient(root_windows[0]), 183 EXPECT_EQ(aura::client::GetActivationClient(root_windows[0]),
187 aura::client::GetActivationClient(root_windows[1])); 184 aura::client::GetActivationClient(root_windows[1]));
188 EXPECT_EQ(aura::client::GetCaptureClient(root_windows[0]), 185 EXPECT_EQ(aura::client::GetCaptureClient(root_windows[0]),
189 aura::client::GetCaptureClient(root_windows[1])); 186 aura::client::GetCaptureClient(root_windows[1]));
190 } 187 }
191 188
192 TEST_F(ExtendedDesktopTest, Activation) { 189 TEST_F(ExtendedDesktopTest, Activation) {
193 if (!SupportsMultipleDisplays())
194 return;
195
196 UpdateDisplay("1000x600,600x400"); 190 UpdateDisplay("1000x600,600x400");
197 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 191 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
198 192
199 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 193 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
200 views::Widget* widget_on_2nd = 194 views::Widget* widget_on_2nd =
201 CreateTestWidget(gfx::Rect(1200, 10, 100, 100)); 195 CreateTestWidget(gfx::Rect(1200, 10, 100, 100));
202 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow()); 196 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow());
203 EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow()); 197 EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow());
204 198
205 EXPECT_EQ(widget_on_2nd->GetNativeView(), 199 EXPECT_EQ(widget_on_2nd->GetNativeView(),
(...skipping 11 matching lines...) Expand all
217 211
218 event_generator.MoveMouseToCenterOf(widget_on_2nd->GetNativeView()); 212 event_generator.MoveMouseToCenterOf(widget_on_2nd->GetNativeView());
219 event_generator.ClickLeftButton(); 213 event_generator.ClickLeftButton();
220 214
221 EXPECT_EQ(widget_on_2nd->GetNativeView(), 215 EXPECT_EQ(widget_on_2nd->GetNativeView(),
222 aura::client::GetFocusClient(root_windows[0])->GetFocusedWindow()); 216 aura::client::GetFocusClient(root_windows[0])->GetFocusedWindow());
223 EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView())); 217 EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView()));
224 } 218 }
225 219
226 TEST_F(ExtendedDesktopTest, SystemModal) { 220 TEST_F(ExtendedDesktopTest, SystemModal) {
227 if (!SupportsMultipleDisplays())
228 return;
229
230 UpdateDisplay("1000x600,600x400"); 221 UpdateDisplay("1000x600,600x400");
231 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 222 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
232 223
233 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 224 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
234 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 225 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
235 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow()); 226 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow());
236 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); 227 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow());
237 228
238 // Open system modal. Make sure it's on 2nd root window and active. 229 // Open system modal. Make sure it's on 2nd root window and active.
239 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds( 230 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds(
(...skipping 14 matching lines...) Expand all
254 245
255 // Close system modal and so clicking a widget should work now. 246 // Close system modal and so clicking a widget should work now.
256 modal_widget->Close(); 247 modal_widget->Close();
257 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 248 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
258 event_generator.ClickLeftButton(); 249 event_generator.ClickLeftButton();
259 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 250 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
260 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); 251 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow());
261 } 252 }
262 253
263 TEST_F(ExtendedDesktopTest, TestCursor) { 254 TEST_F(ExtendedDesktopTest, TestCursor) {
264 if (!SupportsMultipleDisplays())
265 return;
266
267 UpdateDisplay("1000x600,600x400"); 255 UpdateDisplay("1000x600,600x400");
268 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 256 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
269 aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); 257 aura::WindowTreeHost* host0 = root_windows[0]->GetHost();
270 aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); 258 aura::WindowTreeHost* host1 = root_windows[1]->GetHost();
271 EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type()); 259 EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type());
272 EXPECT_EQ(ui::kCursorNull, host1->last_cursor().native_type()); 260 EXPECT_EQ(ui::kCursorNull, host1->last_cursor().native_type());
273 Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy); 261 Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy);
274 EXPECT_EQ(ui::kCursorCopy, host0->last_cursor().native_type()); 262 EXPECT_EQ(ui::kCursorCopy, host0->last_cursor().native_type());
275 EXPECT_EQ(ui::kCursorCopy, host1->last_cursor().native_type()); 263 EXPECT_EQ(ui::kCursorCopy, host1->last_cursor().native_type());
276 } 264 }
277 265
278 TEST_F(ExtendedDesktopTest, TestCursorLocation) { 266 TEST_F(ExtendedDesktopTest, TestCursorLocation) {
279 if (!SupportsMultipleDisplays())
280 return;
281
282 UpdateDisplay("1000x600,600x400"); 267 UpdateDisplay("1000x600,600x400");
283 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 268 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
284 aura::test::WindowTestApi root_window0_test_api(root_windows[0]); 269 aura::test::WindowTestApi root_window0_test_api(root_windows[0]);
285 aura::test::WindowTestApi root_window1_test_api(root_windows[1]); 270 aura::test::WindowTestApi root_window1_test_api(root_windows[1]);
286 271
287 root_windows[0]->MoveCursorTo(gfx::Point(10, 10)); 272 root_windows[0]->MoveCursorTo(gfx::Point(10, 10));
288 EXPECT_EQ("10,10", 273 EXPECT_EQ("10,10",
289 display::Screen::GetScreen()->GetCursorScreenPoint().ToString()); 274 display::Screen::GetScreen()->GetCursorScreenPoint().ToString());
290 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); 275 EXPECT_TRUE(root_window0_test_api.ContainsMouse());
291 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); 276 EXPECT_FALSE(root_window1_test_api.ContainsMouse());
292 root_windows[1]->MoveCursorTo(gfx::Point(10, 20)); 277 root_windows[1]->MoveCursorTo(gfx::Point(10, 20));
293 EXPECT_EQ("1010,20", 278 EXPECT_EQ("1010,20",
294 display::Screen::GetScreen()->GetCursorScreenPoint().ToString()); 279 display::Screen::GetScreen()->GetCursorScreenPoint().ToString());
295 EXPECT_FALSE(root_window0_test_api.ContainsMouse()); 280 EXPECT_FALSE(root_window0_test_api.ContainsMouse());
296 EXPECT_TRUE(root_window1_test_api.ContainsMouse()); 281 EXPECT_TRUE(root_window1_test_api.ContainsMouse());
297 root_windows[0]->MoveCursorTo(gfx::Point(20, 10)); 282 root_windows[0]->MoveCursorTo(gfx::Point(20, 10));
298 EXPECT_EQ("20,10", 283 EXPECT_EQ("20,10",
299 display::Screen::GetScreen()->GetCursorScreenPoint().ToString()); 284 display::Screen::GetScreen()->GetCursorScreenPoint().ToString());
300 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); 285 EXPECT_TRUE(root_window0_test_api.ContainsMouse());
301 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); 286 EXPECT_FALSE(root_window1_test_api.ContainsMouse());
302 } 287 }
303 288
304 TEST_F(ExtendedDesktopTest, GetRootWindowAt) { 289 TEST_F(ExtendedDesktopTest, GetRootWindowAt) {
305 if (!SupportsMultipleDisplays())
306 return;
307
308 UpdateDisplay("700x500,500x500"); 290 UpdateDisplay("700x500,500x500");
309 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT); 291 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT);
310 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 292 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
311 293
312 EXPECT_EQ(root_windows[1], WmWindow::GetAuraWindow( 294 EXPECT_EQ(root_windows[1], WmWindow::GetAuraWindow(
313 wm::GetRootWindowAt(gfx::Point(-400, 100)))); 295 wm::GetRootWindowAt(gfx::Point(-400, 100))));
314 EXPECT_EQ(root_windows[1], 296 EXPECT_EQ(root_windows[1],
315 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(-1, 100)))); 297 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(-1, 100))));
316 EXPECT_EQ(root_windows[0], 298 EXPECT_EQ(root_windows[0],
317 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(0, 300)))); 299 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(0, 300))));
318 EXPECT_EQ(root_windows[0], 300 EXPECT_EQ(root_windows[0],
319 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(700, 300)))); 301 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(700, 300))));
320 302
321 // Zero origin. 303 // Zero origin.
322 EXPECT_EQ(root_windows[0], 304 EXPECT_EQ(root_windows[0],
323 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(0, 0)))); 305 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(0, 0))));
324 306
325 // Out of range point should return the nearest root window 307 // Out of range point should return the nearest root window
326 EXPECT_EQ(root_windows[1], 308 EXPECT_EQ(root_windows[1],
327 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(-600, 0)))); 309 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(-600, 0))));
328 EXPECT_EQ(root_windows[0], 310 EXPECT_EQ(root_windows[0],
329 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(701, 100)))); 311 WmWindow::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(701, 100))));
330 } 312 }
331 313
332 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) { 314 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) {
333 if (!SupportsMultipleDisplays())
334 return;
335
336 UpdateDisplay("700x500,500x500"); 315 UpdateDisplay("700x500,500x500");
337 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT); 316 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT);
338 317
339 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 318 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
340 319
341 // Containing rect. 320 // Containing rect.
342 EXPECT_EQ(root_windows[1], WmWindow::GetAuraWindow(wm::GetRootWindowMatching( 321 EXPECT_EQ(root_windows[1], WmWindow::GetAuraWindow(wm::GetRootWindowMatching(
343 gfx::Rect(-300, 10, 50, 50)))); 322 gfx::Rect(-300, 10, 50, 50))));
344 EXPECT_EQ(root_windows[0], WmWindow::GetAuraWindow(wm::GetRootWindowMatching( 323 EXPECT_EQ(root_windows[0], WmWindow::GetAuraWindow(wm::GetRootWindowMatching(
345 gfx::Rect(100, 10, 50, 50)))); 324 gfx::Rect(100, 10, 50, 50))));
(...skipping 17 matching lines...) Expand all
363 gfx::Rect(100, 100, 0, 0)))); 342 gfx::Rect(100, 100, 0, 0))));
364 343
365 // Out of range rect should return the primary root window. 344 // Out of range rect should return the primary root window.
366 EXPECT_EQ(root_windows[0], WmWindow::GetAuraWindow(wm::GetRootWindowMatching( 345 EXPECT_EQ(root_windows[0], WmWindow::GetAuraWindow(wm::GetRootWindowMatching(
367 gfx::Rect(-600, -300, 50, 50)))); 346 gfx::Rect(-600, -300, 50, 50))));
368 EXPECT_EQ(root_windows[0], WmWindow::GetAuraWindow(wm::GetRootWindowMatching( 347 EXPECT_EQ(root_windows[0], WmWindow::GetAuraWindow(wm::GetRootWindowMatching(
369 gfx::Rect(0, 1000, 50, 50)))); 348 gfx::Rect(0, 1000, 50, 50))));
370 } 349 }
371 350
372 TEST_F(ExtendedDesktopTest, Capture) { 351 TEST_F(ExtendedDesktopTest, Capture) {
373 if (!SupportsMultipleDisplays())
374 return;
375
376 UpdateDisplay("1000x600,600x400"); 352 UpdateDisplay("1000x600,600x400");
377 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 353 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
378 354
379 aura::test::EventCountDelegate r1_d1; 355 aura::test::EventCountDelegate r1_d1;
380 aura::test::EventCountDelegate r1_d2; 356 aura::test::EventCountDelegate r1_d2;
381 aura::test::EventCountDelegate r2_d1; 357 aura::test::EventCountDelegate r2_d1;
382 358
383 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 359 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
384 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 360 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
385 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 361 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 generator.MoveMouseToCenterOf(r2_w1.get()); 409 generator.MoveMouseToCenterOf(r2_w1.get());
434 generator.ClickLeftButton(); 410 generator.ClickLeftButton();
435 EXPECT_EQ("1 1 0", r2_d1.GetMouseMotionCountsAndReset()); 411 EXPECT_EQ("1 1 0", r2_d1.GetMouseMotionCountsAndReset());
436 EXPECT_EQ("1 1", r2_d1.GetMouseButtonCountsAndReset()); 412 EXPECT_EQ("1 1", r2_d1.GetMouseButtonCountsAndReset());
437 // Make sure the mouse_moved_handler_ is properly reset. 413 // Make sure the mouse_moved_handler_ is properly reset.
438 EXPECT_EQ("0 0 0", r1_d2.GetMouseMotionCountsAndReset()); 414 EXPECT_EQ("0 0 0", r1_d2.GetMouseMotionCountsAndReset());
439 EXPECT_EQ("0 0", r1_d2.GetMouseButtonCountsAndReset()); 415 EXPECT_EQ("0 0", r1_d2.GetMouseButtonCountsAndReset());
440 } 416 }
441 417
442 TEST_F(ExtendedDesktopTest, CaptureEventLocation) { 418 TEST_F(ExtendedDesktopTest, CaptureEventLocation) {
443 if (!SupportsMultipleDisplays())
444 return;
445
446 UpdateDisplay("1000x600,600x400"); 419 UpdateDisplay("1000x600,600x400");
447 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 420 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
448 421
449 aura::test::EventCountDelegate r1_d1; 422 aura::test::EventCountDelegate r1_d1;
450 aura::test::EventCountDelegate r1_d2; 423 aura::test::EventCountDelegate r1_d2;
451 aura::test::EventCountDelegate r2_d1; 424 aura::test::EventCountDelegate r2_d1;
452 425
453 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 426 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
454 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 427 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
455 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 428 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
(...skipping 12 matching lines...) Expand all
468 r1_w1->AddPreTargetHandler(&location_handler); 441 r1_w1->AddPreTargetHandler(&location_handler);
469 generator.ClickLeftButton(); 442 generator.ClickLeftButton();
470 r1_w1->RemovePreTargetHandler(&location_handler); 443 r1_w1->RemovePreTargetHandler(&location_handler);
471 EXPECT_EQ(gfx::Point(1050, 50).ToString(), 444 EXPECT_EQ(gfx::Point(1050, 50).ToString(),
472 location_handler.press_location().ToString()); 445 location_handler.press_location().ToString());
473 EXPECT_EQ(gfx::Point(1050, 50).ToString(), 446 EXPECT_EQ(gfx::Point(1050, 50).ToString(),
474 location_handler.release_location().ToString()); 447 location_handler.release_location().ToString());
475 } 448 }
476 449
477 TEST_F(ExtendedDesktopTest, CaptureEventLocationHighDPI) { 450 TEST_F(ExtendedDesktopTest, CaptureEventLocationHighDPI) {
478 if (!SupportsMultipleDisplays())
479 return;
480
481 UpdateDisplay("1000x600*2,600x400"); 451 UpdateDisplay("1000x600*2,600x400");
482 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 452 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
483 453
484 aura::test::EventCountDelegate r1_d1; 454 aura::test::EventCountDelegate r1_d1;
485 aura::test::EventCountDelegate r1_d2; 455 aura::test::EventCountDelegate r1_d2;
486 aura::test::EventCountDelegate r2_d1; 456 aura::test::EventCountDelegate r2_d1;
487 457
488 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 458 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
489 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 459 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
490 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 460 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
(...skipping 12 matching lines...) Expand all
503 r1_w1->AddPreTargetHandler(&location_handler); 473 r1_w1->AddPreTargetHandler(&location_handler);
504 generator.ClickLeftButton(); 474 generator.ClickLeftButton();
505 r1_w1->RemovePreTargetHandler(&location_handler); 475 r1_w1->RemovePreTargetHandler(&location_handler);
506 EXPECT_EQ(gfx::Point(550, 50).ToString(), 476 EXPECT_EQ(gfx::Point(550, 50).ToString(),
507 location_handler.press_location().ToString()); 477 location_handler.press_location().ToString());
508 EXPECT_EQ(gfx::Point(550, 50).ToString(), 478 EXPECT_EQ(gfx::Point(550, 50).ToString(),
509 location_handler.release_location().ToString()); 479 location_handler.release_location().ToString());
510 } 480 }
511 481
512 TEST_F(ExtendedDesktopTest, CaptureEventLocationHighDPI_2) { 482 TEST_F(ExtendedDesktopTest, CaptureEventLocationHighDPI_2) {
513 if (!SupportsMultipleDisplays())
514 return;
515
516 UpdateDisplay("1000x600,600x400*2"); 483 UpdateDisplay("1000x600,600x400*2");
517 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 484 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
518 485
519 aura::test::EventCountDelegate r1_d1; 486 aura::test::EventCountDelegate r1_d1;
520 aura::test::EventCountDelegate r1_d2; 487 aura::test::EventCountDelegate r1_d2;
521 aura::test::EventCountDelegate r2_d1; 488 aura::test::EventCountDelegate r2_d1;
522 489
523 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 490 std::unique_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
524 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 491 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
525 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 492 std::unique_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
(...skipping 16 matching lines...) Expand all
542 // space. Since the location is (1060, 60), it goes to the secondary 509 // space. Since the location is (1060, 60), it goes to the secondary
543 // root-window as (30, 30) since the secondary root-window has a device scale 510 // root-window as (30, 30) since the secondary root-window has a device scale
544 // factor of 2. 511 // factor of 2.
545 EXPECT_EQ(gfx::Point(1020, 20).ToString(), 512 EXPECT_EQ(gfx::Point(1020, 20).ToString(),
546 location_handler.press_location().ToString()); 513 location_handler.press_location().ToString());
547 EXPECT_EQ(gfx::Point(1020, 20).ToString(), 514 EXPECT_EQ(gfx::Point(1020, 20).ToString(),
548 location_handler.release_location().ToString()); 515 location_handler.release_location().ToString());
549 } 516 }
550 517
551 TEST_F(ExtendedDesktopTest, MoveWindow) { 518 TEST_F(ExtendedDesktopTest, MoveWindow) {
552 if (!SupportsMultipleDisplays())
553 return;
554
555 UpdateDisplay("1000x600,600x400"); 519 UpdateDisplay("1000x600,600x400");
556 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 520 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
557 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 521 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
558 522
559 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); 523 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
560 524
561 d1->SetBounds(gfx::Rect(1010, 10, 100, 100)); 525 d1->SetBounds(gfx::Rect(1010, 10, 100, 100));
562 EXPECT_EQ("1010,10 100x100", d1->GetWindowBoundsInScreen().ToString()); 526 EXPECT_EQ("1010,10 100x100", d1->GetWindowBoundsInScreen().ToString());
563 527
564 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); 528 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow());
(...skipping 11 matching lines...) Expand all
576 540
577 // Setting outside of root windows will be moved to primary root window. 541 // Setting outside of root windows will be moved to primary root window.
578 // TODO(oshima): This one probably should pick the closest root window. 542 // TODO(oshima): This one probably should pick the closest root window.
579 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); 543 d1->SetBounds(gfx::Rect(200, 10, 100, 100));
580 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); 544 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
581 } 545 }
582 546
583 // Verifies if the mouse event arrives to the window even when the window 547 // Verifies if the mouse event arrives to the window even when the window
584 // moves to another root in a pre-target handler. See: crbug.com/157583 548 // moves to another root in a pre-target handler. See: crbug.com/157583
585 TEST_F(ExtendedDesktopTest, MoveWindowByMouseClick) { 549 TEST_F(ExtendedDesktopTest, MoveWindowByMouseClick) {
586 if (!SupportsMultipleDisplays())
587 return;
588
589 UpdateDisplay("1000x600,600x400"); 550 UpdateDisplay("1000x600,600x400");
590 551
591 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 552 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
592 aura::test::EventCountDelegate delegate; 553 aura::test::EventCountDelegate delegate;
593 std::unique_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( 554 std::unique_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate(
594 &delegate, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 555 &delegate, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
595 MoveWindowByClickEventHandler event_handler(window.get()); 556 MoveWindowByClickEventHandler event_handler(window.get());
596 window->AddPreTargetHandler(&event_handler); 557 window->AddPreTargetHandler(&event_handler);
597 558
598 ui::test::EventGenerator& event_generator(GetEventGenerator()); 559 ui::test::EventGenerator& event_generator(GetEventGenerator());
599 560
600 event_generator.MoveMouseToCenterOf(window.get()); 561 event_generator.MoveMouseToCenterOf(window.get());
601 event_generator.ClickLeftButton(); 562 event_generator.ClickLeftButton();
602 // Both mouse pressed and released arrive at the window and its delegate. 563 // Both mouse pressed and released arrive at the window and its delegate.
603 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset()); 564 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset());
604 // Also event_handler moves the window to another root at mouse release. 565 // Also event_handler moves the window to another root at mouse release.
605 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 566 EXPECT_EQ(root_windows[1], window->GetRootWindow());
606 } 567 }
607 568
608 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { 569 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) {
609 if (!SupportsMultipleDisplays())
610 return;
611
612 UpdateDisplay("1000x1000,1000x1000"); 570 UpdateDisplay("1000x1000,1000x1000");
613 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 571 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
614 572
615 display::Display display0 = display::Screen::GetScreen()->GetDisplayMatching( 573 display::Display display0 = display::Screen::GetScreen()->GetDisplayMatching(
616 root_windows[0]->GetBoundsInScreen()); 574 root_windows[0]->GetBoundsInScreen());
617 display::Display display1 = display::Screen::GetScreen()->GetDisplayMatching( 575 display::Display display1 = display::Screen::GetScreen()->GetDisplayMatching(
618 root_windows[1]->GetBoundsInScreen()); 576 root_windows[1]->GetBoundsInScreen());
619 EXPECT_NE(display0.id(), display1.id()); 577 EXPECT_NE(display0.id(), display1.id());
620 578
621 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); 579 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100));
622 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); 580 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
623 581
624 // Move the window where the window spans both root windows. Since the second 582 // Move the window where the window spans both root windows. Since the second
625 // parameter is |display1|, the window should be shown on the secondary root. 583 // parameter is |display1|, the window should be shown on the secondary root.
626 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), 584 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100),
627 display1); 585 display1);
628 EXPECT_EQ("500,10 1000x100", d1->GetWindowBoundsInScreen().ToString()); 586 EXPECT_EQ("500,10 1000x100", d1->GetWindowBoundsInScreen().ToString());
629 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); 587 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow());
630 588
631 // Move to the primary root. 589 // Move to the primary root.
632 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), 590 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100),
633 display0); 591 display0);
634 EXPECT_EQ("500,10 1000x100", d1->GetWindowBoundsInScreen().ToString()); 592 EXPECT_EQ("500,10 1000x100", d1->GetWindowBoundsInScreen().ToString());
635 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); 593 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
636 } 594 }
637 595
638 TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { 596 TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) {
639 if (!SupportsMultipleDisplays())
640 return;
641
642 UpdateDisplay("1000x600,600x400"); 597 UpdateDisplay("1000x600,600x400");
643 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 598 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
644 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 599 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
645 views::Widget* w1_t1 = CreateTestWidgetWithParent( 600 views::Widget* w1_t1 = CreateTestWidgetWithParent(
646 w1, gfx::Rect(50, 50, 50, 50), false /* transient */); 601 w1, gfx::Rect(50, 50, 50, 50), false /* transient */);
647 // Transient child of the transient child. 602 // Transient child of the transient child.
648 views::Widget* w1_t11 = CreateTestWidgetWithParent( 603 views::Widget* w1_t11 = CreateTestWidgetWithParent(
649 w1_t1, gfx::Rect(1200, 70, 35, 35), false /* transient */); 604 w1_t1, gfx::Rect(1200, 70, 35, 35), false /* transient */);
650 605
651 views::Widget* w11 = CreateTestWidgetWithParent(w1, gfx::Rect(10, 10, 40, 40), 606 views::Widget* w11 = CreateTestWidgetWithParent(w1, gfx::Rect(10, 10, 40, 40),
(...skipping 26 matching lines...) Expand all
678 EXPECT_EQ("1300,100 80x80", w11_t1->GetWindowBoundsInScreen().ToString()); 633 EXPECT_EQ("1300,100 80x80", w11_t1->GetWindowBoundsInScreen().ToString());
679 634
680 // Transient window doesn't move between root window unless 635 // Transient window doesn't move between root window unless
681 // its transient parent moves. 636 // its transient parent moves.
682 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50)); 637 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50));
683 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); 638 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow());
684 EXPECT_EQ("10,50 50x50", w1_t1->GetWindowBoundsInScreen().ToString()); 639 EXPECT_EQ("10,50 50x50", w1_t1->GetWindowBoundsInScreen().ToString());
685 } 640 }
686 641
687 // Test if the Window::ConvertPointToTarget works across root windows. 642 // Test if the Window::ConvertPointToTarget works across root windows.
688 // TODO(oshima): Move multiple display suport and this test to aura.
689 TEST_F(ExtendedDesktopTest, ConvertPoint) { 643 TEST_F(ExtendedDesktopTest, ConvertPoint) {
690 if (!SupportsMultipleDisplays())
691 return;
692 display::Screen* screen = display::Screen::GetScreen(); 644 display::Screen* screen = display::Screen::GetScreen();
693 UpdateDisplay("1000x600,600x400"); 645 UpdateDisplay("1000x600,600x400");
694 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 646 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
695 display::Display display_1 = screen->GetDisplayNearestWindow(root_windows[0]); 647 display::Display display_1 = screen->GetDisplayNearestWindow(root_windows[0]);
696 EXPECT_EQ("0,0", display_1.bounds().origin().ToString()); 648 EXPECT_EQ("0,0", display_1.bounds().origin().ToString());
697 display::Display display_2 = screen->GetDisplayNearestWindow(root_windows[1]); 649 display::Display display_2 = screen->GetDisplayNearestWindow(root_windows[1]);
698 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString()); 650 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString());
699 651
700 aura::Window* d1 = 652 aura::Window* d1 =
701 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView(); 653 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 // Convert point in Root1's window to Root2's window Coord. 689 // Convert point in Root1's window to Root2's window Coord.
738 p.SetPoint(0, 0); 690 p.SetPoint(0, 0);
739 aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p); 691 aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p);
740 EXPECT_EQ("0,-600", p.ToString()); 692 EXPECT_EQ("0,-600", p.ToString());
741 p.SetPoint(0, 0); 693 p.SetPoint(0, 0);
742 aura::Window::ConvertPointToTarget(d1, d2, &p); 694 aura::Window::ConvertPointToTarget(d1, d2, &p);
743 EXPECT_EQ("-10,-610", p.ToString()); 695 EXPECT_EQ("-10,-610", p.ToString());
744 } 696 }
745 697
746 TEST_F(ExtendedDesktopTest, OpenSystemTray) { 698 TEST_F(ExtendedDesktopTest, OpenSystemTray) {
747 if (!SupportsMultipleDisplays())
748 return;
749
750 UpdateDisplay("500x600,600x400"); 699 UpdateDisplay("500x600,600x400");
751 SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 700 SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
752 ASSERT_FALSE(tray->HasSystemBubble()); 701 ASSERT_FALSE(tray->HasSystemBubble());
753 702
754 ui::test::EventGenerator& event_generator(GetEventGenerator()); 703 ui::test::EventGenerator& event_generator(GetEventGenerator());
755 704
756 // Opens the tray by a dummy click event and makes sure that adding/removing 705 // Opens the tray by a dummy click event and makes sure that adding/removing
757 // displays doesn't break anything. 706 // displays doesn't break anything.
758 event_generator.MoveMouseToCenterOf(tray->GetWidget()->GetNativeWindow()); 707 event_generator.MoveMouseToCenterOf(tray->GetWidget()->GetNativeWindow());
759 event_generator.ClickLeftButton(); 708 event_generator.ClickLeftButton();
(...skipping 11 matching lines...) Expand all
771 720
772 EXPECT_FALSE(tray->HasSystemBubble()); 721 EXPECT_FALSE(tray->HasSystemBubble());
773 722
774 UpdateDisplay("500x600"); 723 UpdateDisplay("500x600");
775 EXPECT_FALSE(tray->HasSystemBubble()); 724 EXPECT_FALSE(tray->HasSystemBubble());
776 UpdateDisplay("500x600,600x400"); 725 UpdateDisplay("500x600,600x400");
777 EXPECT_FALSE(tray->HasSystemBubble()); 726 EXPECT_FALSE(tray->HasSystemBubble());
778 } 727 }
779 728
780 TEST_F(ExtendedDesktopTest, StayInSameRootWindow) { 729 TEST_F(ExtendedDesktopTest, StayInSameRootWindow) {
781 if (!SupportsMultipleDisplays())
782 return;
783
784 UpdateDisplay("100x100,200x200"); 730 UpdateDisplay("100x100,200x200");
785 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 731 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
786 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50)); 732 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50));
787 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); 733 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow());
788 w1->SetBounds(gfx::Rect(150, 10, 50, 50)); 734 w1->SetBounds(gfx::Rect(150, 10, 50, 50));
789 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 735 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
790 736
791 // The widget stays in the same root if kLockedToRootKey is set to true. 737 // The widget stays in the same root if kLockedToRootKey is set to true.
792 w1->GetNativeView()->SetProperty(kLockedToRootKey, true); 738 w1->GetNativeView()->SetProperty(kLockedToRootKey, true);
793 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); 739 w1->SetBounds(gfx::Rect(10, 10, 50, 50));
(...skipping 18 matching lines...) Expand all
812 aura::Window* status_container = 758 aura::Window* status_container =
813 Shell::GetPrimaryRootWindowController()->GetContainer( 759 Shell::GetPrimaryRootWindowController()->GetContainer(
814 kShellWindowId_StatusContainer); 760 kShellWindowId_StatusContainer);
815 window = aura::test::CreateTestWindowWithId(100, status_container); 761 window = aura::test::CreateTestWindowWithId(100, status_container);
816 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), 762 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50),
817 display_manager()->GetSecondaryDisplay()); 763 display_manager()->GetSecondaryDisplay());
818 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 764 EXPECT_EQ(root_windows[0], window->GetRootWindow());
819 } 765 }
820 766
821 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { 767 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
822 if (!SupportsMultipleDisplays())
823 return;
824
825 UpdateDisplay("100x100,200x200"); 768 UpdateDisplay("100x100,200x200");
826 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 769 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
827 770
828 // Create normal windows on both displays. 771 // Create normal windows on both displays.
829 views::Widget* widget1 = CreateTestWidget( 772 views::Widget* widget1 = CreateTestWidget(
830 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); 773 display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
831 widget1->Show(); 774 widget1->Show();
832 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); 775 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow());
833 views::Widget* widget2 = 776 views::Widget* widget2 =
834 CreateTestWidget(display_manager()->GetSecondaryDisplay().bounds()); 777 CreateTestWidget(display_manager()->GetSecondaryDisplay().bounds());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 EXPECT_EQ("abcd", base::UTF16ToASCII(textfield->text())); 828 EXPECT_EQ("abcd", base::UTF16ToASCII(textfield->text()));
886 829
887 event_generator.set_current_target(root_windows[1]); 830 event_generator.set_current_target(root_windows[1]);
888 event_generator.PressKey(ui::VKEY_E, 0); 831 event_generator.PressKey(ui::VKEY_E, 0);
889 event_generator.ReleaseKey(ui::VKEY_E, 0); 832 event_generator.ReleaseKey(ui::VKEY_E, 0);
890 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 833 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
891 EXPECT_EQ("abcde", base::UTF16ToASCII(textfield->text())); 834 EXPECT_EQ("abcde", base::UTF16ToASCII(textfield->text()));
892 } 835 }
893 836
894 TEST_F(ExtendedDesktopTest, PassiveGrab) { 837 TEST_F(ExtendedDesktopTest, PassiveGrab) {
895 if (!SupportsMultipleDisplays())
896 return;
897
898 EventLocationRecordingEventHandler event_handler; 838 EventLocationRecordingEventHandler event_handler;
899 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler); 839 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler);
900 840
901 UpdateDisplay("300x300,200x200"); 841 UpdateDisplay("300x300,200x200");
902 842
903 views::Widget* widget = CreateTestWidget(gfx::Rect(50, 50, 200, 200)); 843 views::Widget* widget = CreateTestWidget(gfx::Rect(50, 50, 200, 200));
904 widget->Show(); 844 widget->Show();
905 ASSERT_EQ("50,50 200x200", widget->GetWindowBoundsInScreen().ToString()); 845 ASSERT_EQ("50,50 200x200", widget->GetWindowBoundsInScreen().ToString());
906 846
907 ui::test::EventGenerator& generator(GetEventGenerator()); 847 ui::test::EventGenerator& generator(GetEventGenerator());
908 generator.MoveMouseTo(150, 150); 848 generator.MoveMouseTo(150, 150);
909 EXPECT_EQ("100,100 150,150", event_handler.GetLocationsAndReset()); 849 EXPECT_EQ("100,100 150,150", event_handler.GetLocationsAndReset());
910 850
911 generator.PressLeftButton(); 851 generator.PressLeftButton();
912 generator.MoveMouseTo(400, 150); 852 generator.MoveMouseTo(400, 150);
913 853
914 EXPECT_EQ("350,100 400,150", event_handler.GetLocationsAndReset()); 854 EXPECT_EQ("350,100 400,150", event_handler.GetLocationsAndReset());
915 855
916 generator.ReleaseLeftButton(); 856 generator.ReleaseLeftButton();
917 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 857 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
918 858
919 generator.MoveMouseTo(400, 150); 859 generator.MoveMouseTo(400, 150);
920 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 860 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
921 861
922 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 862 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
923 } 863 }
924 864
925 } // namespace ash 865 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_tracker_unittest.cc ('k') | ash/magnifier/magnification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698