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

Unified Diff: athena/screen/screen_manager_unittest.cc

Issue 411543006: Explicit container priority (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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 | « athena/screen/screen_manager_impl.cc ('k') | athena/virtual_keyboard/virtual_keyboard_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/screen/screen_manager_unittest.cc
diff --git a/athena/screen/screen_manager_unittest.cc b/athena/screen/screen_manager_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1a04ae8447d52052a49077c741f68c8ac531ed23
--- /dev/null
+++ b/athena/screen/screen_manager_unittest.cc
@@ -0,0 +1,62 @@
+// Copyright 2014 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 "athena/screen/public/screen_manager.h"
+
+#include <string>
+
+#include "athena/test/athena_test_base.h"
+#include "ui/aura/window.h"
+
+typedef athena::test::AthenaTestBase ScreenManagerTest;
+
+namespace athena {
+namespace {
+
+aura::Window* Create(const std::string& name, int z_order_priority) {
+ ScreenManager::ContainerParams params(name, z_order_priority);
+ return ScreenManager::Get()->CreateContainer(params);
+}
+
+void CheckZOrder(aura::Window* w1, aura::Window* w2) {
+ aura::Window* parent = w1->parent();
+ const aura::Window::Windows& children = parent->children();
+ aura::Window::Windows::const_iterator begin_iter = children.begin();
+ aura::Window::Windows::const_iterator end_iter = children.end();
+
+ aura::Window::Windows::const_iterator w1_iter =
+ std::find(begin_iter, end_iter, w1);
+ aura::Window::Windows::const_iterator w2_iter =
+ std::find(begin_iter, end_iter, w2);
+ EXPECT_NE(end_iter, w1_iter);
+ EXPECT_NE(end_iter, w2_iter);
+ EXPECT_TRUE(w1_iter < w2_iter);
+}
+
+} // namespace
+
+TEST_F(ScreenManagerTest, Zorder) {
+ aura::Window* window_10 = Create("test10", 10);
+ aura::Window* window_11 = Create("test11", 11);
+ aura::Window* window_12 = Create("test12", 12);
+
+ {
+ SCOPED_TRACE("Init");
+ CheckZOrder(window_10, window_11);
+ CheckZOrder(window_11, window_12);
+ }
+ {
+ SCOPED_TRACE("Delete");
+ delete window_11;
+ CheckZOrder(window_10, window_12);
+ }
+ {
+ SCOPED_TRACE("Insert");
+ window_11 = Create("test11", 11);
+ CheckZOrder(window_10, window_11);
+ CheckZOrder(window_11, window_12);
+ }
+}
+
+} // namespace athena
« no previous file with comments | « athena/screen/screen_manager_impl.cc ('k') | athena/virtual_keyboard/virtual_keyboard_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698