Index: ash/mus/workspace/workspace_layout_manager_unittest.cc |
diff --git a/mash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/mus/workspace/workspace_layout_manager_unittest.cc |
similarity index 91% |
rename from mash/wm/workspace/workspace_layout_manager_unittest.cc |
rename to ash/mus/workspace/workspace_layout_manager_unittest.cc |
index fd00ebeb085a83ffa701940a0598876f47214ead..380db93c5bf63de969a2f6acc2b0acd39342e2a8 100644 |
--- a/mash/wm/workspace/workspace_layout_manager_unittest.cc |
+++ b/ash/mus/workspace/workspace_layout_manager_unittest.cc |
@@ -12,14 +12,14 @@ |
#include "ash/common/wm/wm_event.h" |
#include "ash/common/wm/wm_root_window_controller_observer.h" |
#include "ash/common/wm/wm_screen_util.h" |
+#include "ash/mus/bridge/wm_root_window_controller_mus.h" |
+#include "ash/mus/bridge/wm_window_mus.h" |
+#include "ash/mus/test/wm_test_base.h" |
#include "components/mus/public/cpp/tests/test_window.h" |
-#include "mash/wm/bridge/wm_root_window_controller_mus.h" |
-#include "mash/wm/bridge/wm_window_mus.h" |
-#include "mash/wm/test/wm_test_base.h" |
#include "ui/display/display.h" |
-namespace mash { |
-namespace wm { |
+namespace ash { |
+namespace mus { |
namespace { |
// TODO(sky): no tests for multiple displays yet: http://crbug.com/612627. |
@@ -46,10 +46,10 @@ class MaximizeDelegateView : public views::WidgetDelegateView { |
}; |
*/ |
-class FullscreenObserver : public ash::wm::WmRootWindowControllerObserver { |
+class FullscreenObserver : public wm::WmRootWindowControllerObserver { |
public: |
explicit FullscreenObserver( |
- ash::wm::WmRootWindowController* root_window_controller) |
+ wm::WmRootWindowController* root_window_controller) |
: root_window_controller_(root_window_controller), |
call_count_(0), |
is_fullscreen_(false) { |
@@ -70,7 +70,7 @@ class FullscreenObserver : public ash::wm::WmRootWindowControllerObserver { |
bool is_fullscreen() const { return is_fullscreen_; } |
private: |
- ash::wm::WmRootWindowController* root_window_controller_; |
+ wm::WmRootWindowController* root_window_controller_; |
int call_count_; |
bool is_fullscreen_; |
@@ -85,12 +85,12 @@ using WorkspaceLayoutManagerTest = WmTestBase; |
// to the size prior to minimize, keeping the restore rectangle in tact (if |
// there is one). |
TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
gfx::Rect bounds(10, 15, 25, 35); |
window->SetBounds(bounds); |
- ash::wm::WindowState* window_state = window->GetWindowState(); |
+ wm::WindowState* window_state = window->GetWindowState(); |
// This will not be used for un-minimizing window. |
window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100)); |
@@ -149,7 +149,7 @@ TEST_F(WorkspaceLayoutManagerTest, NoMinimumVisibilityForPopupWindows) { |
// Create a popup window out of display boundaries and make sure it is not |
// moved to have minimum visibility. |
- mus::Window* mus_window = |
+ ::mus::Window* mus_window = |
CreateTestWindow(gfx::Rect(400, 100, 50, 50), ui::wm::WINDOW_TYPE_POPUP); |
WmWindowMus* window = WmWindowMus::Get(mus_window); |
EXPECT_EQ("400,100 50x50", window->GetBoundsInScreen().ToString()); |
@@ -351,12 +351,12 @@ TEST_F(WorkspaceLayoutManagerTest, DontClobberRestoreBounds) { |
// Verifies when a window is maximized all descendant windows have a size. |
TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
- ash::wm::WindowState* window_state = window->GetWindowState(); |
+ wm::WindowState* window_state = window->GetWindowState(); |
window_state->Activate(); |
- mus::Window* child_window = |
+ ::mus::Window* child_window = |
CreateChildTestWindow(mus_window, gfx::Rect(5, 6, 7, 8)); |
window_state->Maximize(); |
EXPECT_EQ("5,6 7x8", child_window->bounds().ToString()); |
@@ -365,7 +365,7 @@ TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) { |
// Verifies a window created with maximized state has the maximized |
// bounds. |
TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect()); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect()); |
WmWindowMus* window = WmWindowMus::Get(mus_window); |
window->GetWindowState()->Maximize(); |
gfx::Rect work_area(GetPrimaryDisplay().work_area()); |
@@ -375,16 +375,16 @@ TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) { |
TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { |
// Normal window bounds shouldn't be changed. |
gfx::Rect window_bounds(100, 100, 200, 200); |
- mus::Window* mus_window = CreateTestWindow(window_bounds); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(window_bounds); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
EXPECT_EQ(window_bounds, mus_window->bounds()); |
// If the window is out of the workspace, it would be moved on screen. |
gfx::Rect root_window_bounds = GetPrimaryRootWindow()->bounds(); |
window_bounds.Offset(root_window_bounds.width(), root_window_bounds.height()); |
ASSERT_FALSE(window_bounds.Intersects(root_window_bounds)); |
- mus::Window* out_mus_window = CreateTestWindow(window_bounds); |
- ash::wm::WmWindow* out_window = WmWindowMus::Get(out_mus_window); |
+ ::mus::Window* out_mus_window = CreateTestWindow(window_bounds); |
+ wm::WmWindow* out_window = WmWindowMus::Get(out_mus_window); |
EXPECT_EQ(window_bounds.size(), out_mus_window->bounds().size()); |
gfx::Rect bounds = out_mus_window->bounds(); |
bounds.Intersect(root_window_bounds); |
@@ -393,7 +393,7 @@ TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { |
EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29); |
EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29); |
- mus::Window* mus_parent = out_mus_window->parent(); |
+ ::mus::Window* mus_parent = out_mus_window->parent(); |
mus_parent->RemoveChild(out_mus_window); |
out_window->SetBounds(gfx::Rect(-200, -200, 200, 200)); |
// UserHasChangedWindowPositionOrSize flag shouldn't turn off this behavior. |
@@ -414,7 +414,7 @@ TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { |
ASSERT_LT(bounds.height(), out_mus_window->bounds().height() * 0.26); |
ASSERT_TRUE(window_bounds.Intersects(root_window_bounds)); |
- mus::Window* partially_out_mus_window = CreateTestWindow(window_bounds); |
+ ::mus::Window* partially_out_mus_window = CreateTestWindow(window_bounds); |
EXPECT_EQ(window_bounds.size(), partially_out_mus_window->bounds().size()); |
bounds = partially_out_mus_window->bounds(); |
bounds.Intersect(root_window_bounds); |
@@ -424,7 +424,8 @@ TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { |
// Make sure the window whose 30% width/height is bigger than display |
// will be placed correctly. |
window_bounds.SetRect(-1900, -1900, 3000, 3000); |
- mus::Window* mus_window_bigger_than_display = CreateTestWindow(window_bounds); |
+ ::mus::Window* mus_window_bigger_than_display = |
+ CreateTestWindow(window_bounds); |
EXPECT_GE(root_window_bounds.width(), |
mus_window_bigger_than_display->bounds().width()); |
EXPECT_GE(root_window_bounds.height(), |
@@ -442,7 +443,7 @@ TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) { |
gfx::Size work_area(GetPrimaryDisplay().work_area().size()); |
const gfx::Rect window_bounds(100, 101, work_area.width() + 1, |
work_area.height() + 2); |
- mus::Window* window = CreateTestWindow(window_bounds); |
+ ::mus::Window* window = CreateTestWindow(window_bounds); |
EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), |
window->bounds().ToString()); |
@@ -456,16 +457,13 @@ TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) { |
TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) { |
FullscreenObserver observer( |
WmWindowMus::Get(GetPrimaryRootWindow())->GetRootWindowController()); |
- mus::Window* window1 = CreateTestWindow(gfx::Rect(1, 2, 30, 40)); |
- mus::Window* window2 = CreateTestWindow(gfx::Rect(1, 2, 30, 40)); |
- ash::wm::WindowState* window_state1 = |
- WmWindowMus::Get(window1)->GetWindowState(); |
- ash::wm::WindowState* window_state2 = |
- WmWindowMus::Get(window2)->GetWindowState(); |
+ ::mus::Window* window1 = CreateTestWindow(gfx::Rect(1, 2, 30, 40)); |
+ ::mus::Window* window2 = CreateTestWindow(gfx::Rect(1, 2, 30, 40)); |
+ wm::WindowState* window_state1 = WmWindowMus::Get(window1)->GetWindowState(); |
+ wm::WindowState* window_state2 = WmWindowMus::Get(window2)->GetWindowState(); |
window_state2->Activate(); |
- const ash::wm::WMEvent toggle_fullscreen_event( |
- ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); |
+ const wm::WMEvent toggle_fullscreen_event(wm::WM_EVENT_TOGGLE_FULLSCREEN); |
window_state2->OnWMEvent(&toggle_fullscreen_event); |
EXPECT_EQ(1, observer.call_count()); |
EXPECT_TRUE(observer.is_fullscreen()); |
@@ -499,11 +497,11 @@ using WorkspaceLayoutManagerSoloTest = WmTestBase; |
// Tests normal->maximize->normal. |
TEST_F(WorkspaceLayoutManagerSoloTest, Maximize) { |
gfx::Rect bounds(100, 100, 200, 200); |
- mus::Window* mus_window = CreateTestWindow(bounds); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(bounds); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
window->SetShowState(ui::SHOW_STATE_MAXIMIZED); |
// Maximized window fills the work area, not the whole display. |
- EXPECT_EQ(ash::wm::GetMaximizedWindowBoundsInParent(window).ToString(), |
+ EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(), |
mus_window->bounds().ToString()); |
window->SetShowState(ui::SHOW_STATE_NORMAL); |
EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString()); |
@@ -512,8 +510,8 @@ TEST_F(WorkspaceLayoutManagerSoloTest, Maximize) { |
// Tests normal->minimize->normal. |
TEST_F(WorkspaceLayoutManagerSoloTest, Minimize) { |
gfx::Rect bounds(100, 100, 200, 200); |
- mus::Window* mus_window = CreateTestWindow(bounds); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(bounds); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
window->SetShowState(ui::SHOW_STATE_MINIMIZED); |
// Note: Currently minimize doesn't do anything except set the state. |
// See crbug.com/104571. |
@@ -523,16 +521,16 @@ TEST_F(WorkspaceLayoutManagerSoloTest, Minimize) { |
} |
// A WindowObserver which sets the focus when the window becomes visible. |
-class FocusObserver : public mus::WindowObserver { |
+class FocusObserver : public ::mus::WindowObserver { |
public: |
- explicit FocusObserver(mus::Window* window) |
+ explicit FocusObserver(::mus::Window* window) |
: window_(window), show_state_(ui::SHOW_STATE_END) { |
window_->AddObserver(this); |
} |
~FocusObserver() override { window_->RemoveObserver(this); } |
// aura::test::TestWindowDelegate overrides: |
- void OnWindowVisibilityChanged(mus::Window* window) override { |
+ void OnWindowVisibilityChanged(::mus::Window* window) override { |
if (window_->visible()) |
window_->SetFocus(); |
show_state_ = WmWindowMus::Get(window_)->GetShowState(); |
@@ -545,7 +543,7 @@ class FocusObserver : public mus::WindowObserver { |
} |
private: |
- mus::Window* window_; |
+ ::mus::Window* window_; |
ui::WindowShowState show_state_; |
DISALLOW_COPY_AND_ASSIGN(FocusObserver); |
@@ -558,8 +556,8 @@ class FocusObserver : public mus::WindowObserver { |
// NOTE: this was adapted from the ash test of the same name, I suspect this |
// test isn't particularly useful for mash. |
TEST_F(WorkspaceLayoutManagerSoloTest, FocusDuringUnminimize) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(100, 100, 100, 100)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(100, 100, 100, 100)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
FocusObserver observer(mus_window); |
window->SetShowState(ui::SHOW_STATE_MINIMIZED); |
EXPECT_FALSE(window->IsVisible()); |
@@ -572,26 +570,26 @@ TEST_F(WorkspaceLayoutManagerSoloTest, FocusDuringUnminimize) { |
// Tests maximized window size during root window resize. |
TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeRootWindowResize) { |
gfx::Rect bounds(100, 100, 200, 200); |
- mus::Window* mus_window = CreateTestWindow(bounds); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(bounds); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
window->SetShowState(ui::SHOW_STATE_MAXIMIZED); |
gfx::Rect initial_work_area_bounds = |
- ash::wm::GetMaximizedWindowBoundsInParent(window); |
+ wm::GetMaximizedWindowBoundsInParent(window); |
EXPECT_EQ(initial_work_area_bounds.ToString(), |
mus_window->bounds().ToString()); |
// Enlarge the root window. We should still match the work area size. |
UpdateDisplay("900x700"); |
- EXPECT_EQ(ash::wm::GetMaximizedWindowBoundsInParent(window).ToString(), |
+ EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(), |
mus_window->bounds().ToString()); |
EXPECT_NE(initial_work_area_bounds.ToString(), |
- ash::wm::GetMaximizedWindowBoundsInParent(window).ToString()); |
+ wm::GetMaximizedWindowBoundsInParent(window).ToString()); |
} |
// Tests normal->fullscreen->normal. |
TEST_F(WorkspaceLayoutManagerSoloTest, Fullscreen) { |
gfx::Rect bounds(100, 100, 200, 200); |
- mus::Window* mus_window = CreateTestWindow(bounds); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(bounds); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
window->SetShowState(ui::SHOW_STATE_FULLSCREEN); |
// Fullscreen window fills the whole display. |
EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(), |
@@ -603,12 +601,12 @@ TEST_F(WorkspaceLayoutManagerSoloTest, Fullscreen) { |
// Tests that fullscreen window causes always_on_top windows to stack below. |
TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenSuspendsAlwaysOnTop) { |
gfx::Rect bounds(100, 100, 200, 200); |
- mus::Window* mus_fullscreen_window = CreateTestWindow(bounds); |
+ ::mus::Window* mus_fullscreen_window = CreateTestWindow(bounds); |
WmWindowMus* fullscreen_window = WmWindowMus::Get(mus_fullscreen_window); |
- mus::Window* mus_always_on_top_window1 = CreateTestWindow(bounds); |
+ ::mus::Window* mus_always_on_top_window1 = CreateTestWindow(bounds); |
WmWindowMus* always_on_top_window1 = |
WmWindowMus::Get(mus_always_on_top_window1); |
- mus::Window* mus_always_on_top_window2 = CreateTestWindow(bounds); |
+ ::mus::Window* mus_always_on_top_window2 = CreateTestWindow(bounds); |
WmWindowMus* always_on_top_window2 = |
WmWindowMus::Get(mus_always_on_top_window2); |
always_on_top_window1->SetAlwaysOnTop(true); |
@@ -628,8 +626,8 @@ TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenSuspendsAlwaysOnTop) { |
// Tests fullscreen window size during root window resize. |
TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { |
gfx::Rect bounds(100, 100, 200, 200); |
- mus::Window* mus_window = CreateTestWindow(bounds); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(bounds); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
// Fullscreen window fills the whole display. |
window->SetShowState(ui::SHOW_STATE_FULLSCREEN); |
EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(), |
@@ -643,8 +641,8 @@ TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { |
// Tests that when the screen gets smaller the windows aren't bigger than |
// the screen. |
TEST_F(WorkspaceLayoutManagerSoloTest, RootWindowResizeShrinksWindows) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 500, 400)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 500, 400)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
gfx::Rect work_area = window->GetDisplayNearestWindow().work_area(); |
// Invariant: Window is smaller than work area. |
EXPECT_LE(mus_window->bounds().width(), work_area.width()); |
@@ -672,9 +670,9 @@ TEST_F(WorkspaceLayoutManagerSoloTest, RootWindowResizeShrinksWindows) { |
// Verifies maximizing sets the restore bounds, and restoring |
// restores the bounds. |
TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeSetsRestoreBounds) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
- ash::wm::WindowState* window_state = window->GetWindowState(); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ wm::WindowState* window_state = window->GetWindowState(); |
// Maximize it, which will keep the previous restore bounds. |
window->SetShowState(ui::SHOW_STATE_MAXIMIZED); |
@@ -688,10 +686,10 @@ TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeSetsRestoreBounds) { |
// Verifies maximizing keeps the restore bounds if set. |
TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeResetsRestoreBounds) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
- ash::wm::WindowState* window_state = window->GetWindowState(); |
+ wm::WindowState* window_state = window->GetWindowState(); |
window_state->SetRestoreBoundsInParent(gfx::Rect(10, 11, 12, 13)); |
// Maximize it, which will keep the previous restore bounds. |
@@ -703,12 +701,12 @@ TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeResetsRestoreBounds) { |
// maximzied state from a minimized state. |
TEST_F(WorkspaceLayoutManagerSoloTest, |
BoundsAfterRestoringToMaximizeFromMinimize) { |
- mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); |
- ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); |
+ ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); |
+ wm::WmWindow* window = WmWindowMus::Get(mus_window); |
gfx::Rect bounds(10, 15, 25, 35); |
window->SetBounds(bounds); |
- ash::wm::WindowState* window_state = window->GetWindowState(); |
+ wm::WindowState* window_state = window->GetWindowState(); |
// Maximize it, which should reset restore bounds. |
window_state->Maximize(); |
EXPECT_EQ(bounds.ToString(), |
@@ -1103,5 +1101,5 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) { |
} |
*/ |
-} // namespace wm |
-} // namespace mash |
+} // namespace mus |
+} // namespace ash |