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

Side by Side Diff: ui/aura/mus/window_tree_client_unittest.cc

Issue 2472983004: Fixs bug in notifying clients about hierarchy changes (Closed)
Patch Set: cleanup Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_tree_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 window.SetProperty(client::kModalKey, ui::MODAL_TYPE_WINDOW); 1112 window.SetProperty(client::kModalKey, ui::MODAL_TYPE_WINDOW);
1113 // Ack change as succeeding. 1113 // Ack change as succeeding.
1114 ASSERT_TRUE( 1114 ASSERT_TRUE(
1115 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, true)); 1115 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, true));
1116 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, window.GetProperty(client::kModalKey)); 1116 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, window.GetProperty(client::kModalKey));
1117 // There should be no more modal changes. 1117 // There should be no more modal changes.
1118 EXPECT_FALSE( 1118 EXPECT_FALSE(
1119 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false)); 1119 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false));
1120 } 1120 }
1121 1121
1122 // Verifies OnWindowHierarchyChanged() deals correctly with identifying existing
1123 // windows.
1124 TEST_F(WindowTreeClientWmTest, OnWindowHierarchyChangedWithExistingWindow) {
1125 Window* window1 = new Window(nullptr);
1126 window1->Init(ui::LAYER_NOT_DRAWN);
1127 Window* window2 = new Window(nullptr);
1128 window2->Init(ui::LAYER_NOT_DRAWN);
1129 window_tree()->AckAllChanges();
1130 const Id server_window_id = server_id(root_window()) + 11;
1131 ui::mojom::WindowDataPtr data1 = ui::mojom::WindowData::New();
1132 ui::mojom::WindowDataPtr data2 = ui::mojom::WindowData::New();
1133 ui::mojom::WindowDataPtr data3 = ui::mojom::WindowData::New();
1134 data1->parent_id = server_id(root_window());
1135 data1->window_id = server_window_id;
1136 data1->bounds = gfx::Rect(1, 2, 3, 4);
1137 data2->parent_id = server_window_id;
1138 data2->window_id = WindowMus::Get(window1)->server_id();
1139 data2->bounds = gfx::Rect(1, 2, 3, 4);
1140 data3->parent_id = server_window_id;
1141 data3->window_id = WindowMus::Get(window2)->server_id();
1142 data3->bounds = gfx::Rect(1, 2, 3, 4);
1143 mojo::Array<ui::mojom::WindowDataPtr> data_array(3);
1144 data_array[0] = std::move(data1);
1145 data_array[1] = std::move(data2);
1146 data_array[2] = std::move(data3);
1147 window_tree_client()->OnWindowHierarchyChanged(
1148 server_window_id, 0, server_id(root_window()), std::move(data_array));
1149 ASSERT_FALSE(window_tree()->has_change());
1150 ASSERT_EQ(1u, root_window()->children().size());
1151 Window* server_window = root_window()->children()[0];
1152 EXPECT_EQ(window1->parent(), server_window);
1153 EXPECT_EQ(window2->parent(), server_window);
1154 ASSERT_EQ(2u, server_window->children().size());
1155 EXPECT_EQ(window1, server_window->children()[0]);
1156 EXPECT_EQ(window2, server_window->children()[1]);
1157 }
1158
1122 } // namespace aura 1159 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698