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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 9689027: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: crash fix Created 8 years, 9 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
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/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
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 "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
11 #include "ui/aura/screen_aura.h" 11 #include "ui/aura/screen_aura.h"
12 #include "ui/aura/test/test_window_delegate.h" 12 #include "ui/aura/test/test_window_delegate.h"
13 #include "ui/base/hit_test.h" 13 #include "ui/base/hit_test.h"
14 #include "ui/gfx/insets.h"
14 15
15 namespace ash { 16 namespace ash {
16 namespace internal { 17 namespace internal {
17 namespace { 18 namespace {
18 19
19 const int kRootHeight = 600; 20 const int kRootHeight = 600;
20 21
21 // A simple window delegate that returns the specified min size. 22 // A simple window delegate that returns the specified min size.
22 class TestWindowDelegate : public aura::test::TestWindowDelegate { 23 class TestWindowDelegate : public aura::test::TestWindowDelegate {
23 public: 24 public:
(...skipping 20 matching lines...) Expand all
44 public: 45 public:
45 WorkspaceWindowResizerTest() : window_(NULL) {} 46 WorkspaceWindowResizerTest() : window_(NULL) {}
46 virtual ~WorkspaceWindowResizerTest() {} 47 virtual ~WorkspaceWindowResizerTest() {}
47 48
48 virtual void SetUp() OVERRIDE { 49 virtual void SetUp() OVERRIDE {
49 AshTestBase::SetUp(); 50 AshTestBase::SetUp();
50 aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); 51 aura::RootWindow* root = Shell::GetInstance()->GetRootWindow();
51 root->SetBounds(gfx::Rect(0, 0, 800, kRootHeight)); 52 root->SetBounds(gfx::Rect(0, 0, 800, kRootHeight));
52 gfx::Rect root_bounds(root->bounds()); 53 gfx::Rect root_bounds(root->bounds());
53 EXPECT_EQ(kRootHeight, root_bounds.height()); 54 EXPECT_EQ(kRootHeight, root_bounds.height());
54 root->SetScreenWorkAreaInsets(gfx::Insets()); 55 root->SetMonitorWorkAreaInsets(gfx::Insets());
55 window_.reset(new aura::Window(&delegate_)); 56 window_.reset(new aura::Window(&delegate_));
56 window_->Init(ui::Layer::LAYER_NOT_DRAWN); 57 window_->Init(ui::Layer::LAYER_NOT_DRAWN);
57 window_->SetParent(Shell::GetInstance()->GetRootWindow()); 58 window_->SetParent(Shell::GetInstance()->GetRootWindow());
58 59
59 window2_.reset(new aura::Window(&delegate2_)); 60 window2_.reset(new aura::Window(&delegate2_));
60 window2_->Init(ui::Layer::LAYER_NOT_DRAWN); 61 window2_->Init(ui::Layer::LAYER_NOT_DRAWN);
61 window2_->SetParent(Shell::GetInstance()->GetRootWindow()); 62 window2_->SetParent(Shell::GetInstance()->GetRootWindow());
62 63
63 window3_.reset(new aura::Window(&delegate3_)); 64 window3_.reset(new aura::Window(&delegate3_));
64 window3_->Init(ui::Layer::LAYER_NOT_DRAWN); 65 window3_->Init(ui::Layer::LAYER_NOT_DRAWN);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 EXPECT_EQ("0,0 400x380", window_->bounds().ToString()); 540 EXPECT_EQ("0,0 400x380", window_->bounds().ToString());
540 EXPECT_EQ("40,380 100x200", window2_->bounds().ToString()); 541 EXPECT_EQ("40,380 100x200", window2_->bounds().ToString());
541 } 542 }
542 } 543 }
543 544
544 // Assertions around attached window resize dragging from the bottom with 3 545 // Assertions around attached window resize dragging from the bottom with 3
545 // windows. 546 // windows.
546 TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { 547 TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) {
547 aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); 548 aura::RootWindow* root = Shell::GetInstance()->GetRootWindow();
548 root->SetBounds(gfx::Rect(0, 0, 600, 800)); 549 root->SetBounds(gfx::Rect(0, 0, 600, 800));
549 root->SetScreenWorkAreaInsets(gfx::Insets()); 550 root->SetMonitorWorkAreaInsets(gfx::Insets());
550 551
551 window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); 552 window_->SetBounds(gfx::Rect( 300, 100, 300, 200));
552 window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); 553 window2_->SetBounds(gfx::Rect(300, 300, 200, 150));
553 window3_->SetBounds(gfx::Rect(300, 450, 200, 100)); 554 window3_->SetBounds(gfx::Rect(300, 450, 200, 100));
554 delegate2_.set_min_size(gfx::Size(50, 52)); 555 delegate2_.set_min_size(gfx::Size(50, 52));
555 delegate3_.set_min_size(gfx::Size(50, 38)); 556 delegate3_.set_min_size(gfx::Size(50, 38));
556 557
557 std::vector<aura::Window*> windows; 558 std::vector<aura::Window*> windows;
558 windows.push_back(window2_.get()); 559 windows.push_back(window2_.get());
559 windows.push_back(window3_.get()); 560 windows.push_back(window3_.get());
(...skipping 21 matching lines...) Expand all
581 // Revert and make sure everything moves back. 582 // Revert and make sure everything moves back.
582 resizer->RevertDrag(); 583 resizer->RevertDrag();
583 EXPECT_EQ("300,100 300x200", window_->bounds().ToString()); 584 EXPECT_EQ("300,100 300x200", window_->bounds().ToString());
584 EXPECT_EQ("300,300 200x150", window2_->bounds().ToString()); 585 EXPECT_EQ("300,300 200x150", window2_->bounds().ToString());
585 EXPECT_EQ("300,450 200x100", window3_->bounds().ToString()); 586 EXPECT_EQ("300,450 200x100", window3_->bounds().ToString());
586 } 587 }
587 588
588 TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_RememberHeight) { 589 TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_RememberHeight) {
589 aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); 590 aura::RootWindow* root = Shell::GetInstance()->GetRootWindow();
590 root->SetBounds(gfx::Rect(0, 0, 600, 800)); 591 root->SetBounds(gfx::Rect(0, 0, 600, 800));
591 root->SetScreenWorkAreaInsets(gfx::Insets()); 592 root->SetMonitorWorkAreaInsets(gfx::Insets());
592 593
593 window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); 594 window_->SetBounds(gfx::Rect( 300, 100, 300, 200));
594 window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); 595 window2_->SetBounds(gfx::Rect(300, 300, 200, 150));
595 window3_->SetBounds(gfx::Rect(300, 450, 200, 100)); 596 window3_->SetBounds(gfx::Rect(300, 450, 200, 100));
596 delegate2_.set_min_size(gfx::Size(50, 52)); 597 delegate2_.set_min_size(gfx::Size(50, 52));
597 delegate3_.set_min_size(gfx::Size(50, 38)); 598 delegate3_.set_min_size(gfx::Size(50, 38));
598 599
599 std::vector<aura::Window*> windows; 600 std::vector<aura::Window*> windows;
600 windows.push_back(window2_.get()); 601 windows.push_back(window2_.get());
601 windows.push_back(window3_.get()); 602 windows.push_back(window3_.get());
(...skipping 30 matching lines...) Expand all
632 EXPECT_EQ("300,100 300x300", window_->bounds().ToString()); 633 EXPECT_EQ("300,100 300x300", window_->bounds().ToString());
633 EXPECT_EQ("300,400 200x150", window2_->bounds().ToString()); 634 EXPECT_EQ("300,400 200x150", window2_->bounds().ToString());
634 EXPECT_EQ("300,550 200x100", window3_->bounds().ToString()); 635 EXPECT_EQ("300,550 200x100", window3_->bounds().ToString());
635 } 636 }
636 637
637 } 638 }
638 639
639 } // namespace 640 } // namespace
640 } // namespace test 641 } // namespace test
641 } // namespace aura 642 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698