Chromium Code Reviews| 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..8f68c897298af849f784885d14e6b16634e670d4 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) { |
|
tdanderson
2014/04/14 16:58:39
Be sure to put these new test names in the coderev
Nina
2014/04/14 17:59:17
Done.
|
| + 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); |
| + Cycle(WindowSelector::FORWARD); |
| + unsigned int children = root_window->children().size(); |
| + FireOverviewStartTimer(); |
| + // There should be two more windows, one for the close button and one for the |
| + // label. |
| + EXPECT_TRUE(children + 2 == root_window->children().size()) |
|
tdanderson
2014/04/14 16:58:39
Use EXPECT_EQ here instead of EXPECT_TRUE.
Nina
2014/04/14 17:59:17
Done.
|
| + << 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(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(); |
| + // There should be only one additional window, since panels don't have close |
| + // buttons. |
| + EXPECT_TRUE(children + 1 == root_window->children().size()) |
|
tdanderson
2014/04/14 16:58:39
EXPECT_EQ
Nina
2014/04/14 17:59:17
Done.
|
| + << 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 |