Move pending tile priorities to active on tree activation
[chromium-blink-merge.git] / ash / dip_unittest.cc
blob1df1ec72bd9c67c78d591c690c23fb513368289f
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
3 // found in the LICENSE file.
5 #include <algorithm>
6 #include <vector>
8 #include "ash/launcher/launcher.h"
9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h"
11 #include "ash/wm/window_properties.h"
12 #include "ash/wm/window_util.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/client/activation_client.h"
15 #include "ui/aura/root_window.h"
16 #include "ui/aura/window.h"
17 #include "ui/compositor/layer.h"
18 #include "ui/gfx/display.h"
19 #include "ui/gfx/insets.h"
20 #include "ui/gfx/screen.h"
21 #include "ui/views/corewm/shadow.h"
22 #include "ui/views/corewm/shadow_controller.h"
23 #include "ui/views/corewm/shadow_types.h"
24 #include "ui/views/widget/widget.h"
26 namespace ash {
28 typedef ash::test::AshTestBase DIPTest;
30 // Test if the WM sets correct work area under different density.
31 TEST_F(DIPTest, WorkArea) {
32 ChangeDisplayConfig(1.0f, gfx::Rect(0, 0, 1000, 900));
34 aura::RootWindow* root = Shell::GetPrimaryRootWindow();
35 const gfx::Display display =
36 Shell::GetScreen()->GetDisplayNearestWindow(root);
38 EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
39 gfx::Rect work_area = display.work_area();
40 EXPECT_EQ("0,0 1000x852", work_area.ToString());
41 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString());
43 ChangeDisplayConfig(2.0f, gfx::Rect(0, 0, 2000, 1800));
45 const gfx::Display display_2x =
46 Shell::GetScreen()->GetDisplayNearestWindow(root);
48 // The |bounds_in_pixel()| should report bounds in pixel coordinate.
49 EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString());
51 // Aura and views coordinates are in DIP, so they their bounds do not change.
52 EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString());
53 work_area = display_2x.work_area();
54 EXPECT_EQ("0,0 1000x852", work_area.ToString());
55 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString());
57 // Sanity check if the workarea's inset hight is same as
58 // the launcher's height.
59 Launcher* launcher = Launcher::ForPrimaryDisplay();
60 EXPECT_EQ(
61 display_2x.bounds().InsetsFrom(work_area).height(),
62 launcher->widget()->GetNativeView()->layer()->bounds().height());
65 } // namespace ash