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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/drag_drop/drag_drop_controller.h" 5 #include "ash/drag_drop/drag_drop_controller.h"
6 #include "ash/root_window_controller.h" 6 #include "ash/root_window_controller.h"
7 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
8 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_widget.h" 9 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
12 #include "ash/test/shelf_test_api.h" 13 #include "ash/test/shelf_test_api.h"
13 #include "ash/test/shelf_view_test_api.h" 14 #include "ash/test/shelf_view_test_api.h"
14 #include "ash/test/shell_test_api.h"
15 #include "ash/test/test_shelf_delegate.h" 15 #include "ash/test/test_shelf_delegate.h"
16 #include "ash/wm/mru_window_tracker.h" 16 #include "ash/wm/mru_window_tracker.h"
17 #include "ash/wm/overview/window_selector.h" 17 #include "ash/wm/overview/window_selector.h"
18 #include "ash/wm/overview/window_selector_controller.h" 18 #include "ash/wm/overview/window_selector_controller.h"
19 #include "ash/wm/window_state.h" 19 #include "ash/wm/window_state.h"
20 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
21 #include "ash/wm/wm_event.h" 21 #include "ash/wm/wm_event.h"
22 #include "base/basictypes.h" 22 #include "base/basictypes.h"
23 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
24 #include "base/memory/scoped_vector.h" 24 #include "base/memory/scoped_vector.h"
25 #include "base/run_loop.h" 25 #include "base/run_loop.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "ui/aura/client/aura_constants.h" 27 #include "ui/aura/client/aura_constants.h"
28 #include "ui/aura/client/cursor_client.h" 28 #include "ui/aura/client/cursor_client.h"
29 #include "ui/aura/client/focus_client.h" 29 #include "ui/aura/client/focus_client.h"
30 #include "ui/aura/test/event_generator.h" 30 #include "ui/aura/test/event_generator.h"
31 #include "ui/aura/test/test_window_delegate.h" 31 #include "ui/aura/test/test_window_delegate.h"
32 #include "ui/aura/test/test_windows.h" 32 #include "ui/aura/test/test_windows.h"
33 #include "ui/aura/window.h" 33 #include "ui/aura/window.h"
34 #include "ui/aura/window_event_dispatcher.h" 34 #include "ui/aura/window_event_dispatcher.h"
35 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 35 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
36 #include "ui/gfx/rect_conversions.h" 36 #include "ui/gfx/rect_conversions.h"
37 #include "ui/gfx/transform.h" 37 #include "ui/gfx/transform.h"
38 #include "ui/views/controls/label.h"
39 #include "ui/views/widget/native_widget_aura.h"
38 #include "ui/wm/core/window_util.h" 40 #include "ui/wm/core/window_util.h"
39 #include "ui/wm/public/activation_delegate.h" 41 #include "ui/wm/public/activation_delegate.h"
40 42
41 namespace ash { 43 namespace ash {
42 namespace { 44 namespace {
43 45
44 class NonActivatableActivationDelegate 46 class NonActivatableActivationDelegate
45 : public aura::client::ActivationDelegate { 47 : public aura::client::ActivationDelegate {
46 public: 48 public:
47 virtual bool ShouldActivate() const OVERRIDE { 49 virtual bool ShouldActivate() const OVERRIDE {
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1082
1081 for (size_t p = 0; p < arraysize(points); ++p) { 1083 for (size_t p = 0; p < arraysize(points); ++p) {
1082 ui::MouseEvent event(ui::ET_MOUSE_MOVED, points[p], points[p], 1084 ui::MouseEvent event(ui::ET_MOUSE_MOVED, points[p], points[p],
1083 ui::EF_NONE, ui::EF_NONE); 1085 ui::EF_NONE, ui::EF_NONE);
1084 EXPECT_EQ(windows[w], 1086 EXPECT_EQ(windows[w],
1085 targeter->FindTargetForEvent(root_target, &event)); 1087 targeter->FindTargetForEvent(root_target, &event));
1086 } 1088 }
1087 } 1089 }
1088 } 1090 }
1089 1091
1092 // Test that a label is created under the window on entering overview mode.
1093 TEST_F(WindowSelectorTest, CreateLabelUnderWindow) {
1094 scoped_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 100, 100)));
1095 base::string16 window_title = base::UTF8ToUTF16("My window");
1096 window->set_title(window_title);
1097 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
1098 window->GetRootWindow(),
1099 ash::kShellWindowId_OverlayContainer);
1100 Cycle(WindowSelector::FORWARD);
1101 unsigned int children = root_window->children().size();
1102 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.
1103 // There should be two more windows, one for the close button and one for the
1104 // label.
1105 EXPECT_EQ(children + 2, root_window->children().size())
1106 << root_window->children().size() - children
1107 << " windows have been added instead of the expected 2.";
1108 // The window that contains the label is always the last one in the windows
1109 // 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
1110 aura::Window* label_window = root_window->children().back();
1111 aura::WindowDelegate* delegate = label_window->delegate();
1112 views::NativeWidgetAura* native_delegate =
1113 static_cast<views::NativeWidgetAura*>(delegate);
1114 views::Widget* widget = native_delegate->GetWidget();
1115 ASSERT(widget);
1116 views::Label* label = static_cast<views::Label*>(widget->GetContentsView());
1117 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.
1118 StopCycling();
1119 }
1120
1121 // Test that a label is created under the panel on entering overview mode.
1122 TEST_F(WindowSelectorTest, CreateLabelUnderPanel) {
flackr 2014/04/14 20:31:18 Same comments as above, though since the position
1123 scoped_ptr<aura::Window> panel(CreatePanelWindow(gfx::Rect(0, 0, 100, 100)));
1124 base::string16 panel_title = base::UTF8ToUTF16("My panel");
1125 panel->set_title(panel_title);
1126 aura::Window* root_window = Shell::GetContainer(
1127 panel->GetRootWindow(),
1128 ash::kShellWindowId_OverlayContainer);
1129 Cycle(WindowSelector::FORWARD);
1130 unsigned int children = root_window->children().size();
1131 FireOverviewStartTimer();
1132 // There should be only one additional window, since panels don't have close
1133 // buttons.
1134 EXPECT_EQ(children + 1, root_window->children().size())
1135 << root_window->children().size() - children
1136 << " windows have been added instead of the expected 1.";
1137 // The window that contains the label is always the last one in the windows
1138 // vector.
1139 aura::Window* label_window = root_window->children().back();
1140 aura::WindowDelegate* delegate = label_window->delegate();
1141 views::NativeWidgetAura* native_delegate =
1142 static_cast<views::NativeWidgetAura*>(delegate);
1143 views::Widget* widget = native_delegate->GetWidget();
1144 ASSERT(widget);
1145 views::Label* label = static_cast<views::Label*>(widget->GetContentsView());
1146 EXPECT_EQ(label->text(), panel_title);
1147 StopCycling();
1148 }
1149
1090 } // namespace ash 1150 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698