| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "chrome/browser/metrics/display_utils.h" | 6 #include "chrome/browser/metrics/display_utils.h" |
| 7 #include "content/browser/browser_thread.h" | 7 #include "content/browser/browser_thread.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 TEST(DisplayUtilsTest, GetPrimaryDisplayDimensions) { | 10 // Crashes on Linux Aura, probably because we need to initialize a Screen |
| 11 // object. See http://crbug.com/100341 |
| 12 #if defined(USE_AURA) && !defined(OS_WIN) |
| 13 #define MAYBE_GetPrimaryDisplayDimensions DISABLED_GetPrimaryDisplayDimensions |
| 14 #else |
| 15 #define MAYBE_GetPrimaryDisplayDimensions GetPrimaryDisplayDimensions |
| 16 #endif |
| 17 TEST(DisplayUtilsTest, MAYBE_GetPrimaryDisplayDimensions) { |
| 11 MessageLoop message_loop; | 18 MessageLoop message_loop; |
| 12 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 19 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
| 13 int width = 0, height = 0; | 20 int width = 0, height = 0; |
| 14 // We aren't actually testing that it's correct, just that it's sane. | 21 // We aren't actually testing that it's correct, just that it's sane. |
| 15 DisplayUtils::GetPrimaryDisplayDimensions(&width, &height); | 22 DisplayUtils::GetPrimaryDisplayDimensions(&width, &height); |
| 16 EXPECT_GE(width, 10); | 23 EXPECT_GE(width, 10); |
| 17 EXPECT_GE(height, 10); | 24 EXPECT_GE(height, 10); |
| 18 } | 25 } |
| 19 | 26 |
| 20 TEST(DisplayUtilsTest, GetDisplayCount) { | 27 TEST(DisplayUtilsTest, GetDisplayCount) { |
| 21 MessageLoop message_loop; | 28 MessageLoop message_loop; |
| 22 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 29 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
| 23 // We aren't actually testing that it's correct, just that it's sane. | 30 // We aren't actually testing that it's correct, just that it's sane. |
| 24 EXPECT_GE(DisplayUtils::GetDisplayCount(), 1); | 31 EXPECT_GE(DisplayUtils::GetDisplayCount(), 1); |
| 25 } | 32 } |
| OLD | NEW |