Chromium Code Reviews| Index: services/ui/ws/window_manager_client_unittest.cc |
| diff --git a/services/ui/ws/window_manager_client_unittest.cc b/services/ui/ws/window_manager_client_unittest.cc |
| index 3dea21ef193e4741480ad489e340076ef0551d74..56e69fb7b9d267859fe8e56748dbd5bfb455d685 100644 |
| --- a/services/ui/ws/window_manager_client_unittest.cc |
| +++ b/services/ui/ws/window_manager_client_unittest.cc |
| @@ -861,15 +861,13 @@ TEST_F(WindowServerTest, Activation) { |
| WaitForTreeSizeToMatch(parent, 6); |
| - // |child2| and |child3| are stacked about |child1|. |
| - EXPECT_GT(ValidIndexOf(parent->children(), child2), |
| - ValidIndexOf(parent->children(), child1)); |
| - EXPECT_GT(ValidIndexOf(parent->children(), child3), |
| - ValidIndexOf(parent->children(), child1)); |
| - |
| - // Set focus on |child11|. This should activate |child1|, and raise it over |
| - // |child2|. But |child3| should still be above |child1| because of |
| - // transiency. |
| + EXPECT_EQ(0, ValidIndexOf(parent->children(), child1)); |
| + // NOTE: |child2| is after |child1| as |child2| is a transient child of |
|
msw
2016/10/03 23:59:47
nit: do you mean "after |child3|"?
sky
2016/10/04 00:04:32
GAH! You are right. I reordered this so that it go
|
| + // |child1|. |
| + EXPECT_EQ(2, ValidIndexOf(parent->children(), child2)); |
| + EXPECT_EQ(1, ValidIndexOf(parent->children(), child3)); |
| + |
| + // Set focus on |child11|, order of windows should not change. |
|
msw
2016/10/03 23:59:47
nit: child1
sky
2016/10/04 00:04:32
It is child11 though? Look at next line.
msw
2016/10/04 00:11:04
D'oh, you're right; sorry.
|
| child11->SetFocus(); |
| ASSERT_TRUE(WaitForWindowToHaveFocus(child11)); |
| ASSERT_TRUE(WaitForWindowToHaveFocus( |
| @@ -878,13 +876,12 @@ TEST_F(WindowServerTest, Activation) { |
| server_id(window_manager()->GetFocusedWindow())); |
| EXPECT_EQ(server_id(child11), server_id(embedded1->GetFocusedWindow())); |
| EXPECT_EQ(nullptr, embedded2->GetFocusedWindow()); |
| - EXPECT_GT(ValidIndexOf(parent->children(), child1), |
| - ValidIndexOf(parent->children(), child2)); |
| - EXPECT_GT(ValidIndexOf(parent->children(), child3), |
| - ValidIndexOf(parent->children(), child1)); |
| + EXPECT_EQ(0, ValidIndexOf(parent->children(), child1)); |
| + EXPECT_EQ(2, ValidIndexOf(parent->children(), child2)); |
| + EXPECT_EQ(1, ValidIndexOf(parent->children(), child3)); |
| - // Set focus on |child21|. This should activate |child2|, and raise it over |
| - // |child1|. |
| + // Set focus on |child21|. This should activate |child2|. Again, order should |
| + // not change. |
| child21->SetFocus(); |
| ASSERT_TRUE(WaitForWindowToHaveFocus(child21)); |
| ASSERT_TRUE(WaitForWindowToHaveFocus( |
| @@ -894,10 +891,9 @@ TEST_F(WindowServerTest, Activation) { |
| EXPECT_EQ(server_id(child21), server_id(embedded2->GetFocusedWindow())); |
| EXPECT_TRUE(WaitForNoWindowToHaveFocus(embedded1)); |
| EXPECT_EQ(nullptr, embedded1->GetFocusedWindow()); |
| - EXPECT_GT(ValidIndexOf(parent->children(), child2), |
| - ValidIndexOf(parent->children(), child1)); |
| - EXPECT_GT(ValidIndexOf(parent->children(), child3), |
| - ValidIndexOf(parent->children(), child1)); |
| + EXPECT_EQ(0, ValidIndexOf(parent->children(), child1)); |
| + EXPECT_EQ(2, ValidIndexOf(parent->children(), child2)); |
| + EXPECT_EQ(1, ValidIndexOf(parent->children(), child3)); |
| } |
| TEST_F(WindowServerTest, ActivationNext) { |
| @@ -918,13 +914,11 @@ TEST_F(WindowServerTest, ActivationNext) { |
| Window* child31 = NewVisibleWindow(GetFirstRoot(embedded3), embedded3); |
| WaitForTreeSizeToMatch(parent, 7); |
| - Window* expecteds[] = { child3, child2, child1, child3, nullptr }; |
| Window* focused[] = { child31, child21, child11, child31, nullptr }; |
| - for (size_t index = 0; expecteds[index]; ++index) { |
| + for (size_t index = 0; focused[index]; ++index) { |
| window_manager_client()->ActivateNextWindow(); |
| WaitForWindowToHaveFocus(focused[index]); |
| EXPECT_TRUE(focused[index]->HasFocus()); |
| - EXPECT_EQ(parent->children().back(), expecteds[index]); |
| } |
| } |