| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/shelf/shelf_view.h" | 5 #include "ash/common/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/common/shelf/app_list_button.h" | 12 #include "ash/common/shelf/app_list_button.h" |
| 13 #include "ash/common/shelf/overflow_bubble.h" | 13 #include "ash/common/shelf/overflow_bubble.h" |
| 14 #include "ash/common/shelf/overflow_bubble_view.h" | 14 #include "ash/common/shelf/overflow_bubble_view.h" |
| 15 #include "ash/common/shelf/overflow_button.h" | 15 #include "ash/common/shelf/overflow_button.h" |
| 16 #include "ash/common/shelf/shelf_button.h" | 16 #include "ash/common/shelf/shelf_button.h" |
| 17 #include "ash/common/shelf/shelf_constants.h" | 17 #include "ash/common/shelf/shelf_constants.h" |
| 18 #include "ash/common/shelf/shelf_model.h" | 18 #include "ash/common/shelf/shelf_model.h" |
| 19 #include "ash/common/shelf/shelf_tooltip_manager.h" | 19 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 20 #include "ash/common/shelf/shelf_widget.h" | 20 #include "ash/common/shelf/shelf_widget.h" |
| 21 #include "ash/common/shelf/wm_shelf.h" | 21 #include "ash/common/shelf/wm_shelf.h" |
| 22 #include "ash/common/shelf/wm_shelf_observer.h" | 22 #include "ash/common/shelf/wm_shelf_observer.h" |
| 23 #include "ash/common/system/web_notification/web_notification_tray.h" | 23 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 24 #include "ash/common/test/test_shelf_delegate.h" | 24 #include "ash/common/test/test_shelf_delegate.h" |
| 25 #include "ash/common/test/test_shelf_item_delegate.h" | 25 #include "ash/common/test/test_shelf_item_delegate.h" |
| 26 #include "ash/common/test/test_system_tray_delegate.h" | 26 #include "ash/common/test/test_system_tray_delegate.h" |
| 27 #include "ash/common/wm_lookup.h" | |
| 28 #include "ash/common/wm_shell.h" | 27 #include "ash/common/wm_shell.h" |
| 29 #include "ash/common/wm_window.h" | 28 #include "ash/common/wm_window.h" |
| 30 #include "ash/public/cpp/shell_window_ids.h" | 29 #include "ash/public/cpp/shell_window_ids.h" |
| 31 #include "ash/root_window_controller.h" | 30 #include "ash/root_window_controller.h" |
| 32 #include "ash/shell.h" | 31 #include "ash/shell.h" |
| 33 #include "ash/test/ash_test_base.h" | 32 #include "ash/test/ash_test_base.h" |
| 34 #include "ash/test/ash_test_helper.h" | 33 #include "ash/test/ash_test_helper.h" |
| 35 #include "ash/test/overflow_bubble_view_test_api.h" | 34 #include "ash/test/overflow_bubble_view_test_api.h" |
| 36 #include "ash/test/shelf_view_test_api.h" | 35 #include "ash/test/shelf_view_test_api.h" |
| 37 #include "ash/test/test_shell_delegate.h" | 36 #include "ash/test/test_shell_delegate.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 174 |
| 176 TEST_F(WmShelfObserverIconTest, AddRemove) { | 175 TEST_F(WmShelfObserverIconTest, AddRemove) { |
| 177 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 176 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 178 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 177 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 179 params.bounds = gfx::Rect(0, 0, 200, 200); | 178 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 180 params.context = CurrentContext(); | 179 params.context = CurrentContext(); |
| 181 views::Widget widget; | 180 views::Widget widget; |
| 182 widget.Init(params); | 181 widget.Init(params); |
| 183 | 182 |
| 184 TestShelfDelegate::instance()->AddShelfItem( | 183 TestShelfDelegate::instance()->AddShelfItem( |
| 185 WmLookup::Get()->GetWindowForWidget(&widget)); | 184 WmWindow::Get(widget.GetNativeWindow())); |
| 186 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); | 185 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 187 EXPECT_TRUE(observer()->icon_positions_changed()); | 186 EXPECT_TRUE(observer()->icon_positions_changed()); |
| 188 observer()->Reset(); | 187 observer()->Reset(); |
| 189 | 188 |
| 190 widget.Show(); | 189 widget.Show(); |
| 191 widget.GetNativeWindow()->parent()->RemoveChild(widget.GetNativeWindow()); | 190 widget.GetNativeWindow()->parent()->RemoveChild(widget.GetNativeWindow()); |
| 192 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); | 191 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 193 EXPECT_TRUE(observer()->icon_positions_changed()); | 192 EXPECT_TRUE(observer()->icon_positions_changed()); |
| 194 observer()->Reset(); | 193 observer()->Reset(); |
| 195 } | 194 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 207 TestWmShelfObserver second_observer(second_shelf); | 206 TestWmShelfObserver second_observer(second_shelf); |
| 208 | 207 |
| 209 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 208 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 210 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 209 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 211 params.bounds = gfx::Rect(0, 0, 200, 200); | 210 params.bounds = gfx::Rect(0, 0, 200, 200); |
| 212 params.context = CurrentContext(); | 211 params.context = CurrentContext(); |
| 213 views::Widget widget; | 212 views::Widget widget; |
| 214 widget.Init(params); | 213 widget.Init(params); |
| 215 | 214 |
| 216 TestShelfDelegate::instance()->AddShelfItem( | 215 TestShelfDelegate::instance()->AddShelfItem( |
| 217 WmLookup::Get()->GetWindowForWidget(&widget)); | 216 WmWindow::Get(widget.GetNativeWindow())); |
| 218 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); | 217 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 219 EXPECT_TRUE(observer()->icon_positions_changed()); | 218 EXPECT_TRUE(observer()->icon_positions_changed()); |
| 220 EXPECT_TRUE(second_observer.icon_positions_changed()); | 219 EXPECT_TRUE(second_observer.icon_positions_changed()); |
| 221 observer()->Reset(); | 220 observer()->Reset(); |
| 222 second_observer.Reset(); | 221 second_observer.Reset(); |
| 223 | 222 |
| 224 widget.GetNativeWindow()->parent()->RemoveChild(widget.GetNativeWindow()); | 223 widget.GetNativeWindow()->parent()->RemoveChild(widget.GetNativeWindow()); |
| 225 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); | 224 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 226 EXPECT_TRUE(observer()->icon_positions_changed()); | 225 EXPECT_TRUE(observer()->icon_positions_changed()); |
| 227 EXPECT_TRUE(second_observer.icon_positions_changed()); | 226 EXPECT_TRUE(second_observer.icon_positions_changed()); |
| (...skipping 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 EXPECT_EQ(views::InkDropState::ACTIVATED, | 3007 EXPECT_EQ(views::InkDropState::ACTIVATED, |
| 3009 overflow_button_ink_drop_->GetTargetInkDropState()); | 3008 overflow_button_ink_drop_->GetTargetInkDropState()); |
| 3010 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 3009 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), |
| 3011 IsEmpty()); | 3010 IsEmpty()); |
| 3012 | 3011 |
| 3013 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3012 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
| 3014 } | 3013 } |
| 3015 | 3014 |
| 3016 } // namespace test | 3015 } // namespace test |
| 3017 } // namespace ash | 3016 } // namespace ash |
| OLD | NEW |