Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1402)

Unified Diff: ui/gfx/screen_unittest.cc

Issue 8382019: Move DisplayUtils methods into gfx::Screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove DCHECKS Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/screen_unittest.cc
diff --git a/ui/gfx/screen_unittest.cc b/ui/gfx/screen_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4b1a572ed5addc8f745b4fdc085f3b9d6275c874
--- /dev/null
+++ b/ui/gfx/screen_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/screen.h"
+
+#if defined(USE_AURA)
+#include "base/message_loop.h"
+#include "ui/aura/desktop.h"
+#endif
+
+namespace {
+
+#if defined(USE_AURA)
+class ScreenTest : public testing::Test {
+ public:
+ ScreenTest() {
+ aura::Desktop::GetInstance()->ShowDesktop();
+ }
+
+ virtual ~ScreenTest() {
+ aura::Desktop::GetInstance()->DeleteInstanceForTesting();
+ }
+
+ private:
+ MessageLoopForUI message_loop_;
+};
+#else
+typedef testing::Test ScreenTest;
+#endif
+
+TEST_F(ScreenTest, GetPrimaryMonitorSize) {
+ // We aren't actually testing that it's correct, just that it's sane.
+ const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize();
+ EXPECT_GE(size.width(), 1);
+ EXPECT_GE(size.height(), 1);
+}
+
+TEST_F(ScreenTest, GetNumMonitors) {
+ // We aren't actually testing that it's correct, just that it's sane.
+ EXPECT_GE(gfx::Screen::GetNumMonitors(), 1);
+}
+
+} // namespace
« no previous file with comments | « ui/gfx/screen_mac.mm ('k') | ui/gfx/screen_win.cc » ('j') | ui/ui_unittests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698