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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 337193002: WorkspaceLayoutManager backdrop should fill entire region. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string>
jonross 2014/06/16 18:50:58 cpplint
8
7 #include "ash/display/display_layout.h" 9 #include "ash/display/display_layout.h"
8 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
9 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
11 #include "ash/session/session_state_delegate.h" 13 #include "ash/session/session_state_delegate.h"
12 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shell.h" 15 #include "ash/shell.h"
14 #include "ash/shell_observer.h" 16 #include "ash/shell_observer.h"
15 #include "ash/shell_window_ids.h" 17 #include "ash/shell_window_ids.h"
16 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
(...skipping 15 matching lines...) Expand all
32 #include "ui/gfx/screen.h" 34 #include "ui/gfx/screen.h"
33 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
34 #include "ui/views/widget/widget_delegate.h" 36 #include "ui/views/widget/widget_delegate.h"
35 #include "ui/wm/core/window_util.h" 37 #include "ui/wm/core/window_util.h"
36 38
37 namespace ash { 39 namespace ash {
38 namespace { 40 namespace {
39 41
40 class MaximizeDelegateView : public views::WidgetDelegateView { 42 class MaximizeDelegateView : public views::WidgetDelegateView {
41 public: 43 public:
42 MaximizeDelegateView(const gfx::Rect& initial_bounds) 44 explicit MaximizeDelegateView(const gfx::Rect& initial_bounds)
jonross 2014/06/16 18:50:58 cpplint
43 : initial_bounds_(initial_bounds) { 45 : initial_bounds_(initial_bounds) {
44 } 46 }
45 virtual ~MaximizeDelegateView() {} 47 virtual ~MaximizeDelegateView() {}
46 48
47 virtual bool GetSavedWindowPlacement( 49 virtual bool GetSavedWindowPlacement(
48 const views::Widget* widget, 50 const views::Widget* widget,
49 gfx::Rect* bounds, 51 gfx::Rect* bounds,
50 ui::WindowShowState* show_state) const OVERRIDE { 52 ui::WindowShowState* show_state) const OVERRIDE {
51 *bounds = initial_bounds_; 53 *bounds = initial_bounds_;
52 *show_state = ui::SHOW_STATE_MAXIMIZED; 54 *show_state = ui::SHOW_STATE_MAXIMIZED;
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 window3.reset(); 937 window3.reset();
936 EXPECT_EQ("b,x", 938 EXPECT_EQ("b,x",
937 GetWindowOrderAsString(backdrop, window1.get(), window2.get(), 939 GetWindowOrderAsString(backdrop, window1.get(), window2.get(),
938 window3.get())); 940 window3.get()));
939 ShowTopWindowBackdrop(false); 941 ShowTopWindowBackdrop(false);
940 EXPECT_EQ("b", 942 EXPECT_EQ("b",
941 GetWindowOrderAsString(NULL, window1.get(), window2.get(), 943 GetWindowOrderAsString(NULL, window1.get(), window2.get(),
942 window3.get())); 944 window3.get()));
943 } 945 }
944 946
947 // Tests that when hidding the shelf, that the backdrop resizes to fill the
948 // entire workspace area.
949 TEST_F(WorkspaceLayoutManagerBackdropTest, ShelfVisibilityChangesBounds) {
950 // Set to the size of the display to cause sizing issues with the shelf
flackr 2014/06/17 14:01:08 The comment isn't clear, to cause what sizing issu
jonross 2014/06/17 14:05:58 This is reproducible with just shelf changes. Howe
flackr 2014/06/17 14:13:25 Can you check what those issues are? I'd prefer to
jonross 2014/06/17 14:24:31 The other tests pass with line 795 gone. Whatever
951 default_container()->SetBounds(gfx::Rect(0, 0, 800, 600));
952 ShelfLayoutManager* shelf_layout_manager =
953 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager();
954 ShowTopWindowBackdrop(true);
955 RunAllPendingInMessageLoop();
956
957 gfx::Rect initial_bounds = default_container()->children()[0]->bounds();
958 shelf_layout_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
959 shelf_layout_manager->UpdateVisibilityState();
960
961 // When the shelf is re-shown WorkspaceLayoutManager shrinks all children
962 // including the backdrop.
963 shelf_layout_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
964 shelf_layout_manager->UpdateVisibilityState();
965 gfx::Rect reduced_bounds = default_container()->children()[0]->bounds();
966 EXPECT_LT(reduced_bounds.height(), initial_bounds.height());
967
968 shelf_layout_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
969 shelf_layout_manager->UpdateVisibilityState();
970
971 EXPECT_GT(default_container()->children()[0]->bounds().height(),
972 reduced_bounds.height());
973 }
974
945 class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { 975 class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase {
946 public: 976 public:
947 WorkspaceLayoutManagerKeyboardTest() {} 977 WorkspaceLayoutManagerKeyboardTest() {}
948 virtual ~WorkspaceLayoutManagerKeyboardTest() {} 978 virtual ~WorkspaceLayoutManagerKeyboardTest() {}
949 979
950 virtual void SetUp() OVERRIDE { 980 virtual void SetUp() OVERRIDE {
951 test::AshTestBase::SetUp(); 981 test::AshTestBase::SetUp();
952 UpdateDisplay("800x600"); 982 UpdateDisplay("800x600");
953 aura::Window* default_container = Shell::GetContainer( 983 aura::Window* default_container = Shell::GetContainer(
954 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); 984 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
(...skipping 21 matching lines...) Expand all
976 layout_manager_->OnKeyboardBoundsChanging(gfx::Rect()); 1006 layout_manager_->OnKeyboardBoundsChanging(gfx::Rect());
977 } 1007 }
978 1008
979 void SetKeyboardBounds(const gfx::Rect& bounds) { 1009 void SetKeyboardBounds(const gfx::Rect& bounds) {
980 keyboard_bounds_ = bounds; 1010 keyboard_bounds_ = bounds;
981 } 1011 }
982 1012
983 private: 1013 private:
984 gfx::Insets restore_work_area_insets_; 1014 gfx::Insets restore_work_area_insets_;
985 gfx::Rect keyboard_bounds_; 1015 gfx::Rect keyboard_bounds_;
986 WorkspaceLayoutManager *layout_manager_; 1016 WorkspaceLayoutManager* layout_manager_;
jonross 2014/06/16 18:50:58 cpplint
987 1017
988 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest); 1018 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest);
989 }; 1019 };
990 1020
991 class FakeTextInputClient : public ui::DummyTextInputClient { 1021 class FakeTextInputClient : public ui::DummyTextInputClient {
992 public: 1022 public:
993 FakeTextInputClient(gfx::NativeWindow window) : window_(window) {} 1023 explicit FakeTextInputClient(gfx::NativeWindow window) : window_(window) {}
jonross 2014/06/16 18:50:58 cpplint
994 virtual ~FakeTextInputClient() {} 1024 virtual ~FakeTextInputClient() {}
995 1025
996 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE { 1026 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE {
997 return window_; 1027 return window_;
998 } 1028 }
999 1029
1000 private: 1030 private:
1001 gfx::NativeWindow window_; 1031 gfx::NativeWindow window_;
1002 1032
1003 DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient); 1033 DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 window->SetBounds(gfx::Rect(50, 50, 100, 500)); 1066 window->SetBounds(gfx::Rect(50, 50, 100, 500));
1037 EXPECT_EQ("50,50 100x500", window->bounds().ToString()); 1067 EXPECT_EQ("50,50 100x500", window->bounds().ToString());
1038 ShowKeyboard(); 1068 ShowKeyboard();
1039 EXPECT_EQ(gfx::Rect(50, 0, 100, available_height).ToString(), 1069 EXPECT_EQ(gfx::Rect(50, 0, 100, available_height).ToString(),
1040 window->bounds().ToString()); 1070 window->bounds().ToString());
1041 HideKeyboard(); 1071 HideKeyboard();
1042 input_method->SetFocusedTextInputClient(NULL); 1072 input_method->SetFocusedTextInputClient(NULL);
1043 } 1073 }
1044 1074
1045 } // namespace ash 1075 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698