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

Side by Side Diff: ash/dip_unittest.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
11 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
14 #include "ash/wm/window_properties.h" 14 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/aura/window_event_dispatcher.h" 18 #include "ui/aura/window_event_dispatcher.h"
19 #include "ui/compositor/layer.h" 19 #include "ui/compositor/layer.h"
20 #include "ui/gfx/display.h" 20 #include "ui/display/display.h"
21 #include "ui/display/screen.h"
21 #include "ui/gfx/geometry/insets.h" 22 #include "ui/gfx/geometry/insets.h"
22 #include "ui/gfx/screen.h"
23 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
24 #include "ui/wm/core/shadow.h" 24 #include "ui/wm/core/shadow.h"
25 #include "ui/wm/core/shadow_controller.h" 25 #include "ui/wm/core/shadow_controller.h"
26 #include "ui/wm/core/shadow_types.h" 26 #include "ui/wm/core/shadow_types.h"
27 #include "ui/wm/public/activation_client.h" 27 #include "ui/wm/public/activation_client.h"
28 28
29 namespace ash { 29 namespace ash {
30 30
31 typedef ash::test::AshTestBase DIPTest; 31 typedef ash::test::AshTestBase DIPTest;
32 32
33 // Test if the WM sets correct work area under different density. 33 // Test if the WM sets correct work area under different density.
34 #if defined(OS_WIN) && !defined(USE_ASH) 34 #if defined(OS_WIN) && !defined(USE_ASH)
35 // TODO(msw): Broken on Windows. http://crbug.com/584038 35 // TODO(msw): Broken on Windows. http://crbug.com/584038
36 #define MAYBE_WorkArea DISABLED_WorkArea 36 #define MAYBE_WorkArea DISABLED_WorkArea
37 #else 37 #else
38 #define MAYBE_WorkArea WorkArea 38 #define MAYBE_WorkArea WorkArea
39 #endif 39 #endif
40 TEST_F(DIPTest, MAYBE_WorkArea) { 40 TEST_F(DIPTest, MAYBE_WorkArea) {
41 UpdateDisplay("1000x900*1.0f"); 41 UpdateDisplay("1000x900*1.0f");
42 42
43 aura::Window* root = Shell::GetPrimaryRootWindow(); 43 aura::Window* root = Shell::GetPrimaryRootWindow();
44 const gfx::Display display = 44 const display::Display display =
45 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root); 45 display::Screen::GetScreen()->GetDisplayNearestWindow(root);
46 46
47 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); 47 EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
48 gfx::Rect work_area = display.work_area(); 48 gfx::Rect work_area = display.work_area();
49 EXPECT_EQ("0,0 1000x853", work_area.ToString()); 49 EXPECT_EQ("0,0 1000x853", work_area.ToString());
50 EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString()); 50 EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString());
51 51
52 UpdateDisplay("2000x1800*2.0f"); 52 UpdateDisplay("2000x1800*2.0f");
53 gfx::Screen* screen = gfx::Screen::GetScreen(); 53 display::Screen* screen = display::Screen::GetScreen();
54 54
55 const gfx::Display display_2x = screen->GetDisplayNearestWindow(root); 55 const display::Display display_2x = screen->GetDisplayNearestWindow(root);
56 const DisplayInfo display_info_2x = 56 const DisplayInfo display_info_2x =
57 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); 57 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id());
58 58
59 // The |bounds_in_pixel()| should report bounds in pixel coordinate. 59 // The |bounds_in_pixel()| should report bounds in pixel coordinate.
60 EXPECT_EQ("1,1 2000x1800", 60 EXPECT_EQ("1,1 2000x1800",
61 display_info_2x.bounds_in_native().ToString()); 61 display_info_2x.bounds_in_native().ToString());
62 62
63 // Aura and views coordinates are in DIP, so they their bounds do not change. 63 // Aura and views coordinates are in DIP, so they their bounds do not change.
64 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); 64 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString());
65 work_area = display_2x.work_area(); 65 work_area = display_2x.work_area();
66 EXPECT_EQ("0,0 1000x853", work_area.ToString()); 66 EXPECT_EQ("0,0 1000x853", work_area.ToString());
67 EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString()); 67 EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString());
68 68
69 // Sanity check if the workarea's inset hight is same as 69 // Sanity check if the workarea's inset hight is same as
70 // the shelf's height. 70 // the shelf's height.
71 Shelf* shelf = Shelf::ForPrimaryDisplay(); 71 Shelf* shelf = Shelf::ForPrimaryDisplay();
72 EXPECT_EQ( 72 EXPECT_EQ(
73 display_2x.bounds().InsetsFrom(work_area).height(), 73 display_2x.bounds().InsetsFrom(work_area).height(),
74 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); 74 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height());
75 } 75 }
76 76
77 } // namespace ash 77 } // namespace ash
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_view.cc ('k') | ash/display/cursor_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698