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

Unified Diff: components/mus/ws/window_tree_unittest.cc

Issue 1459463004: mus: Allow the WM to specify the windows that can have active children. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot-merge Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/ws/window_tree_host_impl.cc ('k') | mandoline/ui/desktop_ui/browser_window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/window_tree_unittest.cc
diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc
index 5f69b294e97ebb5e64737a795ff3088859acb79e..d5cffafeebe293c027d34f250368b3f755a2fb75 100644
--- a/components/mus/ws/window_tree_unittest.cc
+++ b/components/mus/ws/window_tree_unittest.cc
@@ -390,9 +390,20 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
connection1_client->tracker()->changes()->clear();
wm_client()->tracker()->changes()->clear();
+ // Focus should not go to |child1| yet, since the parent still doesn't allow
+ // active children.
display_manager_delegate()->OnEvent(CreatePointerDownEvent(21, 22));
+ EXPECT_EQ(nullptr, connection1->GetHost()->GetFocusedWindow());
+ display_manager_delegate()->OnEvent(CreatePointerUpEvent(21, 22));
+ connection1_client->tracker()->changes()->clear();
+ wm_client()->tracker()->changes()->clear();
+
+ connection1->GetHost()->AddActivationParent(
+ WindowIdToTransportId(embed_window_id));
+
// Focus should go to child1. This result in notifying both the window
// manager and client connection being notified.
+ display_manager_delegate()->OnEvent(CreatePointerDownEvent(21, 22));
EXPECT_EQ(v1, connection1->GetHost()->GetFocusedWindow());
ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
EXPECT_EQ("Focused id=2,1",
@@ -406,19 +417,10 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
wm_client()->tracker()->changes()->clear();
connection1_client->tracker()->changes()->clear();
- // Press outside of the embedded window. Focus should go to the root. Notice
- // the client1 doesn't see who has focus as the focused window (root) isn't
- // visible to it.
+ // Press outside of the embedded window. Note that root cannot be focused
+ // (because it cannot be activated). So the focus would not move in this case.
display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22));
- EXPECT_EQ(host_connection()->window_tree_host()->root_window(),
- host_connection()->window_tree_host()->GetFocusedWindow());
- ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
- EXPECT_EQ("Focused id=0,2",
- ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
- EXPECT_EQ(
- "Focused id=null",
- ChangesToDescription1(*connection1_client->tracker()->changes())[0]);
+ EXPECT_EQ(v1, host_connection()->window_tree_host()->GetFocusedWindow());
display_manager_delegate()->OnEvent(CreatePointerUpEvent(21, 22));
wm_client()->tracker()->changes()->clear();
@@ -427,9 +429,9 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
// Press in the same location. Should not get a focus change event (only input
// event).
display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22));
- EXPECT_EQ(host_connection()->window_tree_host()->root_window(),
- host_connection()->window_tree_host()->GetFocusedWindow());
- ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u);
+ EXPECT_EQ(v1, host_connection()->window_tree_host()->GetFocusedWindow());
+ ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u)
+ << SingleChangeToDescription(*wm_client()->tracker()->changes());
EXPECT_EQ("InputEvent window=0,2 event_action=4",
ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
EXPECT_TRUE(connection1_client->tracker()->changes()->empty());
@@ -465,6 +467,9 @@ TEST_F(WindowTreeTest, BasicInputEventTarget) {
const WindowId child1(connection1->id(), 1);
EXPECT_TRUE(connection1->NewWindow(child1, ServerWindow::Properties()));
EXPECT_TRUE(connection1->AddWindow(embed_window_id, child1));
+ connection1->GetHost()->AddActivationParent(
+ WindowIdToTransportId(embed_window_id));
+
ServerWindow* v1 = connection1->GetWindow(child1);
v1->SetVisible(true);
v1->SetBounds(gfx::Rect(20, 20, 20, 20));
« no previous file with comments | « components/mus/ws/window_tree_host_impl.cc ('k') | mandoline/ui/desktop_ui/browser_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698