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

Side by Side Diff: ash/dip_unittest.cc

Issue 2692663002: Gut ash::MaterialDesignController, and remove the about:flags entry. (Closed)
Patch Set: yet another rebase Created 3 years, 10 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/common/wm/overview/window_selector_item.cc ('k') | ash/display/display_manager_unittest.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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/shelf/shelf_widget.h" 8 #include "ash/common/shelf/shelf_widget.h"
10 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
11 #include "ash/shell.h" 10 #include "ash/shell.h"
12 #include "ash/test/ash_md_test_base.h" 11 #include "ash/test/ash_test_base.h"
13 #include "ash/wm/window_properties.h" 12 #include "ash/wm/window_properties.h"
14 #include "ash/wm/window_util.h" 13 #include "ash/wm/window_util.h"
15 #include "base/command_line.h" 14 #include "base/command_line.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
18 #include "ui/compositor/layer.h" 17 #include "ui/compositor/layer.h"
19 #include "ui/display/display.h" 18 #include "ui/display/display.h"
20 #include "ui/display/manager/display_manager.h" 19 #include "ui/display/manager/display_manager.h"
21 #include "ui/display/screen.h" 20 #include "ui/display/screen.h"
22 #include "ui/gfx/geometry/insets.h" 21 #include "ui/gfx/geometry/insets.h"
23 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
24 #include "ui/wm/core/shadow.h" 23 #include "ui/wm/core/shadow.h"
25 #include "ui/wm/core/shadow_controller.h" 24 #include "ui/wm/core/shadow_controller.h"
26 #include "ui/wm/core/shadow_types.h" 25 #include "ui/wm/core/shadow_types.h"
27 #include "ui/wm/public/activation_client.h" 26 #include "ui/wm/public/activation_client.h"
28 27
29 namespace ash { 28 namespace ash {
30 29
31 using DIPTest = test::AshMDTestBase; 30 using DIPTest = test::AshTestBase;
32
33 INSTANTIATE_TEST_CASE_P(
34 /* prefix intentionally left blank due to only one parameterization */,
35 DIPTest,
36 testing::Values(MaterialDesignController::NON_MATERIAL,
37 MaterialDesignController::MATERIAL_NORMAL,
38 MaterialDesignController::MATERIAL_EXPERIMENTAL));
39 31
40 // Test if the WM sets correct work area under different density. 32 // Test if the WM sets correct work area under different density.
41 TEST_P(DIPTest, WorkArea) { 33 TEST_F(DIPTest, WorkArea) {
42 const int height_offset = GetMdMaximizedWindowHeightOffset();
43 UpdateDisplay("1000x900*1.0f"); 34 UpdateDisplay("1000x900*1.0f");
44 35
45 aura::Window* root = Shell::GetPrimaryRootWindow(); 36 aura::Window* root = Shell::GetPrimaryRootWindow();
46 const display::Display display = 37 const display::Display display =
47 display::Screen::GetScreen()->GetDisplayNearestWindow(root); 38 display::Screen::GetScreen()->GetDisplayNearestWindow(root);
48 39
49 EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); 40 EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
50 gfx::Rect work_area = display.work_area(); 41 gfx::Rect work_area = display.work_area();
51 EXPECT_EQ(gfx::Rect(0, 0, 1000, 853 + height_offset).ToString(), 42 EXPECT_EQ(gfx::Rect(0, 0, 1000, 852).ToString(), work_area.ToString());
52 work_area.ToString()); 43 EXPECT_EQ(gfx::Insets(0, 0, 48, 0).ToString(),
53 EXPECT_EQ(gfx::Insets(0, 0, 47 - height_offset, 0).ToString(),
54 display.bounds().InsetsFrom(work_area).ToString()); 44 display.bounds().InsetsFrom(work_area).ToString());
55 45
56 UpdateDisplay("2000x1800*2.0f"); 46 UpdateDisplay("2000x1800*2.0f");
57 display::Screen* screen = display::Screen::GetScreen(); 47 display::Screen* screen = display::Screen::GetScreen();
58 48
59 const display::Display display_2x = screen->GetDisplayNearestWindow(root); 49 const display::Display display_2x = screen->GetDisplayNearestWindow(root);
60 const display::ManagedDisplayInfo display_info_2x = 50 const display::ManagedDisplayInfo display_info_2x =
61 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id()); 51 Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id());
62 52
63 // The |bounds_in_pixel()| should report bounds in pixel coordinate. 53 // The |bounds_in_pixel()| should report bounds in pixel coordinate.
64 EXPECT_EQ("1,1 2000x1800", display_info_2x.bounds_in_native().ToString()); 54 EXPECT_EQ("1,1 2000x1800", display_info_2x.bounds_in_native().ToString());
65 55
66 // 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.
67 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString()); 57 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString());
68 work_area = display_2x.work_area(); 58 work_area = display_2x.work_area();
69 EXPECT_EQ(gfx::Rect(0, 0, 1000, 853 + height_offset).ToString(), 59 EXPECT_EQ(gfx::Rect(0, 0, 1000, 852).ToString(), work_area.ToString());
70 work_area.ToString()); 60 EXPECT_EQ(gfx::Insets(0, 0, 48, 0).ToString(),
71 EXPECT_EQ(gfx::Insets(0, 0, 47 - height_offset, 0).ToString(),
72 display_2x.bounds().InsetsFrom(work_area).ToString()); 61 display_2x.bounds().InsetsFrom(work_area).ToString());
73 62
74 // Sanity check if the workarea's inset hight is same as 63 // Sanity check if the workarea's inset hight is same as
75 // the shelf's height. 64 // the shelf's height.
76 WmShelf* shelf = GetPrimaryShelf(); 65 WmShelf* shelf = GetPrimaryShelf();
77 EXPECT_EQ(display_2x.bounds().InsetsFrom(work_area).height(), 66 EXPECT_EQ(display_2x.bounds().InsetsFrom(work_area).height(),
78 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height()); 67 shelf->shelf_widget()->GetNativeView()->layer()->bounds().height());
79 } 68 }
80 69
81 } // namespace ash 70 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector_item.cc ('k') | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698