OLD | NEW |
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 "ash/screen_ash.h" | 5 #include "ash/screen_ash.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
15 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 namespace test { | 18 namespace test { |
19 class ScreenAshTest : public test::AshTestBase { | |
20 public: | |
21 ScreenAshTest() {} | |
22 virtual ~ScreenAshTest() {} | |
23 | 19 |
24 virtual void SetUp() OVERRIDE { | 20 typedef test::AshTestBase ScreenAshTest; |
25 internal::DisplayController::SetExtendedDesktopEnabled(true); | |
26 AshTestBase::SetUp(); | |
27 } | |
28 | |
29 virtual void TearDown() OVERRIDE { | |
30 AshTestBase::TearDown(); | |
31 internal::DisplayController::SetExtendedDesktopEnabled(false); | |
32 } | |
33 | |
34 private: | |
35 DISALLOW_COPY_AND_ASSIGN(ScreenAshTest); | |
36 }; | |
37 | 21 |
38 #if !defined(OS_WIN) | 22 #if !defined(OS_WIN) |
39 TEST_F(ScreenAshTest, Bounds) { | 23 TEST_F(ScreenAshTest, Bounds) { |
40 UpdateDisplay("600x600,500x500"); | 24 UpdateDisplay("600x600,500x500"); |
41 | 25 |
42 views::Widget* primary = | 26 views::Widget* primary = |
43 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); | 27 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100)); |
44 primary->Show(); | 28 primary->Show(); |
45 views::Widget* secondary = | 29 views::Widget* secondary = |
46 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); | 30 views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(610, 10, 100, 100)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 ScreenAsh::ConvertRectToScreen( | 88 ScreenAsh::ConvertRectToScreen( |
105 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); | 89 primary->GetNativeView(), gfx::Rect(30, 30, 100, 100)).ToString()); |
106 EXPECT_EQ( | 90 EXPECT_EQ( |
107 "650,50 100x100", | 91 "650,50 100x100", |
108 ScreenAsh::ConvertRectToScreen( | 92 ScreenAsh::ConvertRectToScreen( |
109 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); | 93 secondary->GetNativeView(), gfx::Rect(40, 40, 100, 100)).ToString()); |
110 } | 94 } |
111 | 95 |
112 } // namespace test | 96 } // namespace test |
113 } // namespace ash | 97 } // namespace ash |
OLD | NEW |