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 cd25675f9a8fa53875c315de12bcadc79fff06b8..a18e8f9db025e89fd4df1ce54b8a3932a5366db5 100644 |
--- a/ash/wm/overview/window_selector_unittest.cc |
+++ b/ash/wm/overview/window_selector_unittest.cc |
@@ -46,7 +46,7 @@ |
#include "ui/gfx/geometry/rect_conversions.h" |
#include "ui/gfx/transform.h" |
#include "ui/gfx/transform_util.h" |
-#include "ui/views/controls/label.h" |
+#include "ui/views/controls/button/label_button.h" |
#include "ui/views/widget/native_widget_aura.h" |
#include "ui/views/widget/widget_delegate.h" |
#include "ui/wm/core/window_util.h" |
@@ -115,7 +115,9 @@ class WindowSelectorTest : public test::AshTestBase { |
aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { |
aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
- nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
+ |
+ |
+ &delegate_, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
test::TestShelfDelegate::instance()->AddShelfItem(window); |
shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
return window; |
@@ -228,8 +230,8 @@ class WindowSelectorTest : public test::AshTestBase { |
return &(window->close_button_widget_); |
} |
- views::Label* GetLabelView(ash::WindowSelectorItem* window) { |
- return window->window_label_view_; |
+ views::LabelButton* GetLabelButtonView(ash::WindowSelectorItem* window) { |
+ return window->window_label_button_view_; |
} |
// Tests that a window is contained within a given WindowSelectorItem, and |
@@ -375,9 +377,9 @@ TEST_F(WindowSelectorTest, ClickOnWindowDuringTouch) { |
gfx::Rect bounds(0, 0, 400, 400); |
scoped_ptr<aura::Window> window1(CreateWindow(bounds)); |
scoped_ptr<aura::Window> window2(CreateWindow(bounds)); |
- wm::ActivateWindow(window2.get()); |
- EXPECT_FALSE(wm::IsActiveWindow(window1.get())); |
- EXPECT_TRUE(wm::IsActiveWindow(window2.get())); |
+ wm::ActivateWindow(window1.get()); |
+ EXPECT_TRUE(wm::IsActiveWindow(window1.get())); |
+ EXPECT_FALSE(wm::IsActiveWindow(window2.get())); |
ToggleOverview(); |
@@ -387,15 +389,17 @@ TEST_F(WindowSelectorTest, ClickOnWindowDuringTouch) { |
window1_bounds.CenterPoint()); |
// Clicking on |window2| while touching on |window1| should not cause a |
- // crash, and overview mode should remain engaged because |window1| |
- // has capture. |
+ // crash, overview mode should be disengaged and |window2| should be active. |
const int kTouchId = 19; |
event_generator.PressTouchId(kTouchId); |
event_generator.MoveMouseToCenterOf(window2.get()); |
event_generator.ClickLeftButton(); |
- EXPECT_TRUE(IsSelecting()); |
+ EXPECT_FALSE(IsSelecting()); |
+ EXPECT_TRUE(wm::IsActiveWindow(window2.get())); |
event_generator.ReleaseTouchId(kTouchId); |
+ ToggleOverview(); |
+ |
// Clicking on |window1| while touching on |window1| should not cause |
// a crash, overview mode should be disengaged, and |window1| should |
// be active. |
@@ -930,17 +934,17 @@ TEST_F(WindowSelectorTest, CreateLabelUnderWindow) { |
window->SetTitle(window_title); |
ToggleOverview(); |
WindowSelectorItem* window_item = GetWindowItemsForRoot(0).back(); |
- views::Label* label = GetLabelView(window_item); |
+ views::LabelButton* label = GetLabelButtonView(window_item); |
// Has the label view been created? |
ASSERT_TRUE(label); |
// Verify the label matches the window title. |
- EXPECT_EQ(label->text(), window_title); |
+ EXPECT_EQ(label->GetText(), window_title); |
// Update the window title and check that the label is updated, too. |
base::string16 updated_title = base::UTF8ToUTF16("Updated title"); |
window->SetTitle(updated_title); |
- EXPECT_EQ(label->text(), updated_title); |
+ EXPECT_EQ(label->GetText(), updated_title); |
// Labels are located based on target_bounds, not the actual window item |
// bounds. |
@@ -968,22 +972,22 @@ TEST_F(WindowSelectorTest, CreateLabelUnderPanel) { |
wm::ActivateWindow(panel1.get()); |
ToggleOverview(); |
WindowSelectorItem* window_item = GetWindowItemsForRoot(0).back(); |
- views::Label* label = GetLabelView(window_item); |
+ views::LabelButton* label = GetLabelButtonView(window_item); |
// Has the label view been created? |
ASSERT_TRUE(label); |
// Verify the label matches the active window title. |
- EXPECT_EQ(label->text(), panel1_title); |
+ EXPECT_EQ(label->GetText(), panel1_title); |
// Verify that updating the title also updates the label. |
panel1->SetTitle(updated_panel1_title); |
- EXPECT_EQ(label->text(), updated_panel1_title); |
+ EXPECT_EQ(label->GetText(), updated_panel1_title); |
// After destroying the first panel, the label should match the second panel. |
panel1.reset(); |
- label = GetLabelView(window_item); |
- EXPECT_EQ(label->text(), panel2_title); |
+ label = GetLabelButtonView(window_item); |
+ EXPECT_EQ(label->GetText(), panel2_title); |
// Also test updating the title on the second panel. |
panel2->SetTitle(updated_panel2_title); |
- EXPECT_EQ(label->text(), updated_panel2_title); |
+ EXPECT_EQ(label->GetText(), updated_panel2_title); |
} |
// Tests that overview updates the window positions if the display orientation |
@@ -1197,8 +1201,8 @@ TEST_F(WindowSelectorTest, CloseButtonOnPanels) { |
EXPECT_TRUE(GetCloseButton(window_item)->IsVisible()); |
- views::Label* label = GetLabelView(window_item); |
- EXPECT_EQ(label->text(), panel2_title); |
+ views::LabelButton* label = GetLabelButtonView(window_item); |
+ EXPECT_EQ(label->GetText(), panel2_title); |
gfx::RectF bounds2 = GetTransformedBoundsInRootWindow(window2); |
gfx::Point point2(bounds2.top_right().x() - 1, bounds2.top_right().y() - 1); |
@@ -1349,59 +1353,12 @@ TEST_F(WindowSelectorTest, CancelOverviewOnTap) { |
EXPECT_FALSE(IsSelecting()); |
} |
-// Tests that the transparent overlays z-order matches the windows z-order. |
Nina
2015/01/09 15:43:48
This test is no longer needed as we are actually t
|
-TEST_F(WindowSelectorTest, PanelStackOrdering) { |
- gfx::Rect bounds1(0, 0, 100, 100); |
- gfx::Rect bounds2(10, 0, 100, 100); |
- gfx::Rect bounds3(20, 0, 100, 100); |
- scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds1)); |
- scoped_ptr<aura::Window> panel2(CreatePanelWindow(bounds2)); |
- scoped_ptr<aura::Window> panel3(CreatePanelWindow(bounds3)); |
- |
- wm::ActivateWindow(panel2.get()); |
- wm::ActivateWindow(panel3.get()); |
- wm::ActivateWindow(panel1.get()); |
- |
- WindowIndexMap z_order; |
- GetWindowIndexMap(panel1->parent()->children(), &z_order); |
- ASSERT_GT(z_order[panel1.get()], z_order[panel2.get()]); |
- ASSERT_GT(z_order[panel2.get()], z_order[panel3.get()]); |
- |
- WindowList mru_windows = ash::Shell::GetInstance()->mru_window_tracker()-> |
- BuildMruWindowList(); |
- WindowIndexMap mru_rank; |
- GetWindowIndexMap(mru_windows, &mru_rank); |
- ASSERT_LT(mru_rank[panel1.get()], mru_rank[panel3.get()]); |
- ASSERT_LT(mru_rank[panel3.get()], mru_rank[panel2.get()]); |
- |
- ToggleOverview(); |
- |
- gfx::Rect panel1_transformed_bounds( |
- gfx::ToEnclosingRect(GetTransformedTargetBounds(panel1.get()))); |
- gfx::Rect panel2_transformed_bounds( |
- gfx::ToEnclosingRect(GetTransformedTargetBounds(panel2.get()))); |
- gfx::Rect panel3_transformed_bounds( |
- gfx::ToEnclosingRect(GetTransformedTargetBounds(panel3.get()))); |
- |
- gfx::Rect target_rect(panel2_transformed_bounds); |
- target_rect.Intersect(panel3_transformed_bounds); |
- target_rect.Subtract(panel1_transformed_bounds); |
- gfx::Point tap_target(target_rect.CenterPoint()); |
- |
- ASSERT_TRUE(panel3_transformed_bounds.Contains(tap_target)); |
- |
- ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
- generator.GestureTapAt(tap_target); |
- EXPECT_EQ(panel2.get(), GetFocusedWindow()); |
-} |
- |
// Tests that individual panels can be selected on a secondary display. |
TEST_F(WindowSelectorTest, PanelSelectionOnSecondaryDisplay) { |
if (!SupportsMultipleDisplays()) |
return; |
UpdateDisplay("600x400,600x400"); |
- aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
gfx::Rect bounds1(700, 0, 100, 100); |
gfx::Rect bounds2(710, 0, 100, 100); |
@@ -1425,7 +1382,7 @@ TEST_F(WindowSelectorTest, PanelSelectionOnSecondaryDisplay) { |
gfx::Point tap_target(panel2_transformed_bounds.right() - 2, |
panel2_transformed_bounds.bottom() - 2); |
- ui::test::EventGenerator generator(root_windows[1]); |
+ ui::test::EventGenerator generator(panel2->GetRootWindow()); |
generator.GestureTapAt(tap_target); |
EXPECT_EQ(panel2.get(), GetFocusedWindow()); |
} |