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

Unified Diff: ash/mus/screen_mus_unittest.cc

Issue 2726603003: mus+ash: Copy parts of ScreenAsh to ScreenMus. (Closed)
Patch Set: Add unit tests. Created 3 years, 10 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
« no previous file with comments | « ash/mus/screen_mus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/screen_mus_unittest.cc
diff --git a/ash/mus/screen_mus_unittest.cc b/ash/mus/screen_mus_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..aa962b06d2075d2a9ab1266176c0a5a30e7aeac8
--- /dev/null
+++ b/ash/mus/screen_mus_unittest.cc
@@ -0,0 +1,53 @@
+// Copyright 2017 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 "ash/mus/screen_mus.h"
+
+#include "ash/mus/window_manager.h"
+#include "ash/mus/window_manager_application.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/test/ash_test_helper.h"
+#include "ui/aura/test/test_window_delegate.h"
+
+namespace ash {
+namespace test {
+
+class ScreenMusTest : public AshTestBase {
+ public:
+ ScreenMusTest() {}
+ ~ScreenMusTest() override {}
+
+ display::Screen* screen_mus() {
+ return ash_test_helper()->window_manager_app()->window_manager()->screen();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScreenMusTest);
+};
+
+TEST_F(ScreenMusTest, GetWindowAtScreenPoint) {
+ UpdateDisplay("1024x600");
+
+ aura::test::TestWindowDelegate test_delegate;
+ std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate(
+ &test_delegate, 23, gfx::Rect(20, 20, 50, 50)));
+
+ aura::Window* at_point =
+ screen_mus()->GetWindowAtScreenPoint(gfx::Point(25, 25));
+ EXPECT_EQ(w1.get(), at_point);
+
+ // Create a second window which overlaps with w1.
+ std::unique_ptr<aura::Window> w2(CreateTestWindowInShellWithDelegate(
+ &test_delegate, 17, gfx::Rect(25, 25, 50, 50)));
+ at_point = screen_mus()->GetWindowAtScreenPoint(gfx::Point(25, 25));
+ EXPECT_EQ(w2.get(), at_point);
+
+ // Raise w1.
+ w1->parent()->StackChildAtTop(w1.get());
+ at_point = screen_mus()->GetWindowAtScreenPoint(gfx::Point(25, 25));
+ EXPECT_EQ(w1.get(), at_point);
+}
James Cook 2017/03/02 00:08:23 Thanks for adding test coverage.
+
+} // namespace test
+} // namespace ash
« no previous file with comments | « ash/mus/screen_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698