OLD | NEW |
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/screen_ash.h" | 5 #include "ash/screen_ash.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 views::Widget* primary = | 44 views::Widget* primary = |
45 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 45 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
46 primary->Show(); | 46 primary->Show(); |
47 views::Widget* secondary = | 47 views::Widget* secondary = |
48 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 48 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
49 secondary->Show(); | 49 secondary->Show(); |
50 | 50 |
51 // Maximized bounds | 51 // Maximized bounds |
52 EXPECT_EQ("0,0 600x598", | 52 EXPECT_EQ("0,0 600x598", |
53 ScreenAsh::GetMaximizedWindowParentBounds( | 53 ScreenAsh::GetMaximizedWindowBoundsInParent( |
54 primary->GetNativeView()).ToString()); | 54 primary->GetNativeView()).ToString()); |
55 EXPECT_EQ("0,0 500x500", | 55 EXPECT_EQ("0,0 500x500", |
56 ScreenAsh::GetMaximizedWindowParentBounds( | 56 ScreenAsh::GetMaximizedWindowBoundsInParent( |
57 secondary->GetNativeView()).ToString()); | 57 secondary->GetNativeView()).ToString()); |
58 | 58 |
59 // Unmaximized work area bounds | 59 // Unmaximized work area bounds |
60 EXPECT_EQ("0,0 600x552", | 60 EXPECT_EQ("0,0 600x552", |
61 ScreenAsh::GetUnmaximizedWorkAreaParentBounds( | 61 ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( |
62 primary->GetNativeView()).ToString()); | 62 primary->GetNativeView()).ToString()); |
63 EXPECT_EQ("0,0 500x500", | 63 EXPECT_EQ("0,0 500x500", |
64 ScreenAsh::GetUnmaximizedWorkAreaParentBounds( | 64 ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent( |
65 secondary->GetNativeView()).ToString()); | 65 secondary->GetNativeView()).ToString()); |
66 | 66 |
67 // Display bounds | 67 // Display bounds |
68 EXPECT_EQ("0,0 600x600", | 68 EXPECT_EQ("0,0 600x600", |
69 ScreenAsh::GetDisplayParentBounds( | 69 ScreenAsh::GetDisplayBoundsInParent( |
70 primary->GetNativeView()).ToString()); | 70 primary->GetNativeView()).ToString()); |
71 EXPECT_EQ("0,0 500x500", | 71 EXPECT_EQ("0,0 500x500", |
72 ScreenAsh::GetDisplayParentBounds( | 72 ScreenAsh::GetDisplayBoundsInParent( |
73 secondary->GetNativeView()).ToString()); | 73 secondary->GetNativeView()).ToString()); |
74 | 74 |
75 // Work area bounds | 75 // Work area bounds |
76 EXPECT_EQ("0,0 600x552", | 76 EXPECT_EQ("0,0 600x552", |
77 ScreenAsh::GetDisplayWorkAreaParentBounds( | 77 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
78 primary->GetNativeView()).ToString()); | 78 primary->GetNativeView()).ToString()); |
79 EXPECT_EQ("0,0 500x500", | 79 EXPECT_EQ("0,0 500x500", |
80 ScreenAsh::GetDisplayWorkAreaParentBounds( | 80 ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
81 secondary->GetNativeView()).ToString()); | 81 secondary->GetNativeView()).ToString()); |
82 } | 82 } |
83 #endif | 83 #endif |
84 | 84 |
85 TEST_F(ScreenAshTest, ConvertRect) { | 85 TEST_F(ScreenAshTest, ConvertRect) { |
86 UpdateDisplay("0+0-600x600,600+0-500x500"); | 86 UpdateDisplay("0+0-600x600,600+0-500x500"); |
87 | 87 |
88 views::Widget* primary = | 88 views::Widget* primary = |
89 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 89 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
90 primary->Show(); | 90 primary->Show(); |
(...skipping 15 matching lines...) Expand all Loading... |
106 ScreenAsh::ConvertRectToScreen( | 106 ScreenAsh::ConvertRectToScreen( |
107 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 107 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
108 EXPECT_EQ( | 108 EXPECT_EQ( |
109 "650,50 100x100", | 109 "650,50 100x100", |
110 ScreenAsh::ConvertRectToScreen( | 110 ScreenAsh::ConvertRectToScreen( |
111 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 111 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
112 } | 112 } |
113 | 113 |
114 } // namespace test | 114 } // namespace test |
115 } // namespace ash | 115 } // namespace ash |
OLD | NEW |