| 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 "ui/wm/core/window_modality_controller.h" | 5 #include "ui/wm/core/window_modality_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/child_modal_window.h" | 9 #include "ash/test/child_modal_window.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 aura::test::TestWindowDelegate d; | 330 aura::test::TestWindowDelegate d; |
| 331 std::unique_ptr<aura::Window> w1( | 331 std::unique_ptr<aura::Window> w1( |
| 332 CreateTestWindowInShellWithDelegate(&d, -1, gfx::Rect())); | 332 CreateTestWindowInShellWithDelegate(&d, -1, gfx::Rect())); |
| 333 std::unique_ptr<aura::Window> w11( | 333 std::unique_ptr<aura::Window> w11( |
| 334 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w1.get())); | 334 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w1.get())); |
| 335 std::unique_ptr<aura::Window> w2( | 335 std::unique_ptr<aura::Window> w2( |
| 336 CreateTestWindowInShellWithDelegate(&d, -2, gfx::Rect())); | 336 CreateTestWindowInShellWithDelegate(&d, -2, gfx::Rect())); |
| 337 std::unique_ptr<aura::Window> w3( | 337 std::unique_ptr<aura::Window> w3( |
| 338 CreateTestWindowInShellWithDelegate(&d, -2, gfx::Rect())); | 338 CreateTestWindowInShellWithDelegate(&d, -2, gfx::Rect())); |
| 339 w3->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_CHILD); | 339 w3->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_CHILD); |
| 340 ::wm::SetModalParent(w3.get(), w1.get()); | 340 ::wm::SetModalParent(w3.get(), w1.get(), NULL, NULL); |
| 341 | 341 |
| 342 // w1's capture should be released when w3 becomes visible. | 342 // w1's capture should be released when w3 becomes visible. |
| 343 w3->Hide(); | 343 w3->Hide(); |
| 344 aura::client::GetCaptureClient(Shell::GetPrimaryRootWindow()) | 344 aura::client::GetCaptureClient(Shell::GetPrimaryRootWindow()) |
| 345 ->SetCapture(w1.get()); | 345 ->SetCapture(w1.get()); |
| 346 EXPECT_EQ(w1.get(), | 346 EXPECT_EQ(w1.get(), |
| 347 aura::client::GetCaptureClient(Shell::GetPrimaryRootWindow()) | 347 aura::client::GetCaptureClient(Shell::GetPrimaryRootWindow()) |
| 348 ->GetGlobalCaptureWindow()); | 348 ->GetGlobalCaptureWindow()); |
| 349 w3->Show(); | 349 w3->Show(); |
| 350 EXPECT_NE(w1.get(), | 350 EXPECT_NE(w1.get(), |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 aura::test::TestWindowDelegate d; | 625 aura::test::TestWindowDelegate d; |
| 626 std::unique_ptr<aura::Window> w1( | 626 std::unique_ptr<aura::Window> w1( |
| 627 CreateTestWindowInShellWithDelegate(&d, -1, gfx::Rect())); | 627 CreateTestWindowInShellWithDelegate(&d, -1, gfx::Rect())); |
| 628 std::unique_ptr<aura::Window> w2( | 628 std::unique_ptr<aura::Window> w2( |
| 629 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w1.get())); | 629 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w1.get())); |
| 630 std::unique_ptr<aura::Window> w3( | 630 std::unique_ptr<aura::Window> w3( |
| 631 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w2.get())); | 631 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w2.get())); |
| 632 std::unique_ptr<aura::Window> w4( | 632 std::unique_ptr<aura::Window> w4( |
| 633 CreateTestWindowInShellWithDelegate(&d, -2, gfx::Rect())); | 633 CreateTestWindowInShellWithDelegate(&d, -2, gfx::Rect())); |
| 634 w4->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_CHILD); | 634 w4->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_CHILD); |
| 635 ::wm::SetModalParent(w4.get(), w2.get()); | 635 ::wm::SetModalParent(w4.get(), w2.get(), NULL, NULL); |
| 636 ::wm::AddTransientChild(w1.get(), w4.get()); | 636 ::wm::AddTransientChild(w1.get(), w4.get()); |
| 637 | 637 |
| 638 wm::ActivateWindow(w1.get()); | 638 wm::ActivateWindow(w1.get()); |
| 639 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 639 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
| 640 | 640 |
| 641 wm::ActivateWindow(w2.get()); | 641 wm::ActivateWindow(w2.get()); |
| 642 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); | 642 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); |
| 643 | 643 |
| 644 wm::ActivateWindow(w3.get()); | 644 wm::ActivateWindow(w3.get()); |
| 645 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); | 645 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); |
| 646 | 646 |
| 647 wm::ActivateWindow(w4.get()); | 647 wm::ActivateWindow(w4.get()); |
| 648 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); | 648 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); |
| 649 } | 649 } |
| 650 | 650 |
| 651 } // namespace ash | 651 } // namespace ash |
| OLD | NEW |