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..6ea1c135980d80fd5da0c70a740e79a9866fbeb7 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" |
flackr
2014/04/16 17:24:55
You're getting the compile error because you remov
|
-#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,61 @@ 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( |
+ window->GetRootWindow(), |
+ ash::kShellWindowId_OverlayContainer); |
+ unsigned int children = root_window->children().size(); |
+ ToggleOverview(); |
+ // 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. |
+ 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_TRUE(widget); |
+ views::Label* label = static_cast<views::Label*>(widget->GetContentsView()); |
+ EXPECT_EQ(label->text(), window_title); |
+ StopCycling(); |
+} |
+ |
+// Test that a label is created under the panel on entering overview mode. |
+TEST_F(WindowSelectorTest, CreateLabelUnderPanel) { |
+ 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(); |
flackr
2014/04/16 02:37:10
Same as above, please use ToggleOverview.
|
+ // 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_TRUE(widget); |
+ views::Label* label = static_cast<views::Label*>(widget->GetContentsView()); |
+ EXPECT_EQ(label->text(), panel_title); |
+ StopCycling(); |
+} |
+ |
} // namespace ash |