Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Side by Side Diff: ash/mus/window_manager_common_unittests.cc

Issue 2843193002: chromeos: fix focus for mushrome (Closed)
Patch Set: feedback Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/window_manager.cc ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/test/mus/test_window_manager_client.h"
10 #include "ui/aura/test/mus/test_window_tree.h"
11 #include "ui/aura/test/mus/test_window_tree_client_setup.h"
12 #include "ui/aura/window.h"
13
14 // The tests in this file are in all configs of ash, where as those in
15 // window_manager_unittest.cc is only run in Config::MASH.
16
17 namespace ash {
18 namespace mus {
19
20 using WindowManagerCommonTest = test::AshTestBase;
21
22 TEST_F(WindowManagerCommonTest, Focus) {
23 if (Shell::GetAshConfig() == Config::CLASSIC)
24 return;
25
26 // Ensure that activation parents have been added, an ancestor of |window|
27 // must support activation for the focus attempt below to succeed.
28 aura::TestWindowManagerClient* test_window_manager_client =
29 ash_test_helper()
30 ->window_tree_client_setup()
31 ->test_window_manager_client();
32 EXPECT_LT(0u,
33 test_window_manager_client->GetChangeCountForType(
34 aura::WindowManagerClientChangeType::ADD_ACTIVATION_PARENT));
35
36 // Ensure a call to Window::Focus() makes it way to the WindowTree.
37 std::unique_ptr<aura::Window> window = CreateTestWindow();
38 aura::TestWindowTree* test_window_tree =
39 ash_test_helper()->window_tree_client_setup()->window_tree();
40 const size_t initial_focus_count = test_window_tree->GetChangeCountForType(
41 aura::WindowTreeChangeType::FOCUS);
42 window->Focus();
43 EXPECT_TRUE(window->HasFocus());
44 EXPECT_EQ(initial_focus_count + 1, test_window_tree->GetChangeCountForType(
45 aura::WindowTreeChangeType::FOCUS));
46 }
47
48 } // namespace mus
49 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager.cc ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698