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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/display/mouse_cursor_event_filter.h" | 10 #include "ash/display/mouse_cursor_event_filter.h" |
11 #include "ash/drag_drop/drag_drop_controller.h" | 11 #include "ash/drag_drop/drag_drop_controller.h" |
12 #include "ash/public/cpp/config.h" | 12 #include "ash/public/cpp/config.h" |
13 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
15 #include "ash/session/session_controller.h" | 15 #include "ash/session/session_controller.h" |
| 16 #include "ash/shelf/shelf.h" |
16 #include "ash/shelf/shelf_layout_manager.h" | 17 #include "ash/shelf/shelf_layout_manager.h" |
17 #include "ash/shelf/shelf_widget.h" | 18 #include "ash/shelf/shelf_widget.h" |
18 #include "ash/shelf/wm_shelf.h" | |
19 #include "ash/shell_port.h" | 19 #include "ash/shell_port.h" |
20 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
21 #include "ash/test/shell_test_api.h" | 21 #include "ash/test/shell_test_api.h" |
22 #include "ash/test/test_session_controller_client.h" | 22 #include "ash/test/test_session_controller_client.h" |
23 #include "ash/wallpaper/wallpaper_widget_controller.h" | 23 #include "ash/wallpaper/wallpaper_widget_controller.h" |
24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
25 #include "ash/wm_window.h" | 25 #include "ash/wm_window.h" |
26 #include "base/macros.h" | 26 #include "base/macros.h" |
27 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
28 #include "base/threading/thread_task_runner_handle.h" | 28 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // TODO(jamescook): Move this to ShelfTest. | 431 // TODO(jamescook): Move this to ShelfTest. |
432 TEST_F(ShellTest, ToggleAutoHide) { | 432 TEST_F(ShellTest, ToggleAutoHide) { |
433 std::unique_ptr<aura::Window> window(new aura::Window(NULL)); | 433 std::unique_ptr<aura::Window> window(new aura::Window(NULL)); |
434 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 434 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
435 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 435 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
436 window->Init(ui::LAYER_TEXTURED); | 436 window->Init(ui::LAYER_TEXTURED); |
437 ParentWindowInPrimaryRootWindow(window.get()); | 437 ParentWindowInPrimaryRootWindow(window.get()); |
438 window->Show(); | 438 window->Show(); |
439 wm::ActivateWindow(window.get()); | 439 wm::ActivateWindow(window.get()); |
440 | 440 |
441 WmShelf* shelf = GetPrimaryShelf(); | 441 Shelf* shelf = GetPrimaryShelf(); |
442 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 442 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
443 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 443 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
444 | 444 |
445 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 445 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
446 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 446 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
447 | 447 |
448 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 448 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
449 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 449 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
450 | 450 |
451 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 451 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 private: | 504 private: |
505 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 505 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
506 }; | 506 }; |
507 | 507 |
508 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 508 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
509 window_.reset(new aura::Window(NULL)); | 509 window_.reset(new aura::Window(NULL)); |
510 window_->Init(ui::LAYER_NOT_DRAWN); | 510 window_->Init(ui::LAYER_NOT_DRAWN); |
511 } | 511 } |
512 | 512 |
513 } // namespace ash | 513 } // namespace ash |
OLD | NEW |