OLD | NEW |
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/display_manager.h" | 6 #include "ash/display/display_manager.h" |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 if (!SupportsMultipleDisplays()) | 511 if (!SupportsMultipleDisplays()) |
512 return; | 512 return; |
513 | 513 |
514 UpdateDisplay("1000x600,600x400"); | 514 UpdateDisplay("1000x600,600x400"); |
515 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 515 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
516 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); | 516 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); |
517 views::Widget* w1_t1 = CreateTestWidgetWithParent( | 517 views::Widget* w1_t1 = CreateTestWidgetWithParent( |
518 w1, gfx::Rect(50, 50, 50, 50), false /* transient */); | 518 w1, gfx::Rect(50, 50, 50, 50), false /* transient */); |
519 // Transient child of the transient child. | 519 // Transient child of the transient child. |
520 views::Widget* w1_t11 = CreateTestWidgetWithParent( | 520 views::Widget* w1_t11 = CreateTestWidgetWithParent( |
521 w1_t1, gfx::Rect(1200, 70, 35, 35), false /* transient */); | 521 w1_t1, gfx::Rect(1200, 70, 30, 30), false /* transient */); |
522 | 522 |
523 views::Widget* w11 = CreateTestWidgetWithParent( | 523 views::Widget* w11 = CreateTestWidgetWithParent( |
524 w1, gfx::Rect(10, 10, 40, 40), true /* child */); | 524 w1, gfx::Rect(10, 10, 40, 40), true /* child */); |
525 views::Widget* w11_t1 = CreateTestWidgetWithParent( | 525 views::Widget* w11_t1 = CreateTestWidgetWithParent( |
526 w1, gfx::Rect(1300, 100, 80, 80), false /* transient */); | 526 w1, gfx::Rect(1300, 100, 80, 80), false /* transient */); |
527 | 527 |
528 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 528 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
529 EXPECT_EQ(root_windows[0], w11->GetNativeView()->GetRootWindow()); | 529 EXPECT_EQ(root_windows[0], w11->GetNativeView()->GetRootWindow()); |
530 EXPECT_EQ(root_windows[0], w1_t1->GetNativeView()->GetRootWindow()); | 530 EXPECT_EQ(root_windows[0], w1_t1->GetNativeView()->GetRootWindow()); |
531 EXPECT_EQ(root_windows[0], w1_t11->GetNativeView()->GetRootWindow()); | 531 EXPECT_EQ(root_windows[0], w1_t11->GetNativeView()->GetRootWindow()); |
532 EXPECT_EQ(root_windows[0], w11_t1->GetNativeView()->GetRootWindow()); | 532 EXPECT_EQ(root_windows[0], w11_t1->GetNativeView()->GetRootWindow()); |
533 EXPECT_EQ("50,50 50x50", | 533 EXPECT_EQ("50,50 50x50", |
534 w1_t1->GetWindowBoundsInScreen().ToString()); | 534 w1_t1->GetWindowBoundsInScreen().ToString()); |
535 EXPECT_EQ("1200,70 35x35", | 535 EXPECT_EQ("1200,70 30x30", |
536 w1_t11->GetWindowBoundsInScreen().ToString()); | 536 w1_t11->GetWindowBoundsInScreen().ToString()); |
537 EXPECT_EQ("20,20 40x40", | 537 EXPECT_EQ("20,20 40x40", |
538 w11->GetWindowBoundsInScreen().ToString()); | 538 w11->GetWindowBoundsInScreen().ToString()); |
539 EXPECT_EQ("1300,100 80x80", | 539 EXPECT_EQ("1300,100 80x80", |
540 w11_t1->GetWindowBoundsInScreen().ToString()); | 540 w11_t1->GetWindowBoundsInScreen().ToString()); |
541 | 541 |
542 w1->SetBounds(gfx::Rect(1100,10,100,100)); | 542 w1->SetBounds(gfx::Rect(1100,10,100,100)); |
543 | 543 |
544 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 544 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
545 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 545 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
546 EXPECT_EQ(root_windows[1], w1_t11->GetNativeView()->GetRootWindow()); | 546 EXPECT_EQ(root_windows[1], w1_t11->GetNativeView()->GetRootWindow()); |
547 EXPECT_EQ(root_windows[1], w11->GetNativeView()->GetRootWindow()); | 547 EXPECT_EQ(root_windows[1], w11->GetNativeView()->GetRootWindow()); |
548 EXPECT_EQ(root_windows[1], w11_t1->GetNativeView()->GetRootWindow()); | 548 EXPECT_EQ(root_windows[1], w11_t1->GetNativeView()->GetRootWindow()); |
549 | 549 |
550 EXPECT_EQ("1110,20 40x40", | 550 EXPECT_EQ("1110,20 40x40", |
551 w11->GetWindowBoundsInScreen().ToString()); | 551 w11->GetWindowBoundsInScreen().ToString()); |
552 // Transient window's screen bounds stays the same. | 552 // Transient window's screen bounds stays the same. |
553 EXPECT_EQ("50,50 50x50", | 553 EXPECT_EQ("50,50 50x50", |
554 w1_t1->GetWindowBoundsInScreen().ToString()); | 554 w1_t1->GetWindowBoundsInScreen().ToString()); |
555 EXPECT_EQ("1200,70 35x35", | 555 EXPECT_EQ("1200,70 30x30", |
556 w1_t11->GetWindowBoundsInScreen().ToString()); | 556 w1_t11->GetWindowBoundsInScreen().ToString()); |
557 EXPECT_EQ("1300,100 80x80", | 557 EXPECT_EQ("1300,100 80x80", |
558 w11_t1->GetWindowBoundsInScreen().ToString()); | 558 w11_t1->GetWindowBoundsInScreen().ToString()); |
559 | 559 |
560 // Transient window doesn't move between root window unless | 560 // Transient window doesn't move between root window unless |
561 // its transient parent moves. | 561 // its transient parent moves. |
562 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50)); | 562 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50)); |
563 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 563 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
564 EXPECT_EQ("10,50 50x50", | 564 EXPECT_EQ("10,50 50x50", |
565 w1_t1->GetWindowBoundsInScreen().ToString()); | 565 w1_t1->GetWindowBoundsInScreen().ToString()); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 generator.ReleaseLeftButton(); | 797 generator.ReleaseLeftButton(); |
798 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 798 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
799 | 799 |
800 generator.MoveMouseTo(400, 150); | 800 generator.MoveMouseTo(400, 150); |
801 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 801 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
802 | 802 |
803 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 803 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
804 } | 804 } |
805 | 805 |
806 } // namespace ash | 806 } // namespace ash |
OLD | NEW |