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

Unified Diff: ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/maximize_mode/maximize_mode_window_manager_unittest.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
index 9ed9887cc7921418559e3a452c4de4a17f907395..a618a37d91a1ebd487f91e0fd7997e89f87cbe57 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
@@ -47,8 +47,8 @@ class MaximizeModeWindowManagerTest : public test::AshTestBase {
// Creates a window which has a fixed size.
aura::Window* CreateFixedSizeNonMaximizableWindow(ui::wm::WindowType type,
const gfx::Rect& bounds) {
- return CreateWindowInWatchedContainer(
- type, bounds, gfx::Size(), false, false);
+ return CreateWindowInWatchedContainer(type, bounds, gfx::Size(), false,
+ false);
}
// Creates a window which can not be maximized, but resized. |max_size|
@@ -61,10 +61,9 @@ class MaximizeModeWindowManagerTest : public test::AshTestBase {
}
// Creates a maximizable and resizable window.
- aura::Window* CreateWindow(ui::wm::WindowType type,
- const gfx::Rect bounds) {
- return CreateWindowInWatchedContainer(
- type, bounds, gfx::Size(), true, true);
+ aura::Window* CreateWindow(ui::wm::WindowType type, const gfx::Rect bounds) {
+ return CreateWindowInWatchedContainer(type, bounds, gfx::Size(), true,
+ true);
}
// Creates a window which also has a widget.
@@ -85,22 +84,25 @@ class MaximizeModeWindowManagerTest : public test::AshTestBase {
// Create the Maximized mode window manager.
ash::MaximizeModeWindowManager* CreateMaximizeModeWindowManager() {
EXPECT_FALSE(maximize_mode_window_manager());
- Shell::GetInstance()->maximize_mode_controller()->
- EnableMaximizeModeWindowManager(true);
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(true);
return maximize_mode_window_manager();
}
// Destroy the maximized mode window manager.
void DestroyMaximizeModeWindowManager() {
- Shell::GetInstance()->maximize_mode_controller()->
- EnableMaximizeModeWindowManager(false);
+ Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(false);
EXPECT_FALSE(maximize_mode_window_manager());
}
// Get the maximze window manager.
ash::MaximizeModeWindowManager* maximize_mode_window_manager() {
- return Shell::GetInstance()->maximize_mode_controller()->
- maximize_mode_window_manager_.get();
+ return Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->maximize_mode_window_manager_.get();
}
// Resize our desktop.
@@ -319,8 +321,9 @@ TEST_F(MaximizeModeWindowManagerTest,
EXPECT_FALSE(wm::GetWindowState(fixed_window.get())->IsMaximized());
EXPECT_EQ(rect.ToString(), fixed_window->bounds().ToString());
- gfx::Size workspace_size = ScreenUtil::GetMaximizedWindowBoundsInParent(
- unlimited_window.get()).size();
+ gfx::Size workspace_size =
+ ScreenUtil::GetMaximizedWindowBoundsInParent(unlimited_window.get())
+ .size();
// Create the manager and make sure that all qualifying windows were detected
// and changed.
@@ -336,14 +339,12 @@ TEST_F(MaximizeModeWindowManagerTest,
EXPECT_FALSE(wm::GetWindowState(limited_window.get())->IsMaximized());
EXPECT_NE(rect.origin().ToString(),
limited_window->bounds().origin().ToString());
- EXPECT_EQ(max_size.ToString(),
- limited_window->bounds().size().ToString());
+ EXPECT_EQ(max_size.ToString(), limited_window->bounds().size().ToString());
// The fixed size window should have the size of the original window.
EXPECT_FALSE(wm::GetWindowState(fixed_window.get())->IsMaximized());
EXPECT_NE(rect.origin().ToString(),
fixed_window->bounds().origin().ToString());
- EXPECT_EQ(rect.size().ToString(),
- fixed_window->bounds().size().ToString());
+ EXPECT_EQ(rect.size().ToString(), fixed_window->bounds().size().ToString());
// Destroy the manager again and check that the windows return to their
// previous state.
@@ -455,8 +456,7 @@ TEST_F(MaximizeModeWindowManagerTest,
// Test that non-maximizable windows get properly handled when created in
// maximized mode.
-TEST_F(MaximizeModeWindowManagerTest,
- CreateNonMaximizableButResizableWindows) {
+TEST_F(MaximizeModeWindowManagerTest, CreateNonMaximizableButResizableWindows) {
// Create the manager and make sure that all qualifying windows were detected
// and changed.
ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
@@ -472,8 +472,9 @@ TEST_F(MaximizeModeWindowManagerTest,
std::unique_ptr<aura::Window> fixed_window(
CreateFixedSizeNonMaximizableWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
- gfx::Size workspace_size = ScreenUtil::GetMaximizedWindowBoundsInParent(
- unlimited_window.get()).size();
+ gfx::Size workspace_size =
+ ScreenUtil::GetMaximizedWindowBoundsInParent(unlimited_window.get())
+ .size();
// All windows should be sized now as big as possible and be centered.
EXPECT_EQ(3, manager->GetNumberOfManagedWindows());
@@ -486,14 +487,12 @@ TEST_F(MaximizeModeWindowManagerTest,
EXPECT_FALSE(wm::GetWindowState(limited_window.get())->IsMaximized());
EXPECT_NE(rect.origin().ToString(),
limited_window->bounds().origin().ToString());
- EXPECT_EQ(max_size.ToString(),
- limited_window->bounds().size().ToString());
+ EXPECT_EQ(max_size.ToString(), limited_window->bounds().size().ToString());
// The fixed size window should have the size of the original window.
EXPECT_FALSE(wm::GetWindowState(fixed_window.get())->IsMaximized());
EXPECT_NE(rect.origin().ToString(),
fixed_window->bounds().origin().ToString());
- EXPECT_EQ(rect.size().ToString(),
- fixed_window->bounds().size().ToString());
+ EXPECT_EQ(rect.size().ToString(), fixed_window->bounds().size().ToString());
// Destroy the manager again and check that the windows return to their
// creation state.
@@ -663,30 +662,29 @@ TEST_F(MaximizeModeWindowManagerTest, MinimizedWindowBehavior) {
ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
ASSERT_TRUE(manager);
EXPECT_EQ(3, manager->GetNumberOfManagedWindows());
- EXPECT_TRUE(wm::GetWindowState(
- initially_minimized_window.get())->IsMinimized());
+ EXPECT_TRUE(
+ wm::GetWindowState(initially_minimized_window.get())->IsMinimized());
EXPECT_TRUE(wm::GetWindowState(initially_normal_window.get())->IsMaximized());
- EXPECT_TRUE(wm::GetWindowState(
- initially_maximized_window.get())->IsMaximized());
+ EXPECT_TRUE(
+ wm::GetWindowState(initially_maximized_window.get())->IsMaximized());
// Now minimize the second window to check that upon leaving the window
// will get restored to its minimized state.
wm::GetWindowState(initially_normal_window.get())->Minimize();
wm::GetWindowState(initially_maximized_window.get())->Minimize();
- EXPECT_TRUE(wm::GetWindowState(
- initially_minimized_window.get())->IsMinimized());
- EXPECT_TRUE(wm::GetWindowState(
- initially_normal_window.get())->IsMinimized());
- EXPECT_TRUE(wm::GetWindowState(
- initially_maximized_window.get())->IsMinimized());
+ EXPECT_TRUE(
+ wm::GetWindowState(initially_minimized_window.get())->IsMinimized());
+ EXPECT_TRUE(wm::GetWindowState(initially_normal_window.get())->IsMinimized());
+ EXPECT_TRUE(
+ wm::GetWindowState(initially_maximized_window.get())->IsMinimized());
// Destroy the manager again and check that the window will get minimized.
DestroyMaximizeModeWindowManager();
- EXPECT_TRUE(wm::GetWindowState(
- initially_minimized_window.get())->IsMinimized());
- EXPECT_FALSE(wm::GetWindowState(
- initially_normal_window.get())->IsMinimized());
- EXPECT_TRUE(wm::GetWindowState(
- initially_maximized_window.get())->IsMaximized());
+ EXPECT_TRUE(
+ wm::GetWindowState(initially_minimized_window.get())->IsMinimized());
+ EXPECT_FALSE(
+ wm::GetWindowState(initially_normal_window.get())->IsMinimized());
+ EXPECT_TRUE(
+ wm::GetWindowState(initially_maximized_window.get())->IsMaximized());
}
// Check that resizing the desktop does reposition unmaximizable, unresizable &
@@ -835,8 +833,9 @@ TEST_F(MaximizeModeWindowManagerTest, TestMinimize) {
CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
wm::WindowState* window_state = wm::GetWindowState(window.get());
EXPECT_EQ(rect.ToString(), window->bounds().ToString());
- ash::Shell::GetInstance()->maximize_mode_controller()->
- EnableMaximizeModeWindowManager(true);
+ ash::Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(true);
EXPECT_TRUE(window_state->IsMaximized());
EXPECT_FALSE(window_state->IsMinimized());
EXPECT_TRUE(window->IsVisible());
@@ -851,8 +850,9 @@ TEST_F(MaximizeModeWindowManagerTest, TestMinimize) {
EXPECT_FALSE(window_state->IsMinimized());
EXPECT_TRUE(window->IsVisible());
- ash::Shell::GetInstance()->maximize_mode_controller()->
- EnableMaximizeModeWindowManager(false);
+ ash::Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(false);
EXPECT_FALSE(window_state->IsMaximized());
EXPECT_FALSE(window_state->IsMinimized());
EXPECT_TRUE(window->IsVisible());
@@ -1087,25 +1087,27 @@ TEST_F(MaximizeModeWindowManagerTest, TryToDesktopSizeDragUnmaximizable) {
// 2. Check that turning on the manager will stop allowing the window from
// dragging.
- ash::Shell::GetInstance()->maximize_mode_controller()->
- EnableMaximizeModeWindowManager(true);
+ ash::Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(true);
gfx::Rect center_bounds(window->bounds());
EXPECT_NE(rect.origin().ToString(), center_bounds.origin().ToString());
- generator.MoveMouseTo(gfx::Point(center_bounds.x() + 1,
- center_bounds.y() + 1));
+ generator.MoveMouseTo(
+ gfx::Point(center_bounds.x() + 1, center_bounds.y() + 1));
generator.PressLeftButton();
generator.MoveMouseBy(10, 5);
RunAllPendingInMessageLoop();
generator.ReleaseLeftButton();
EXPECT_EQ(center_bounds.x(), window->bounds().x());
EXPECT_EQ(center_bounds.y(), window->bounds().y());
- ash::Shell::GetInstance()->maximize_mode_controller()->
- EnableMaximizeModeWindowManager(false);
+ ash::Shell::GetInstance()
+ ->maximize_mode_controller()
+ ->EnableMaximizeModeWindowManager(false);
// 3. Releasing the mazimize manager again will restore the window to its
// previous bounds and
- generator.MoveMouseTo(gfx::Point(first_dragged_origin.x() + 1,
- first_dragged_origin.y() + 1));
+ generator.MoveMouseTo(
+ gfx::Point(first_dragged_origin.x() + 1, first_dragged_origin.y() + 1));
generator.PressLeftButton();
generator.MoveMouseBy(10, 5);
RunAllPendingInMessageLoop();
@@ -1166,19 +1168,15 @@ TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromTop) {
// Do an edge swipe top into screen.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
- generator.GestureScrollSequence(gfx::Point(50, 0),
- gfx::Point(50, 100),
- base::TimeDelta::FromMilliseconds(20),
- 10);
+ generator.GestureScrollSequence(gfx::Point(50, 0), gfx::Point(50, 100),
+ base::TimeDelta::FromMilliseconds(20), 10);
EXPECT_FALSE(foreground_window_state->IsFullscreen());
EXPECT_TRUE(background_window_state->IsFullscreen());
// Do a second edge swipe top into screen.
- generator.GestureScrollSequence(gfx::Point(50, 0),
- gfx::Point(50, 100),
- base::TimeDelta::FromMilliseconds(20),
- 10);
+ generator.GestureScrollSequence(gfx::Point(50, 0), gfx::Point(50, 100),
+ base::TimeDelta::FromMilliseconds(20), 10);
EXPECT_FALSE(foreground_window_state->IsFullscreen());
EXPECT_TRUE(background_window_state->IsFullscreen());
@@ -1211,10 +1209,8 @@ TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) {
// Do an edge swipe bottom into screen.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
int y = Shell::GetPrimaryRootWindow()->bounds().bottom();
- generator.GestureScrollSequence(gfx::Point(50, y),
- gfx::Point(50, y - 100),
- base::TimeDelta::FromMilliseconds(20),
- 10);
+ generator.GestureScrollSequence(gfx::Point(50, y), gfx::Point(50, y - 100),
+ base::TimeDelta::FromMilliseconds(20), 10);
EXPECT_FALSE(foreground_window_state->IsFullscreen());
EXPECT_TRUE(background_window_state->IsFullscreen());
@@ -1316,10 +1312,8 @@ TEST_F(MaximizeModeWindowManagerTest, NoExitImmersiveModeWithEdgeSwipeFromTop) {
// Do an edge swipe top into screen.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
- generator.GestureScrollSequence(gfx::Point(50, 0),
- gfx::Point(50, 100),
- base::TimeDelta::FromMilliseconds(20),
- 10);
+ generator.GestureScrollSequence(gfx::Point(50, 0), gfx::Point(50, 100),
+ base::TimeDelta::FromMilliseconds(20), 10);
// It should have not exited full screen or immersive mode.
EXPECT_TRUE(window_state->IsFullscreen());
@@ -1349,10 +1343,8 @@ TEST_F(MaximizeModeWindowManagerTest,
// Do an edge swipe bottom into screen.
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
int y = Shell::GetPrimaryRootWindow()->bounds().bottom();
- generator.GestureScrollSequence(gfx::Point(50, y),
- gfx::Point(50, y - 100),
- base::TimeDelta::FromMilliseconds(20),
- 10);
+ generator.GestureScrollSequence(gfx::Point(50, y), gfx::Point(50, y - 100),
+ base::TimeDelta::FromMilliseconds(20), 10);
// The window should still be full screen and immersive.
EXPECT_TRUE(window_state->IsFullscreen());
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_manager.cc ('k') | ash/wm/maximize_mode/maximize_mode_window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698