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

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

Issue 2409053002: mash: Use null AcceleratedWidget for widgets in tests (Closed)
Patch Set: . Created 4 years, 2 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
« no previous file with comments | « no previous file | mash/test/mash_test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/wm/workspace/workspace_layout_manager.h" 5 #include "ash/common/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 WmWindow* default_container_; 927 WmWindow* default_container_;
928 928
929 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerBackdropTest); 929 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerBackdropTest);
930 }; 930 };
931 931
932 } // namespace 932 } // namespace
933 933
934 // Check that creating the BackDrop without destroying it does not lead into 934 // Check that creating the BackDrop without destroying it does not lead into
935 // a crash. 935 // a crash.
936 TEST_F(WorkspaceLayoutManagerBackdropTest, BackdropCrashTest) { 936 TEST_F(WorkspaceLayoutManagerBackdropTest, BackdropCrashTest) {
937 // TODO: Triggers crash in mash: http://crbug.com/652871.
938 if (WmShell::Get()->IsRunningInMash())
939 return;
940
941 ShowTopWindowBackdrop(true); 937 ShowTopWindowBackdrop(true);
942 } 938 }
943 939
944 // Verify basic assumptions about the backdrop. 940 // Verify basic assumptions about the backdrop.
945 TEST_F(WorkspaceLayoutManagerBackdropTest, BasicBackdropTests) { 941 TEST_F(WorkspaceLayoutManagerBackdropTest, BasicBackdropTests) {
946 // TODO: Triggers crash in mash: http://crbug.com/652871.
947 if (WmShell::Get()->IsRunningInMash())
948 return;
949
950 // Create a backdrop and see that there is one window (the backdrop) and 942 // Create a backdrop and see that there is one window (the backdrop) and
951 // that the size is the same as the default container as well as that it is 943 // that the size is the same as the default container as well as that it is
952 // not visible. 944 // not visible.
953 ShowTopWindowBackdrop(true); 945 ShowTopWindowBackdrop(true);
954 ASSERT_EQ(1U, default_container()->GetChildren().size()); 946 ASSERT_EQ(1U, default_container()->GetChildren().size());
955 EXPECT_FALSE(default_container()->GetChildren()[0]->IsVisible()); 947 EXPECT_FALSE(default_container()->GetChildren()[0]->IsVisible());
956 948
957 { 949 {
958 // Add a window and make sure that the backdrop is the second child. 950 // Add a window and make sure that the backdrop is the second child.
959 std::unique_ptr<WindowOwner> window_owner( 951 std::unique_ptr<WindowOwner> window_owner(
(...skipping 12 matching lines...) Expand all
972 ASSERT_EQ(1U, default_container()->GetChildren().size()); 964 ASSERT_EQ(1U, default_container()->GetChildren().size());
973 EXPECT_FALSE(default_container()->GetChildren()[0]->IsVisible()); 965 EXPECT_FALSE(default_container()->GetChildren()[0]->IsVisible());
974 966
975 // Destroying the Backdrop should empty the container. 967 // Destroying the Backdrop should empty the container.
976 ShowTopWindowBackdrop(false); 968 ShowTopWindowBackdrop(false);
977 ASSERT_EQ(0U, default_container()->GetChildren().size()); 969 ASSERT_EQ(0U, default_container()->GetChildren().size());
978 } 970 }
979 971
980 // Verify that the backdrop gets properly created and placed. 972 // Verify that the backdrop gets properly created and placed.
981 TEST_F(WorkspaceLayoutManagerBackdropTest, VerifyBackdropAndItsStacking) { 973 TEST_F(WorkspaceLayoutManagerBackdropTest, VerifyBackdropAndItsStacking) {
982 // TODO: Triggers crash in mash: http://crbug.com/652871.
983 if (WmShell::Get()->IsRunningInMash())
984 return;
985
986 std::unique_ptr<WindowOwner> window1_owner( 974 std::unique_ptr<WindowOwner> window1_owner(
987 CreateTestWindow(gfx::Rect(1, 2, 3, 4))); 975 CreateTestWindow(gfx::Rect(1, 2, 3, 4)));
988 WmWindow* window1 = window1_owner->window(); 976 WmWindow* window1 = window1_owner->window();
989 window1->Show(); 977 window1->Show();
990 978
991 // Get the default container and check that only a single window is in there. 979 // Get the default container and check that only a single window is in there.
992 ASSERT_EQ(1U, default_container()->GetChildren().size()); 980 ASSERT_EQ(1U, default_container()->GetChildren().size());
993 EXPECT_EQ(window1, default_container()->GetChildren()[0]); 981 EXPECT_EQ(window1, default_container()->GetChildren()[0]);
994 EXPECT_EQ("A", GetWindowOrderAsString(nullptr, window1, nullptr, nullptr)); 982 EXPECT_EQ("A", GetWindowOrderAsString(nullptr, window1, nullptr, nullptr));
995 983
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 GetWindowOrderAsString(backdrop, window1, window2, window3)); 1018 GetWindowOrderAsString(backdrop, window1, window2, window3));
1031 window3_owner.reset(); 1019 window3_owner.reset();
1032 EXPECT_EQ("b,x", GetWindowOrderAsString(backdrop, window1, window2, window3)); 1020 EXPECT_EQ("b,x", GetWindowOrderAsString(backdrop, window1, window2, window3));
1033 ShowTopWindowBackdrop(false); 1021 ShowTopWindowBackdrop(false);
1034 EXPECT_EQ("b", GetWindowOrderAsString(nullptr, window1, window2, window3)); 1022 EXPECT_EQ("b", GetWindowOrderAsString(nullptr, window1, window2, window3));
1035 } 1023 }
1036 1024
1037 // Tests that when hidding the shelf, that the backdrop resizes to fill the 1025 // Tests that when hidding the shelf, that the backdrop resizes to fill the
1038 // entire workspace area. 1026 // entire workspace area.
1039 TEST_F(WorkspaceLayoutManagerBackdropTest, ShelfVisibilityChangesBounds) { 1027 TEST_F(WorkspaceLayoutManagerBackdropTest, ShelfVisibilityChangesBounds) {
1040 // TODO: Triggers crash in mash: http://crbug.com/652871.
1041 if (WmShell::Get()->IsRunningInMash())
1042 return;
1043
1044 WmShelf* shelf = GetPrimaryShelf(); 1028 WmShelf* shelf = GetPrimaryShelf();
1045 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); 1029 ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager();
1046 ShowTopWindowBackdrop(true); 1030 ShowTopWindowBackdrop(true);
1047 RunAllPendingInMessageLoop(); 1031 RunAllPendingInMessageLoop();
1048 1032
1049 ASSERT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state()); 1033 ASSERT_EQ(SHELF_VISIBLE, shelf_layout_manager->visibility_state());
1050 gfx::Rect initial_bounds = default_container()->GetChildren()[0]->GetBounds(); 1034 gfx::Rect initial_bounds = default_container()->GetChildren()[0]->GetBounds();
1051 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); 1035 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
1052 shelf_layout_manager->UpdateVisibilityState(); 1036 shelf_layout_manager->UpdateVisibilityState();
1053 1037
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 WmWindow* window = window_owner->window(); 1193 WmWindow* window = window_owner->window();
1210 window->GetWindowState()->set_ignore_keyboard_bounds_change(true); 1194 window->GetWindowState()->set_ignore_keyboard_bounds_change(true);
1211 window->Activate(); 1195 window->Activate();
1212 1196
1213 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1197 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1214 ShowKeyboard(); 1198 ShowKeyboard();
1215 EXPECT_EQ(keyboard_bounds(), window->GetBounds()); 1199 EXPECT_EQ(keyboard_bounds(), window->GetBounds());
1216 } 1200 }
1217 1201
1218 } // namespace ash 1202 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | mash/test/mash_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698