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/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 aura::Window* GetAlwaysOnTopContainer() { | 49 aura::Window* GetAlwaysOnTopContainer() { |
50 return Shell::GetContainer( | 50 return Shell::GetContainer( |
51 Shell::GetPrimaryRootWindow(), | 51 Shell::GetPrimaryRootWindow(), |
52 internal::kShellWindowId_AlwaysOnTopContainer); | 52 internal::kShellWindowId_AlwaysOnTopContainer); |
53 } | 53 } |
54 | 54 |
55 // Expect ALL the containers! | 55 // Expect ALL the containers! |
56 void ExpectAllContainers() { | 56 void ExpectAllContainers() { |
57 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 57 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
58 EXPECT_TRUE(Shell::GetContainer( | 58 EXPECT_TRUE(Shell::GetContainer( |
59 root_window, internal::kShellWindowId_DesktopBackgroundContainer)); | 59 root_window, internal::kShellWindowId_DesktopBackgroundContainer)); |
60 EXPECT_TRUE(Shell::GetContainer( | 60 EXPECT_TRUE(Shell::GetContainer( |
61 root_window, internal::kShellWindowId_DefaultContainer)); | 61 root_window, internal::kShellWindowId_DefaultContainer)); |
62 EXPECT_TRUE(Shell::GetContainer( | 62 EXPECT_TRUE(Shell::GetContainer( |
63 root_window, internal::kShellWindowId_AlwaysOnTopContainer)); | 63 root_window, internal::kShellWindowId_AlwaysOnTopContainer)); |
64 EXPECT_TRUE(Shell::GetContainer( | 64 EXPECT_TRUE(Shell::GetContainer( |
65 root_window, internal::kShellWindowId_PanelContainer)); | 65 root_window, internal::kShellWindowId_PanelContainer)); |
66 EXPECT_TRUE(Shell::GetContainer( | 66 EXPECT_TRUE(Shell::GetContainer( |
67 root_window, internal::kShellWindowId_ShelfContainer)); | 67 root_window, internal::kShellWindowId_ShelfContainer)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 Shell* shell = Shell::GetInstance(); | 390 Shell* shell = Shell::GetInstance(); |
391 Shell::TestApi test_api(shell); | 391 Shell::TestApi test_api(shell); |
392 | 392 |
393 // We start with the usual window containers. | 393 // We start with the usual window containers. |
394 ExpectAllContainers(); | 394 ExpectAllContainers(); |
395 // Launcher is visible. | 395 // Launcher is visible. |
396 ShelfWidget* launcher_widget = Launcher::ForPrimaryDisplay()->shelf_widget(); | 396 ShelfWidget* launcher_widget = Launcher::ForPrimaryDisplay()->shelf_widget(); |
397 EXPECT_TRUE(launcher_widget->IsVisible()); | 397 EXPECT_TRUE(launcher_widget->IsVisible()); |
398 // Launcher is at bottom-left of screen. | 398 // Launcher is at bottom-left of screen. |
399 EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); | 399 EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); |
400 EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(), | 400 EXPECT_EQ( |
401 launcher_widget->GetWindowBoundsInScreen().bottom()); | 401 Shell::GetPrimaryRootWindow()->GetDispatcher()->GetHostSize().height(), |
| 402 launcher_widget->GetWindowBoundsInScreen().bottom()); |
402 // We have a desktop background but not a bare layer. | 403 // We have a desktop background but not a bare layer. |
403 // TODO (antrim): enable once we find out why it fails component build. | 404 // TODO (antrim): enable once we find out why it fails component build. |
404 // internal::DesktopBackgroundWidgetController* background = | 405 // internal::DesktopBackgroundWidgetController* background = |
405 // Shell::GetPrimaryRootWindow()-> | 406 // Shell::GetPrimaryRootWindow()-> |
406 // GetProperty(internal::kWindowDesktopComponent); | 407 // GetProperty(internal::kWindowDesktopComponent); |
407 // EXPECT_TRUE(background); | 408 // EXPECT_TRUE(background); |
408 // EXPECT_TRUE(background->widget()); | 409 // EXPECT_TRUE(background->widget()); |
409 // EXPECT_FALSE(background->layer()); | 410 // EXPECT_FALSE(background->layer()); |
410 | 411 |
411 // Create a normal window. It is not maximized. | 412 // Create a normal window. It is not maximized. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 TEST_F(ShellTest, ToggleAutoHide) { | 476 TEST_F(ShellTest, ToggleAutoHide) { |
476 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 477 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
477 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 478 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
478 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 479 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
479 window->Init(ui::LAYER_TEXTURED); | 480 window->Init(ui::LAYER_TEXTURED); |
480 ParentWindowInPrimaryRootWindow(window.get()); | 481 ParentWindowInPrimaryRootWindow(window.get()); |
481 window->Show(); | 482 window->Show(); |
482 wm::ActivateWindow(window.get()); | 483 wm::ActivateWindow(window.get()); |
483 | 484 |
484 Shell* shell = Shell::GetInstance(); | 485 Shell* shell = Shell::GetInstance(); |
485 aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); | 486 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
486 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 487 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
487 root_window); | 488 root_window); |
488 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 489 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
489 shell->GetShelfAutoHideBehavior(root_window)); | 490 shell->GetShelfAutoHideBehavior(root_window)); |
490 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 491 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
491 root_window); | 492 root_window); |
492 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 493 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
493 shell->GetShelfAutoHideBehavior(root_window)); | 494 shell->GetShelfAutoHideBehavior(root_window)); |
494 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 495 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
495 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 496 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 private: | 533 private: |
533 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 534 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
534 }; | 535 }; |
535 | 536 |
536 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 537 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
537 window_.reset(new aura::Window(NULL)); | 538 window_.reset(new aura::Window(NULL)); |
538 window_->Init(ui::LAYER_NOT_DRAWN); | 539 window_->Init(ui::LAYER_NOT_DRAWN); |
539 } | 540 } |
540 | 541 |
541 } // namespace ash | 542 } // namespace ash |
OLD | NEW |