| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/wm/mru_window_tracker.h" | 5 #include "ash/common/wm/mru_window_tracker.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/common/wm_shell.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/wm/window_state_aura.h" | 13 #include "ash/wm/window_state_aura.h" |
| 13 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
| 16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| 20 class MruWindowTrackerTest : public test::AshTestBase { | 21 class MruWindowTrackerTest : public test::AshTestBase { |
| 21 public: | 22 public: |
| 22 MruWindowTrackerTest() {} | 23 MruWindowTrackerTest() {} |
| 23 ~MruWindowTrackerTest() override {} | 24 ~MruWindowTrackerTest() override {} |
| 24 | 25 |
| 25 aura::Window* CreateWindow() { | 26 aura::Window* CreateWindow() { |
| 26 return CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 400, 400)); | 27 return CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 400, 400)); |
| 27 } | 28 } |
| 28 | 29 |
| 29 ash::MruWindowTracker* mru_window_tracker() { | 30 ash::MruWindowTracker* mru_window_tracker() { |
| 30 return Shell::GetInstance()->mru_window_tracker(); | 31 return WmShell::Get()->mru_window_tracker(); |
| 31 } | 32 } |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(MruWindowTrackerTest); | 35 DISALLOW_COPY_AND_ASSIGN(MruWindowTrackerTest); |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 // Basic test that the activation order is tracked. | 38 // Basic test that the activation order is tracked. |
| 38 TEST_F(MruWindowTrackerTest, Basic) { | 39 TEST_F(MruWindowTrackerTest, Basic) { |
| 39 std::unique_ptr<aura::Window> w1(CreateWindow()); | 40 std::unique_ptr<aura::Window> w1(CreateWindow()); |
| 40 std::unique_ptr<aura::Window> w2(CreateWindow()); | 41 std::unique_ptr<aura::Window> w2(CreateWindow()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList()); | 124 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList()); |
| 124 | 125 |
| 125 EXPECT_EQ(window_list.end(), | 126 EXPECT_EQ(window_list.end(), |
| 126 std::find(window_list.begin(), window_list.end(), w1.get())); | 127 std::find(window_list.begin(), window_list.end(), w1.get())); |
| 127 EXPECT_EQ(window_list.end(), | 128 EXPECT_EQ(window_list.end(), |
| 128 std::find(window_list.begin(), window_list.end(), w3.get())); | 129 std::find(window_list.begin(), window_list.end(), w3.get())); |
| 129 EXPECT_EQ(1u, window_list.size()); | 130 EXPECT_EQ(1u, window_list.size()); |
| 130 } | 131 } |
| 131 | 132 |
| 132 } // namespace ash | 133 } // namespace ash |
| OLD | NEW |