| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "ui/gfx/screen.h" | 6 #include "ui/gfx/screen.h" |
| 7 | 7 |
| 8 #if defined(USE_AURA) | |
| 9 #include "base/message_loop.h" | |
| 10 #include "ui/aura/desktop.h" | |
| 11 #endif | |
| 12 | |
| 13 namespace { | 8 namespace { |
| 14 | 9 |
| 15 #if defined(USE_AURA) | |
| 16 class ScreenTest : public testing::Test { | |
| 17 public: | |
| 18 ScreenTest() { | |
| 19 aura::Desktop::GetInstance()->ShowDesktop(); | |
| 20 } | |
| 21 | |
| 22 virtual ~ScreenTest() { | |
| 23 aura::Desktop::GetInstance()->DeleteInstanceForTesting(); | |
| 24 } | |
| 25 | |
| 26 private: | |
| 27 MessageLoopForUI message_loop_; | |
| 28 }; | |
| 29 #else | |
| 30 typedef testing::Test ScreenTest; | 10 typedef testing::Test ScreenTest; |
| 31 #endif | |
| 32 | 11 |
| 33 TEST_F(ScreenTest, GetPrimaryMonitorSize) { | 12 TEST_F(ScreenTest, GetPrimaryMonitorSize) { |
| 34 // We aren't actually testing that it's correct, just that it's sane. | 13 // We aren't actually testing that it's correct, just that it's sane. |
| 35 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 14 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 36 EXPECT_GE(size.width(), 1); | 15 EXPECT_GE(size.width(), 1); |
| 37 EXPECT_GE(size.height(), 1); | 16 EXPECT_GE(size.height(), 1); |
| 38 } | 17 } |
| 39 | 18 |
| 40 TEST_F(ScreenTest, GetNumMonitors) { | 19 TEST_F(ScreenTest, GetNumMonitors) { |
| 41 // We aren't actually testing that it's correct, just that it's sane. | 20 // We aren't actually testing that it's correct, just that it's sane. |
| 42 EXPECT_GE(gfx::Screen::GetNumMonitors(), 1); | 21 EXPECT_GE(gfx::Screen::GetNumMonitors(), 1); |
| 43 } | 22 } |
| 44 | 23 |
| 45 } // namespace | 24 } // namespace |
| OLD | NEW |