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

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: . 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
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 3c13428bd0c04875dd082064dbe1ab7da4505cc1..a1ecb3c925c7c16b2cd67172588524a95fe38089 100644
--- a/components/mus/ws/window_tree_unittest.cc
+++ b/components/mus/ws/window_tree_unittest.cc
@@ -389,9 +389,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()->SetActivationParent(
+ WindowIdToTransportId(embed_window_id), true);
+
// 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",
@@ -409,10 +420,9 @@ TEST_F(WindowTreeTest, FocusOnPointer) {
// the client1 doesn't see who has focus as the focused window (root) isn't
// visible to it.
display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22));
- EXPECT_EQ(host_connection()->window_tree_host()->root_window(),
- host_connection()->window_tree_host()->GetFocusedWindow());
+ EXPECT_EQ(nullptr, host_connection()->window_tree_host()->GetFocusedWindow());
ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
- EXPECT_EQ("Focused id=0,2",
+ EXPECT_EQ("Focused id=null",
ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
EXPECT_EQ(
@@ -426,9 +436,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(nullptr, 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());
@@ -463,6 +473,9 @@ TEST_F(WindowTreeTest, BasicInputEventTarget) {
const WindowId child1(connection1->id(), 1);
EXPECT_TRUE(connection1->NewWindow(child1));
EXPECT_TRUE(connection1->AddWindow(embed_window_id, child1));
+ connection1->GetHost()->SetActivationParent(
+ WindowIdToTransportId(embed_window_id), true);
+
ServerWindow* v1 = connection1->GetWindow(child1);
v1->SetVisible(true);
v1->SetBounds(gfx::Rect(20, 20, 20, 20));

Powered by Google App Engine
This is Rietveld 408576698