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

Unified Diff: ui/views/mus/desktop_window_tree_host_mus_unittest.cc

Issue 2575243002: Changes DesktopNativeWidgetAura to not call InitHost or window->Show() (Closed)
Patch Set: Created 4 years 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/views/mus/desktop_window_tree_host_mus_unittest.cc
diff --git a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..23c0aa0d044dbdf3e5abab8e75d8bbeae6e5ce1a
--- /dev/null
+++ b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
@@ -0,0 +1,52 @@
+// Copyright 2016 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 "ui/views/mus/desktop_window_tree_host_mus.h"
+
+#include "base/memory/ptr_util.h"
+#include "ui/aura/window.h"
+#include "ui/views/test/views_test_base.h"
+#include "ui/views/widget/widget.h"
+#include "ui/views/widget/widget_delegate.h"
+
+namespace views {
+
+class DesktopWindowTreeHostMusTest : public ViewsTestBase {
+ public:
+ DesktopWindowTreeHostMusTest() {}
+ ~DesktopWindowTreeHostMusTest() override {}
+
+ // Creates a test widget. Takes ownership of |delegate|.
+ std::unique_ptr<Widget> CreateWidget(WidgetDelegate* delegate) {
+ std::unique_ptr<Widget> widget = base::MakeUnique<Widget>();
+ Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
+ params.delegate = delegate;
+ params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.bounds = gfx::Rect(0, 1, 111, 123);
+ widget->Init(params);
+ return widget;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostMusTest);
+};
+
+TEST_F(DesktopWindowTreeHostMusTest, Visibility) {
+ std::unique_ptr<Widget> widget(CreateWidget(nullptr));
+ EXPECT_FALSE(widget->IsVisible());
+ EXPECT_FALSE(widget->GetNativeView()->IsVisible());
+ // It's important the parent is also hidden as this value is sent to the
+ // server.
+ EXPECT_FALSE(widget->GetNativeView()->parent()->IsVisible());
+ widget->Show();
+ EXPECT_TRUE(widget->IsVisible());
+ EXPECT_TRUE(widget->GetNativeView()->IsVisible());
+ EXPECT_TRUE(widget->GetNativeView()->parent()->IsVisible());
+ widget->Hide();
+ EXPECT_FALSE(widget->IsVisible());
+ EXPECT_FALSE(widget->GetNativeView()->IsVisible());
+ EXPECT_FALSE(widget->GetNativeView()->parent()->IsVisible());
+}
+
+} // namespace views
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698