summaryrefslogtreecommitdiffstats
path: root/ui/views/widget
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 08:59:13 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 08:59:13 +0000
commit1cd78a07b482fafa377bc3827ca896fc9f14d9e8 (patch)
treea6a2f9153568c9cee1a577facae2a7205eb04b98 /ui/views/widget
parente126602d4945f0bed0f61c47459af9676fc75454 (diff)
downloadchromium_src-1cd78a07b482fafa377bc3827ca896fc9f14d9e8.zip
chromium_src-1cd78a07b482fafa377bc3827ca896fc9f14d9e8.tar.gz
chromium_src-1cd78a07b482fafa377bc3827ca896fc9f14d9e8.tar.bz2
Aura: Fix task manager getting larger each time it is opened
HtmlDialogView needs to store the content area size for the dialog. Changed HtmlUIDialogDelegate::StoreDialogSize() to take a size, not a rect. BUG=111291 TEST=Open and close the task manager several times, verify it does not get taller with each cycle Review URL: http://codereview.chromium.org/9290061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget')
-rw-r--r--ui/views/widget/native_widget_aura.cc3
-rw-r--r--ui/views/widget/native_widget_aura_unittest.cc49
2 files changed, 41 insertions, 11 deletions
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 5842627..487d706 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -374,7 +374,8 @@ gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const {
}
gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const {
- // In Aura, the entire window is the client area.
+ // View-to-screen coordinate system transformations depend on this returning
+ // the full window bounds, for example View::ConvertPointToScreen().
return window_->GetScreenBounds();
}
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
index dc437089..3f1427b 100644
--- a/ui/views/widget/native_widget_aura_unittest.cc
+++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -23,9 +23,27 @@ NativeWidgetAura* Init(aura::Window* parent, Widget* widget) {
return static_cast<NativeWidgetAura*>(widget->native_widget());
}
-TEST(NativeWidgetAuraTest, CenterWindowLargeParent) {
- MessageLoopForUI message_loop;
- aura::RootWindow::GetInstance()->SetBounds(gfx::Rect(0, 0, 640, 480));
+class NativeWidgetAuraTest : public testing::Test {
+ public:
+ NativeWidgetAuraTest() {}
+ virtual ~NativeWidgetAuraTest() {}
+
+ // testing::Test overrides:
+ virtual void SetUp() OVERRIDE {
+ aura::RootWindow::GetInstance()->SetBounds(gfx::Rect(0, 0, 640, 480));
+ }
+ virtual void TearDown() OVERRIDE {
+ aura::RootWindow::DeleteInstance();
+ message_loop_.RunAllPending();
+ }
+
+ private:
+ MessageLoopForUI message_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeWidgetAuraTest);
+};
+
+TEST_F(NativeWidgetAuraTest, CenterWindowLargeParent) {
// Make a parent window larger than the host represented by rootwindow.
scoped_ptr<aura::Window> parent(new aura::Window(NULL));
parent->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
@@ -38,14 +56,10 @@ TEST(NativeWidgetAuraTest, CenterWindowLargeParent) {
(480 - 100) / 2,
100, 100),
window->GetNativeWindow()->bounds());
- aura::RootWindow::DeleteInstance();
widget->CloseNow();
- message_loop.RunAllPending();
}
-TEST(NativeWidgetAuraTest, CenterWindowSmallParent) {
- MessageLoopForUI message_loop;
- aura::RootWindow::GetInstance()->SetBounds(gfx::Rect(0, 0, 640, 480));
+TEST_F(NativeWidgetAuraTest, CenterWindowSmallParent) {
// Make a parent window smaller than the host represented by rootwindow.
scoped_ptr<aura::Window> parent(new aura::Window(NULL));
parent->Init(ui::Layer::LAYER_HAS_NO_TEXTURE);
@@ -58,9 +72,24 @@ TEST(NativeWidgetAuraTest, CenterWindowSmallParent) {
(320 - 100) / 2,
100, 100),
window->GetNativeWindow()->bounds());
- aura::RootWindow::DeleteInstance();
widget->CloseNow();
- message_loop.RunAllPending();
}
+
+TEST_F(NativeWidgetAuraTest, GetClientAreaScreenBounds) {
+ // Create a widget.
+ Widget::InitParams params(Widget::InitParams::TYPE_WINDOW);
+ params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.bounds.SetRect(10, 20, 300, 400);
+ Widget* widget = new Widget();
+ widget->Init(params);
+
+ // For Aura, client area bounds match window bounds.
+ gfx::Rect client_bounds = widget->GetClientAreaScreenBounds();
+ EXPECT_EQ(10, client_bounds.x());
+ EXPECT_EQ(20, client_bounds.y());
+ EXPECT_EQ(300, client_bounds.width());
+ EXPECT_EQ(400, client_bounds.height());
+}
+
} // namespace
} // namespace views