Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/public/cpp/config.h" | |
| 6 #include "ash/shell.h" | |
| 7 #include "ash/test/ash_test_base.h" | |
| 8 #include "ash/test/ash_test_helper.h" | |
| 9 #include "ui/aura/mus/window_tree_client.h" | |
|
msw
2017/04/26 23:01:08
nit: remove if not needed
sky
2017/04/26 23:30:28
Done.
| |
| 10 #include "ui/aura/test/mus/test_window_manager_client.h" | |
| 11 #include "ui/aura/test/mus/test_window_tree.h" | |
| 12 #include "ui/aura/test/mus/test_window_tree_client_setup.h" | |
| 13 #include "ui/aura/window.h" | |
| 14 | |
| 15 namespace ash { | |
| 16 namespace mus { | |
| 17 | |
| 18 using WindowManagerCommonTest = test::AshTestBase; | |
|
msw
2017/04/26 23:01:08
What prompts the 'common' part of this name and th
sky
2017/04/26 23:30:28
Added comment.
| |
| 19 | |
| 20 TEST_F(WindowManagerCommonTest, Focus) { | |
| 21 if (Shell::GetAshConfig() == Config::CLASSIC) | |
| 22 return; | |
| 23 | |
| 24 // Mus will deny focus requests if there is no ancestors marked as | |
|
msw
2017/04/26 23:01:08
nit: "there are", maybe rephrase like "Ensure that
sky
2017/04/26 23:30:28
Done.
| |
| 25 // activation parents. | |
| 26 aura::TestWindowManagerClient* test_window_manager_client = | |
| 27 ash_test_helper() | |
| 28 ->window_tree_client_setup() | |
| 29 ->test_window_manager_client(); | |
| 30 EXPECT_NE(0u, | |
|
msw
2017/04/26 23:01:08
optional nit: ASSERT_LT
sky
2017/04/26 23:30:27
Done.
| |
| 31 test_window_manager_client->GetChangeCountForType( | |
| 32 aura::WindowManagerClientChangeType::ADD_ACTIVATION_PARENT)); | |
| 33 | |
| 34 // Ensure a call to Window::Focus() makes it way to the WindowTree. | |
| 35 std::unique_ptr<aura::Window> window = CreateTestWindow(); | |
| 36 aura::TestWindowTree* test_window_tree = | |
| 37 ash_test_helper()->window_tree_client_setup()->window_tree(); | |
| 38 const size_t initial_focus_count = test_window_tree->GetChangeCountForType( | |
| 39 aura::WindowTreeChangeType::FOCUS); | |
| 40 window->Focus(); | |
| 41 EXPECT_TRUE(window->HasFocus()); | |
| 42 EXPECT_EQ(initial_focus_count + 1, test_window_tree->GetChangeCountForType( | |
| 43 aura::WindowTreeChangeType::FOCUS)); | |
| 44 } | |
| 45 | |
| 46 } // namespace mus | |
| 47 } // namespace ash | |
| OLD | NEW |