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/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
12 #include "ash/common/wm/wm_globals.h" | 12 #include "ash/common/wm_lookup.h" |
13 #include "ash/common/wm/wm_lookup.h" | 13 #include "ash/common/wm_root_window_controller.h" |
14 #include "ash/common/wm/wm_root_window_controller.h" | 14 #include "ash/common/wm_shell.h" |
15 #include "ash/common/wm/wm_window.h" | 15 #include "ash/common/wm_window.h" |
16 #include "ash/display/display_manager.h" | 16 #include "ash/display/display_manager.h" |
17 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
18 #include "ash/shelf/shelf_layout_manager.h" | 18 #include "ash/shelf/shelf_layout_manager.h" |
19 #include "ash/shelf/shelf_widget.h" | 19 #include "ash/shelf/shelf_widget.h" |
20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
21 #include "ash/system/status_area_widget.h" | 21 #include "ash/system/status_area_widget.h" |
22 #include "ash/system/tray/system_tray.h" | 22 #include "ash/system/tray/system_tray.h" |
23 #include "ash/system/tray/system_tray_item.h" | 23 #include "ash/system/tray/system_tray_item.h" |
24 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" | 24 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
25 #include "ash/test/ash_test_base.h" | 25 #include "ash/test/ash_test_base.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 bool IsPopupVisible() { | 147 bool IsPopupVisible() { |
148 return GetTray()->IsPopupVisible(); | 148 return GetTray()->IsPopupVisible(); |
149 } | 149 } |
150 | 150 |
151 std::unique_ptr<views::Widget> CreateTestWidget() { | 151 std::unique_ptr<views::Widget> CreateTestWidget() { |
152 std::unique_ptr<views::Widget> widget(new views::Widget); | 152 std::unique_ptr<views::Widget> widget(new views::Widget); |
153 views::Widget::InitParams params; | 153 views::Widget::InitParams params; |
154 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 154 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
155 params.bounds = gfx::Rect(1, 2, 3, 4); | 155 params.bounds = gfx::Rect(1, 2, 3, 4); |
156 wm::WmGlobals::Get() | 156 WmShell::Get() |
157 ->GetPrimaryRootWindow() | 157 ->GetPrimaryRootWindow() |
158 ->GetRootWindowController() | 158 ->GetRootWindowController() |
159 ->ConfigureWidgetInitParamsForContainer( | 159 ->ConfigureWidgetInitParamsForContainer( |
160 widget.get(), kShellWindowId_DefaultContainer, ¶ms); | 160 widget.get(), kShellWindowId_DefaultContainer, ¶ms); |
161 widget->Init(params); | 161 widget->Init(params); |
162 widget->Show(); | 162 widget->Show(); |
163 return widget; | 163 return widget; |
164 } | 164 } |
165 | 165 |
166 private: | 166 private: |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 std::unique_ptr<views::Widget> widget(CreateTestWidget()); | 431 std::unique_ptr<views::Widget> widget(CreateTestWidget()); |
432 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 432 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
433 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 433 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
434 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 434 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
435 int bottom_auto_hidden = GetPopupWorkAreaBottom(); | 435 int bottom_auto_hidden = GetPopupWorkAreaBottom(); |
436 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 436 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
437 | 437 |
438 // Put |widget| into fullscreen without forcing the shelf to hide. Currently, | 438 // Put |widget| into fullscreen without forcing the shelf to hide. Currently, |
439 // this is used by immersive fullscreen and forces the shelf to be auto | 439 // this is used by immersive fullscreen and forces the shelf to be auto |
440 // hidden. | 440 // hidden. |
441 wm::WmLookup::Get() | 441 WmLookup::Get() |
442 ->GetWindowForWidget(widget.get()) | 442 ->GetWindowForWidget(widget.get()) |
443 ->GetWindowState() | 443 ->GetWindowState() |
444 ->set_hide_shelf_when_fullscreen(false); | 444 ->set_hide_shelf_when_fullscreen(false); |
445 widget->SetFullscreen(true); | 445 widget->SetFullscreen(true); |
446 RunAllPendingInMessageLoop(); | 446 RunAllPendingInMessageLoop(); |
447 | 447 |
448 // The work area for auto-hidden status of fullscreen is a bit larger | 448 // The work area for auto-hidden status of fullscreen is a bit larger |
449 // since it doesn't even have the 3-pixel width. | 449 // since it doesn't even have the 3-pixel width. |
450 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 450 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
451 int bottom_fullscreen_hidden = GetPopupWorkAreaBottom(); | 451 int bottom_fullscreen_hidden = GetPopupWorkAreaBottom(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, | 540 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, out_of_bounds, touch_id, |
541 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); | 541 move.time_stamp()+base::TimeDelta::FromMilliseconds(50)); |
542 generator.Dispatch(&release); | 542 generator.Dispatch(&release); |
543 EXPECT_FALSE(tray->draw_background_as_active()); | 543 EXPECT_FALSE(tray->draw_background_as_active()); |
544 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 544 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
545 } | 545 } |
546 | 546 |
547 #endif // OS_CHROMEOS | 547 #endif // OS_CHROMEOS |
548 | 548 |
549 } // namespace ash | 549 } // namespace ash |
OLD | NEW |