Removes unused thumbnail and favicon fields from PageUsageData.
[chromium-blink-merge.git] / ash / dip_unittest.cc
bloba6ebe1442709930078f6ffe57c8fe1fd087c9919
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/shadow.h"
12 #include "ash/wm/shadow_controller.h"
13 #include "ash/wm/shadow_types.h"
14 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "ui/aura/client/activation_client.h"
18 #include "ui/aura/root_window.h"
19 #include "ui/aura/window.h"
20 #include "ui/compositor/layer.h"
21 #include "ui/gfx/display.h"
22 #include "ui/gfx/insets.h"
23 #include "ui/gfx/screen.h"
24 #include "ui/views/widget/widget.h"
26 namespace ash {
28 typedef ash::test::AshTestBase DIPTest;
30 #if defined(OS_WIN)
31 // Windows/Aura doesn't have DIP support in monitor yet.
32 #define MAYBE_WorkArea DISABLED_WorkArea
33 #else
34 #define MAYBE_WorkArea WorkArea
35 #endif
37 // Test if the WM sets correct work area under different density.
38 TEST_F(DIPTest, MAYBE_WorkArea) {
39 ChangeMonitorConfig(1.0f, gfx::Rect(0, 0, 1000, 900));
41 aura::RootWindow* root = Shell::GetPrimaryRootWindow();
42 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(root);
44 EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
45 gfx::Rect work_area = display.work_area();
46 EXPECT_EQ("0,0 1000x852", work_area.ToString());
47 EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString());
49 ChangeMonitorConfig(2.0f, gfx::Rect(0, 0, 2000, 1800));
51 const gfx::Display display_2x = gfx::Screen::GetDisplayNearestWindow(root);
53 // The |bounds_in_pixel()| should report bounds in pixel coordinate.
54 EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString());
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());
58 work_area = display_2x.work_area();
59 EXPECT_EQ("0,0 1000x852", work_area.ToString());
60 EXPECT_EQ("0,0,48,0", display_2x.bounds().InsetsFrom(work_area).ToString());
62 // Sanity check if the workarea's inset hight is same as
63 // the launcher's height.
64 Launcher* launcher = Shell::GetInstance()->launcher();
65 EXPECT_EQ(
66 display_2x.bounds().InsetsFrom(work_area).height(),
67 launcher->widget()->GetNativeView()->layer()->bounds().height());
70 } // namespace ash