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

Side by Side Diff: ui/views/mus/native_widget_mus_unittest.cc

Issue 2524873002: Rename WindowTreeHost G|SetBounds to indicate they are in pixels. (Closed)
Patch Set: rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 5
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "services/ui/public/cpp/property_type_converters.h" 8 #include "services/ui/public/cpp/property_type_converters.h"
9 #include "services/ui/public/cpp/tests/window_tree_client_private.h" 9 #include "services/ui/public/cpp/tests/window_tree_client_private.h"
10 #include "services/ui/public/cpp/window.h" 10 #include "services/ui/public/cpp/window.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 widget->GetContentsView()->AddChildView(content); 523 widget->GetContentsView()->AddChildView(content);
524 NativeWidgetMus* native_widget = 524 NativeWidgetMus* native_widget =
525 static_cast<NativeWidgetMus*>(widget->native_widget_private()); 525 static_cast<NativeWidgetMus*>(widget->native_widget_private());
526 ui::Window* mus_window = native_widget->window(); 526 ui::Window* mus_window = native_widget->window();
527 527
528 gfx::Rect start_bounds = initial_bounds(); 528 gfx::Rect start_bounds = initial_bounds();
529 gfx::Rect end_bounds = gfx::Rect(40, 50, 60, 70); 529 gfx::Rect end_bounds = gfx::Rect(40, 50, 60, 70);
530 EXPECT_NE(start_bounds, end_bounds); 530 EXPECT_NE(start_bounds, end_bounds);
531 531
532 EXPECT_EQ(start_bounds, mus_window->bounds()); 532 EXPECT_EQ(start_bounds, mus_window->bounds());
533 EXPECT_EQ(start_bounds, native_widget->window_tree_host()->GetBounds()); 533 EXPECT_EQ(start_bounds,
534 native_widget->window_tree_host()->GetBoundsInPixels());
534 535
535 mus_window->SetBounds(end_bounds); 536 mus_window->SetBounds(end_bounds);
536 537
537 EXPECT_EQ(end_bounds, mus_window->bounds()); 538 EXPECT_EQ(end_bounds, mus_window->bounds());
538 539
539 // Main check for this test: Setting |mus_window| bounds while bypassing 540 // Main check for this test: Setting |mus_window| bounds while bypassing
540 // |native_widget| must update window_tree_host bounds. 541 // |native_widget| must update window_tree_host bounds.
541 EXPECT_EQ(end_bounds, native_widget->window_tree_host()->GetBounds()); 542 EXPECT_EQ(end_bounds, native_widget->window_tree_host()->GetBoundsInPixels());
542 } 543 }
543 544
544 // Verifies visibility of the aura::Window and ui::Window are updated when the 545 // Verifies visibility of the aura::Window and ui::Window are updated when the
545 // Widget is shown/hidden. 546 // Widget is shown/hidden.
546 TEST_F(NativeWidgetMusTest, TargetVisibility) { 547 TEST_F(NativeWidgetMusTest, TargetVisibility) {
547 std::unique_ptr<Widget> widget(CreateWidget(nullptr)); 548 std::unique_ptr<Widget> widget(CreateWidget(nullptr));
548 NativeWidgetMus* native_widget = 549 NativeWidgetMus* native_widget =
549 static_cast<NativeWidgetMus*>(widget->native_widget_private()); 550 static_cast<NativeWidgetMus*>(widget->native_widget_private());
550 ui::Window* mus_window = native_widget->window(); 551 ui::Window* mus_window = native_widget->window();
551 EXPECT_FALSE(mus_window->visible()); 552 EXPECT_FALSE(mus_window->visible());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 not_child_params.name = "Not Child Widget"; 672 not_child_params.name = "Not Child Widget";
672 not_child_params.native_widget = 673 not_child_params.native_widget =
673 new NativeWidgetMus(not_child_widget.get(), not_child_window, 674 new NativeWidgetMus(not_child_widget.get(), not_child_window,
674 ui::mojom::CompositorFrameSinkType::DEFAULT); 675 ui::mojom::CompositorFrameSinkType::DEFAULT);
675 not_child_widget->Init(not_child_params); 676 not_child_widget->Init(not_child_params);
676 677
677 EXPECT_NE(not_child_window->parent(), parent_window); 678 EXPECT_NE(not_child_window->parent(), parent_window);
678 } 679 }
679 680
680 } // namespace views 681 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698