diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 01:42:30 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 01:42:30 +0000 |
commit | 4c1bdfe25b4088e292e521478fcd06e5e096aab9 (patch) | |
tree | 6b650797a3f0459a71236e9b80e1c44ab8ec83cd | |
parent | c0c09f91d95d1801aabfbef23461ba9a4acd379b (diff) | |
download | chromium_src-4c1bdfe25b4088e292e521478fcd06e5e096aab9.zip chromium_src-4c1bdfe25b4088e292e521478fcd06e5e096aab9.tar.gz chromium_src-4c1bdfe25b4088e292e521478fcd06e5e096aab9.tar.bz2 |
Set minimize property and re-enable tests on Aura
Currently we disable several important tests on Aura because Minimize() is unimplemented.
Most significant is ExtensionApiTest.UpdateWindowResize and ExtensionApiTest.UpdateWindowState, which test a lot of the chrome.windows api.
Setting the minimized property but not doing anything satisfies the tests with minimal change, until we determine what the expected minimize behavior is on Aura, and how this affects the extensions API.
BUG=104571
TEST=Tests pass (esp. browser_tests)
Review URL: http://codereview.chromium.org/9372126
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123622 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/wm/base_layout_manager_unittest.cc | 12 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_tabs_apitest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_tabs_test.cc | 8 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 10 |
4 files changed, 22 insertions, 12 deletions
diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index c0cd326..19df383 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -57,6 +57,18 @@ TEST_F(BaseLayoutManagerTest, Maximize) { EXPECT_EQ(bounds, window->bounds()); } +// Tests normal->minimize->normal. +TEST_F(BaseLayoutManagerTest, Minimize) { + gfx::Rect bounds(100, 100, 200, 200); + scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); + window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); + // Note: Currently minimize doesn't do anything except set the state. + // See crbug.com/104571. + EXPECT_EQ(bounds, window->bounds()); + window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); + EXPECT_EQ(bounds, window->bounds()); +} + // Tests maximized window size during root window resize. TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) { gfx::Rect bounds(100, 100, 200, 200); diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc index 2c98bb0..f07b80d 100644 --- a/chrome/browser/extensions/extension_tabs_apitest.cc +++ b/chrome/browser/extensions/extension_tabs_apitest.cc @@ -20,8 +20,8 @@ #endif // Window resizes are not completed by the time the callback happens, -// so these tests fail on linux. http://crbug.com/72369 -#if defined(OS_LINUX) +// so these tests fail on linux/gtk. http://crbug.com/72369 +#if defined(OS_LINUX) && !defined(USE_AURA) #define MAYBE_FocusWindowDoesNotExitFullscreen \ DISABLED_FocusWindowDoesNotExitFullscreen #define MAYBE_UpdateWindowSizeExitsFullscreen \ diff --git a/chrome/browser/extensions/extension_tabs_test.cc b/chrome/browser/extensions/extension_tabs_test.cc index bee8ae1..ed0bc6c 100644 --- a/chrome/browser/extensions/extension_tabs_test.cc +++ b/chrome/browser/extensions/extension_tabs_test.cc @@ -411,9 +411,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DontCreateTabInClosingPopupWindow) { IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { int window_id = ExtensionTabUtil::GetWindowId(browser()); -#if !defined(USE_AURA) - // Disabled for now (crbug.com/105173) because window minimization is not - // supported on Aura yet (crbug.com/104571). static const char kArgsMinimizedWithFocus[] = "[%u, {\"state\": \"minimized\", \"focused\": true}]"; EXPECT_TRUE(MatchPattern( @@ -422,7 +419,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { base::StringPrintf(kArgsMinimizedWithFocus, window_id), browser()), keys::kInvalidWindowStateError)); -#endif static const char kArgsMaximizedWithoutFocus[] = "[%u, {\"state\": \"maximized\", \"focused\": false}]"; @@ -433,9 +429,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { browser()), keys::kInvalidWindowStateError)); -#if !defined(USE_AURA) - // Disabled for now (crbug.com/105173) because window minimization is not - // supported on Aura yet (crbug.com/104571). static const char kArgsMinimizedWithBounds[] = "[%u, {\"state\": \"minimized\", \"width\": 500}]"; EXPECT_TRUE(MatchPattern( @@ -444,7 +437,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, InvalidUpdateWindowState) { base::StringPrintf(kArgsMinimizedWithBounds, window_id), browser()), keys::kInvalidWindowStateError)); -#endif static const char kArgsMaximizedWithBounds[] = "[%u, {\"state\": \"maximized\", \"width\": 500}]"; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 8435698..291ace0 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -409,6 +409,11 @@ gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { } gfx::Rect NativeWidgetAura::GetRestoredBounds() const { + // Restored bounds should only be relevant if the window is minimized or + // maximized. However, in some places the code expectes GetRestoredBounds() + // to return the current window bounds if the window is not in either state. + if (!IsMinimized() && !IsMaximized() && !IsFullscreen()) + return window_->bounds(); gfx::Rect* restore_bounds = window_->GetProperty(aura::client::kRestoreBoundsKey); return restore_bounds ? *restore_bounds : window_->bounds(); @@ -517,8 +522,9 @@ void NativeWidgetAura::Maximize() { } void NativeWidgetAura::Minimize() { - // No minimized window for aura. crbug.com/104571. - NOTREACHED(); + // Note: This currently does not do anything except set the property, + // see crbug.com/104571. + window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); } bool NativeWidgetAura::IsMaximized() const { |