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

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

Issue 2839743002: Wires up WindowTreeClient::SetDisplayRoot() (Closed)
Patch Set: add .cc Created 3 years, 8 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
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 WindowTreeClientPrivate(window_tree_client_impl()) 2087 WindowTreeClientPrivate(window_tree_client_impl())
2088 .CallWmNewDisplayAdded(display, std::move(root_data), parent_drawn); 2088 .CallWmNewDisplayAdded(display, std::move(root_data), parent_drawn);
2089 EXPECT_EQ(display.bounds(), window_tree_host->GetBoundsInPixels()); 2089 EXPECT_EQ(display.bounds(), window_tree_host->GetBoundsInPixels());
2090 // The root window of the WindowTreeHost always has an origin of 0,0. 2090 // The root window of the WindowTreeHost always has an origin of 0,0.
2091 EXPECT_EQ(gfx::Rect(display.bounds().size()), 2091 EXPECT_EQ(gfx::Rect(display.bounds().size()),
2092 window_tree_host->window()->bounds()); 2092 window_tree_host->window()->bounds());
2093 EXPECT_TRUE(window_tree_host->window()->IsVisible()); 2093 EXPECT_TRUE(window_tree_host->window()->IsVisible());
2094 EXPECT_EQ(display.id(), window_tree_host->display_id()); 2094 EXPECT_EQ(display.id(), window_tree_host->display_id());
2095 } 2095 }
2096 2096
2097 TEST_F(WindowTreeClientWmTest, ManuallyCreateDisplay) {
2098 const gfx::Rect bounds(1, 2, 101, 102);
2099 std::unique_ptr<DisplayInitParams> display_params =
2100 base::MakeUnique<DisplayInitParams>();
2101 display_params->display = base::MakeUnique<display::Display>(201);
2102 display_params->display->set_bounds(bounds);
2103 display_params->viewport_metrics.bounds_in_pixels = bounds;
2104 display_params->viewport_metrics.device_scale_factor = 1.0f;
2105 display_params->viewport_metrics.ui_scale_factor = 1.0f;
2106 WindowTreeHostMusInitParams init_params =
2107 WindowTreeClientPrivate(window_tree_client_impl())
2108 .CallCreateInitParamsForNewDisplay();
2109 init_params.display_init_params = std::move(display_params);
2110 WindowTreeHostMus window_tree_host(std::move(init_params));
2111 window_tree_host.InitHost();
2112 EXPECT_EQ(bounds, window_tree_host.GetBoundsInPixels());
2113 EXPECT_EQ(gfx::Rect(bounds.size()), window_tree_host.window()->bounds());
2114 }
2115
2097 TEST_F(WindowTreeClientWmTestHighDPI, SetBounds) { 2116 TEST_F(WindowTreeClientWmTestHighDPI, SetBounds) {
2098 const gfx::Rect original_bounds(root_window()->bounds()); 2117 const gfx::Rect original_bounds(root_window()->bounds());
2099 const gfx::Rect new_bounds(gfx::Rect(0, 0, 100, 100)); 2118 const gfx::Rect new_bounds(gfx::Rect(0, 0, 100, 100));
2100 ASSERT_NE(new_bounds, root_window()->bounds()); 2119 ASSERT_NE(new_bounds, root_window()->bounds());
2101 root_window()->SetBounds(new_bounds); 2120 root_window()->SetBounds(new_bounds);
2102 EXPECT_EQ(new_bounds, root_window()->bounds()); 2121 EXPECT_EQ(new_bounds, root_window()->bounds());
2103 2122
2104 // Simulate the server responding with a bounds change. Server should operate 2123 // Simulate the server responding with a bounds change. Server should operate
2105 // in pixels. 2124 // in pixels.
2106 const gfx::Rect server_changed_bounds(gfx::Rect(0, 0, 200, 200)); 2125 const gfx::Rect server_changed_bounds(gfx::Rect(0, 0, 200, 200));
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 window_tree()->GetEventResult(event_id)); 2254 window_tree()->GetEventResult(event_id));
2236 EXPECT_TRUE(window_delegate1.got_move()); 2255 EXPECT_TRUE(window_delegate1.got_move());
2237 EXPECT_FALSE(window_delegate2.got_move()); 2256 EXPECT_FALSE(window_delegate2.got_move());
2238 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, 2257 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20,
2239 event_location_in_dip.y() + 30); 2258 event_location_in_dip.y() + 30);
2240 EXPECT_EQ(transformed_event_location_in_dip, 2259 EXPECT_EQ(transformed_event_location_in_dip,
2241 window_delegate1.last_event_location()); 2260 window_delegate1.last_event_location());
2242 } 2261 }
2243 2262
2244 } // namespace aura 2263 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698