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

Side by Side Diff: ash/screen_util_unittest.cc

Issue 2017413002: ash: Fix variable names and setters in ShelfLayoutManager and tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shellshelf
Patch Set: review comments 3 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 unified diff | Download patch
« no previous file with comments | « ash/root_window_controller_unittest.cc ('k') | ash/shelf/shelf.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/screen_util.h" 5 #include "ash/screen_util.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_widget.h"
11 #include "ash/shell.h" 8 #include "ash/shell.h"
12 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
13 #include "ash/test/display_manager_test_api.h" 10 #include "ash/test/display_manager_test_api.h"
14 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
15 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
16 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 14 #include "ui/aura/window_event_dispatcher.h"
18 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
19 #include "ui/views/widget/widget_delegate.h" 16 #include "ui/views/widget/widget_delegate.h"
20 17
21 namespace ash { 18 namespace ash {
22 namespace test { 19 namespace test {
23 20
24 typedef test::AshTestBase ScreenUtilTest; 21 typedef test::AshTestBase ScreenUtilTest;
25 22
26 TEST_F(ScreenUtilTest, Bounds) { 23 TEST_F(ScreenUtilTest, Bounds) {
27 if (!SupportsMultipleDisplays()) 24 if (!SupportsMultipleDisplays())
28 return; 25 return;
29 26
30 UpdateDisplay("600x600,500x500"); 27 UpdateDisplay("600x600,500x500");
31 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager()->
32 SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
33
34 views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds( 28 views::Widget* primary = views::Widget::CreateWindowWithContextAndBounds(
35 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100)); 29 NULL, CurrentContext(), gfx::Rect(10, 10, 100, 100));
36 primary->Show(); 30 primary->Show();
37 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds( 31 views::Widget* secondary = views::Widget::CreateWindowWithContextAndBounds(
38 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100)); 32 NULL, CurrentContext(), gfx::Rect(610, 10, 100, 100));
39 secondary->Show(); 33 secondary->Show();
40 34
41 // Maximized bounds 35 // Maximized bounds. By default the shelf is 47px tall (ash::kShelfSize).
42 EXPECT_EQ("0,0 600x597", 36 EXPECT_EQ("0,0 600x553", ScreenUtil::GetMaximizedWindowBoundsInParent(
43 ScreenUtil::GetMaximizedWindowBoundsInParent( 37 primary->GetNativeView())
44 primary->GetNativeView()).ToString()); 38 .ToString());
45 EXPECT_EQ("0,0 500x453", 39 EXPECT_EQ("0,0 500x453",
46 ScreenUtil::GetMaximizedWindowBoundsInParent( 40 ScreenUtil::GetMaximizedWindowBoundsInParent(
47 secondary->GetNativeView()).ToString()); 41 secondary->GetNativeView()).ToString());
48 42
49 // Display bounds 43 // Display bounds
50 EXPECT_EQ("0,0 600x600", 44 EXPECT_EQ("0,0 600x600",
51 ScreenUtil::GetDisplayBoundsInParent( 45 ScreenUtil::GetDisplayBoundsInParent(
52 primary->GetNativeView()).ToString()); 46 primary->GetNativeView()).ToString());
53 EXPECT_EQ("0,0 500x500", 47 EXPECT_EQ("0,0 500x500",
54 ScreenUtil::GetDisplayBoundsInParent( 48 ScreenUtil::GetDisplayBoundsInParent(
55 secondary->GetNativeView()).ToString()); 49 secondary->GetNativeView()).ToString());
56 50
57 // Work area bounds 51 // Work area bounds
58 EXPECT_EQ("0,0 600x597", 52 EXPECT_EQ("0,0 600x553", ScreenUtil::GetDisplayWorkAreaBoundsInParent(
59 ScreenUtil::GetDisplayWorkAreaBoundsInParent( 53 primary->GetNativeView())
60 primary->GetNativeView()).ToString()); 54 .ToString());
61 EXPECT_EQ("0,0 500x453", 55 EXPECT_EQ("0,0 500x453",
62 ScreenUtil::GetDisplayWorkAreaBoundsInParent( 56 ScreenUtil::GetDisplayWorkAreaBoundsInParent(
63 secondary->GetNativeView()).ToString()); 57 secondary->GetNativeView()).ToString());
64 } 58 }
65 59
66 // Test verifies a stable handling of secondary screen widget changes 60 // Test verifies a stable handling of secondary screen widget changes
67 // (crbug.com/226132). 61 // (crbug.com/226132).
68 TEST_F(ScreenUtilTest, StabilityTest) { 62 TEST_F(ScreenUtilTest, StabilityTest) {
69 if (!SupportsMultipleDisplays()) 63 if (!SupportsMultipleDisplays())
70 return; 64 return;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 .ToString()); 138 .ToString());
145 139
146 UpdateDisplay("600x500"); 140 UpdateDisplay("600x500");
147 EXPECT_EQ("0,0 600x500", 141 EXPECT_EQ("0,0 600x500",
148 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow()) 142 ScreenUtil::GetShelfDisplayBoundsInRoot(widget->GetNativeWindow())
149 .ToString()); 143 .ToString());
150 } 144 }
151 145
152 } // namespace test 146 } // namespace test
153 } // namespace ash 147 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller_unittest.cc ('k') | ash/shelf/shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698