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

Unified Diff: ash/wm/workspace/snap_sizer_unittest.cc

Issue 24108003: [Cleanup] Rename WindowSettings to WindowState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/snap_sizer_unittest.cc
diff --git a/ash/wm/workspace/snap_sizer_unittest.cc b/ash/wm/workspace/snap_sizer_unittest.cc
index ea27519a92995449ac92782dd49bc676cf01bf03..e0c903376ec13919e32fbd1eea222293b9b6501e 100644
--- a/ash/wm/workspace/snap_sizer_unittest.cc
+++ b/ash/wm/workspace/snap_sizer_unittest.cc
@@ -8,8 +8,7 @@
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
-#include "ash/wm/property_util.h"
-#include "ash/wm/window_settings.h"
+#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/aura/root_window.h"
@@ -87,7 +86,8 @@ TEST_F(SnapSizerTest, MinimumSize) {
// It should be possible to snap a window with a minimum size.
delegate.set_minimum_size(gfx::Size(kWorkAreaBounds.width() - 1, 0));
- EXPECT_TRUE(ash::wm::CanSnapWindow(window.get()));
+ wm::WindowState* window_state = wm::GetWindowState(window.get());
+ EXPECT_TRUE(window_state->CanSnap());
SnapSizer::SnapWindow(window.get(), SnapSizer::RIGHT_EDGE);
gfx::Rect expected = gfx::Rect(kWorkAreaBounds.x() + 1,
kWorkAreaBounds.y(),
@@ -98,7 +98,7 @@ TEST_F(SnapSizerTest, MinimumSize) {
// It should not be possible to snap a window with a maximum size.
delegate.set_minimum_size(gfx::Size());
delegate.set_maximum_size(gfx::Size(kWorkAreaBounds.width() - 1, INT_MAX));
- EXPECT_FALSE(ash::wm::CanSnapWindow(window.get()));
+ EXPECT_FALSE(window_state->CanSnap());
}
// Test that repeadedly calling SnapSizer::SnapWindow() steps through the ideal
@@ -231,35 +231,37 @@ TEST_F(SnapSizerTest, AlternateFrameCaptionButtonStyle) {
TEST_F(SnapSizerTest, RestoreBounds) {
scoped_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100)));
- EXPECT_TRUE(wm::IsWindowNormal(window.get()));
+ wm::WindowState* window_state = wm::GetWindowState(window.get());
+
+ EXPECT_TRUE(window_state->IsNormalShowState());
// 1) Start with restored window with restore bounds set.
gfx::Rect restore_bounds = window->GetBoundsInScreen();
restore_bounds.set_width(restore_bounds.width() + 1);
- SetRestoreBoundsInScreen(window.get(), restore_bounds);
+ window_state->SetRestoreBoundsInScreen(restore_bounds);
SnapSizer::SnapWindow(window.get(), SnapSizer::LEFT_EDGE);
SnapSizer::SnapWindow(window.get(), SnapSizer::RIGHT_EDGE);
EXPECT_NE(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
EXPECT_EQ(restore_bounds.ToString(),
- GetRestoreBoundsInScreen(window.get())->ToString());
- wm::RestoreWindow(window.get());
+ window_state->GetRestoreBoundsInScreen().ToString());
+ window_state->Restore();
EXPECT_EQ(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
// 2) Start with restored bounds set as a result of maximizing the window.
- wm::MaximizeWindow(window.get());
+ window_state->Maximize();
gfx::Rect maximized_bounds = window->GetBoundsInScreen();
EXPECT_NE(maximized_bounds.ToString(), restore_bounds.ToString());
EXPECT_EQ(restore_bounds.ToString(),
- GetRestoreBoundsInScreen(window.get())->ToString());
+ window_state->GetRestoreBoundsInScreen().ToString());
SnapSizer::SnapWindow(window.get(), SnapSizer::LEFT_EDGE);
EXPECT_NE(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
EXPECT_NE(maximized_bounds.ToString(),
window->GetBoundsInScreen().ToString());
EXPECT_EQ(restore_bounds.ToString(),
- GetRestoreBoundsInScreen(window.get())->ToString());
+ window_state->GetRestoreBoundsInScreen().ToString());
- wm::RestoreWindow(window.get());
+ window_state->Restore();
EXPECT_EQ(restore_bounds.ToString(), window->GetBoundsInScreen().ToString());
}
@@ -267,12 +269,13 @@ TEST_F(SnapSizerTest, RestoreBounds) {
// at the snapped bounds and not at the auto-managed (centered) bounds.
TEST_F(SnapSizerTest, AutoManaged) {
scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
- wm::GetWindowSettings(window.get())->set_window_position_managed(true);
+ wm::WindowState* window_state = wm::GetWindowState(window.get());
+ window_state->set_window_position_managed(true);
window->Hide();
window->SetBounds(gfx::Rect(100, 100, 100, 100));
window->Show();
- wm::MaximizeWindow(window.get());
+ window_state->Maximize();
SnapSizer::SnapWindow(window.get(), SnapSizer::RIGHT_EDGE);
const gfx::Rect kWorkAreaBounds =
@@ -286,7 +289,7 @@ TEST_F(SnapSizerTest, AutoManaged) {
window->GetBoundsInScreen().ToString());
// The window should still be auto managed despite being right maximized.
- EXPECT_TRUE(wm::GetWindowSettings(window.get())->window_position_managed());
+ EXPECT_TRUE(wm::GetWindowState(window.get())->window_position_managed());
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698