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

Unified Diff: ash/wm/overview/window_selector_unittest.cc

Issue 231643002: Added labels under the windows in OverviewMode displaying their current name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits, added transparency Created 6 years, 8 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: ash/wm/overview/window_selector_unittest.cc
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index 20184aaaec72a089cfc1af40ba4b788be346eeed..d1702b032b0630359c0dd7732c936a26985f17d9 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -8,10 +8,10 @@
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/shelf_test_api.h"
#include "ash/test/shelf_view_test_api.h"
-#include "ash/test/shell_test_api.h"
#include "ash/test/test_shelf_delegate.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector.h"
@@ -35,6 +35,8 @@
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/transform.h"
+#include "ui/views/controls/label.h"
+#include "ui/views/widget/native_widget_aura.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_delegate.h"
@@ -1087,4 +1089,62 @@ TEST_F(WindowSelectorTest, HitTestingInOverview) {
}
}
+// Test that a label is created under the window on entering overview mode.
+TEST_F(WindowSelectorTest, CreateLabelUnderWindow) {
+ scoped_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 100, 100)));
+ base::string16 window_title = base::UTF8ToUTF16("My window");
+ window->set_title(window_title);
+ aura::Window* root_window = Shell::GetContainer(
flackr 2014/04/14 20:31:18 This isn't really the root window, call this overl
Nina 2014/04/15 15:15:03 Could you please elaborate a bit more on how to ca
flackr 2014/04/16 02:37:10 I simply mean call this variable overlay_container
+ window->GetRootWindow(),
+ ash::kShellWindowId_OverlayContainer);
+ Cycle(WindowSelector::FORWARD);
+ unsigned int children = root_window->children().size();
+ FireOverviewStartTimer();
flackr 2014/04/14 20:31:18 I'd prefer that tests which aren't about alt tab c
Nina 2014/04/15 15:15:03 Done.
+ // There should be two more windows, one for the close button and one for the
+ // label.
+ EXPECT_EQ(children + 2, root_window->children().size())
+ << root_window->children().size() - children
+ << " windows have been added instead of the expected 2.";
+ // The window that contains the label is always the last one in the windows
+ // vector.
flackr 2014/04/14 20:31:18 This is very specific to the implementation. I.e.
Nina 2014/04/15 15:15:03 I understand it's very dependent on the implementa
flackr 2014/04/16 02:37:10 WindowSelector has friend class WindowSelectorTest
+ aura::Window* label_window = root_window->children().back();
+ aura::WindowDelegate* delegate = label_window->delegate();
+ views::NativeWidgetAura* native_delegate =
+ static_cast<views::NativeWidgetAura*>(delegate);
+ views::Widget* widget = native_delegate->GetWidget();
+ ASSERT(widget);
+ views::Label* label = static_cast<views::Label*>(widget->GetContentsView());
+ EXPECT_EQ(label->text(), window_title);
flackr 2014/04/14 20:31:18 I'd expect that verifying the label is under the w
Nina 2014/04/15 15:15:03 True, I'll work on this.
+ StopCycling();
+}
+
+// Test that a label is created under the panel on entering overview mode.
+TEST_F(WindowSelectorTest, CreateLabelUnderPanel) {
flackr 2014/04/14 20:31:18 Same comments as above, though since the position
+ scoped_ptr<aura::Window> panel(CreatePanelWindow(gfx::Rect(0, 0, 100, 100)));
+ base::string16 panel_title = base::UTF8ToUTF16("My panel");
+ panel->set_title(panel_title);
+ aura::Window* root_window = Shell::GetContainer(
+ panel->GetRootWindow(),
+ ash::kShellWindowId_OverlayContainer);
+ Cycle(WindowSelector::FORWARD);
+ unsigned int children = root_window->children().size();
+ FireOverviewStartTimer();
+ // There should be only one additional window, since panels don't have close
+ // buttons.
+ EXPECT_EQ(children + 1, root_window->children().size())
+ << root_window->children().size() - children
+ << " windows have been added instead of the expected 1.";
+ // The window that contains the label is always the last one in the windows
+ // vector.
+ aura::Window* label_window = root_window->children().back();
+ aura::WindowDelegate* delegate = label_window->delegate();
+ views::NativeWidgetAura* native_delegate =
+ static_cast<views::NativeWidgetAura*>(delegate);
+ views::Widget* widget = native_delegate->GetWidget();
+ ASSERT(widget);
+ views::Label* label = static_cast<views::Label*>(widget->GetContentsView());
+ EXPECT_EQ(label->text(), panel_title);
+ StopCycling();
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698