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

Side by Side Diff: ash/dip_unittest.cc

Issue 10675011: Rename the remaining usage of Monitor to Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ash/ash.gyp ('k') | ash/display/display_controller.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 (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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/gfx/display.h" 21 #include "ui/gfx/display.h"
22 #include "ui/gfx/insets.h" 22 #include "ui/gfx/insets.h"
23 #include "ui/gfx/screen.h" 23 #include "ui/gfx/screen.h"
24 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
25 25
26 namespace ash { 26 namespace ash {
27 27
28 typedef ash::test::AshTestBase DIPTest; 28 typedef ash::test::AshTestBase DIPTest;
29 29
30 #if defined(OS_WIN) 30 #if defined(OS_WIN)
31 // Windows/Aura doesn't have DIP support in monitor yet. 31 // Windows/Aura doesn't have DIP support in display yet.
32 #define MAYBE_WorkArea DISABLED_WorkArea 32 #define MAYBE_WorkArea DISABLED_WorkArea
33 #else 33 #else
34 #define MAYBE_WorkArea WorkArea 34 #define MAYBE_WorkArea WorkArea
35 #endif 35 #endif
36 36
37 // Test if the WM sets correct work area under different density. 37 // Test if the WM sets correct work area under different density.
38 TEST_F(DIPTest, MAYBE_WorkArea) { 38 TEST_F(DIPTest, MAYBE_WorkArea) {
39 ChangeMonitorConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); 39 ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900));
40 40
41 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 41 aura::RootWindow* root = Shell::GetPrimaryRootWindow();
42 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(root); 42 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(root);
43 43
44 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); 44 EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
45 gfx::Rect work_area = display.work_area(); 45 gfx::Rect work_area = display.work_area();
46 EXPECT_EQ("0,0 1000x852", work_area.ToString()); 46 EXPECT_EQ("0,0 1000x852", work_area.ToString());
47 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString()); 47 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString());
48 48
49 ChangeMonitorConfig(2.0f, gfx::Rect(0, 0, 2000, 1800)); 49 ChangeDisplayConfig(2.0f, gfx::Rect(0, 0, 2000, 1800));
50 50
51 const gfx::Display display_2x = gfx::Screen::GetDisplayNearestWindow(root); 51 const gfx::Display display_2x = gfx::Screen::GetDisplayNearestWindow(root);
52 52
53 // The |bounds_in_pixel()| should report bounds in pixel coordinate. 53 // The |bounds_in_pixel()| should report bounds in pixel coordinate.
54 EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString()); 54 EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString());
55 55
56 // Aura and views coordinates are in DIP, so they their bounds do not change. 56 // Aura and views coordinates are in DIP, so they their bounds do not change.
57 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); 57 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString());
58 work_area = display_2x.work_area(); 58 work_area = display_2x.work_area();
59 EXPECT_EQ("0,0 1000x852", work_area.ToString()); 59 EXPECT_EQ("0,0 1000x852", work_area.ToString());
60 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString()); 60 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString());
61 61
62 // Sanity check if the workarea's inset hight is same as 62 // Sanity check if the workarea's inset hight is same as
63 // the launcher's height. 63 // the launcher's height.
64 Launcher* launcher = Shell::GetInstance()->launcher(); 64 Launcher* launcher = Shell::GetInstance()->launcher();
65 EXPECT_EQ( 65 EXPECT_EQ(
66 display_2x.bounds().InsetsFrom(work_area).height(), 66 display_2x.bounds().InsetsFrom(work_area).height(),
67 launcher->widget()->GetNativeView()->layer()->bounds().height()); 67 launcher->widget()->GetNativeView()->layer()->bounds().height());
68 } 68 }
69 69
70 } // namespace ash 70 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/display/display_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698