| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 widget->Restore(); | 452 widget->Restore(); |
| 453 EXPECT_EQ( | 453 EXPECT_EQ( |
| 454 SHELF_VISIBLE, | 454 SHELF_VISIBLE, |
| 455 Shell::GetPrimaryRootWindowController()-> | 455 Shell::GetPrimaryRootWindowController()-> |
| 456 GetShelfLayoutManager()->visibility_state()); | 456 GetShelfLayoutManager()->visibility_state()); |
| 457 | 457 |
| 458 // Clean up. | 458 // Clean up. |
| 459 widget->Close(); | 459 widget->Close(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 namespace { | |
| 463 | |
| 464 // Builds the list of parents from |window| to the root. The returned vector is | |
| 465 // in reverse order (|window| is first). | |
| 466 std::vector<aura::Window*> BuildPathToRoot(aura::Window* window) { | |
| 467 std::vector<aura::Window*> results; | |
| 468 while (window) { | |
| 469 results.push_back(window); | |
| 470 window = window->parent(); | |
| 471 } | |
| 472 return results; | |
| 473 } | |
| 474 | |
| 475 } // namespace | |
| 476 | |
| 477 // Various assertions around SetShelfAutoHideBehavior() and | 462 // Various assertions around SetShelfAutoHideBehavior() and |
| 478 // GetShelfAutoHideBehavior(). | 463 // GetShelfAutoHideBehavior(). |
| 479 TEST_F(ShellTest, ToggleAutoHide) { | 464 TEST_F(ShellTest, ToggleAutoHide) { |
| 480 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 465 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
| 481 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 466 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 482 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 467 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
| 483 window->Init(ui::LAYER_TEXTURED); | 468 window->Init(ui::LAYER_TEXTURED); |
| 484 ParentWindowInPrimaryRootWindow(window.get()); | 469 ParentWindowInPrimaryRootWindow(window.get()); |
| 485 window->Show(); | 470 window->Show(); |
| 486 wm::ActivateWindow(window.get()); | 471 wm::ActivateWindow(window.get()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 private: | 531 private: |
| 547 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 532 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
| 548 }; | 533 }; |
| 549 | 534 |
| 550 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 535 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
| 551 window_.reset(new aura::Window(NULL)); | 536 window_.reset(new aura::Window(NULL)); |
| 552 window_->Init(ui::LAYER_NOT_DRAWN); | 537 window_->Init(ui::LAYER_NOT_DRAWN); |
| 553 } | 538 } |
| 554 | 539 |
| 555 } // namespace ash | 540 } // namespace ash |
| OLD | NEW |