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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/rotator/screen_rotation_animation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <memory>
8
7 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
8 #include "ash/session/session_state_delegate.h" 10 #include "ash/session/session_state_delegate.h"
9 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 12 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
12 #include "ash/system/tray/system_tray_delegate.h" 14 #include "ash/system/tray/system_tray_delegate.h"
13 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
14 #include "ash/test/display_manager_test_api.h" 16 #include "ash/test/display_manager_test_api.h"
15 #include "ash/wm/system_modal_container_layout_manager.h" 17 #include "ash/wm/system_modal_container_layout_manager.h"
16 #include "ash/wm/window_properties.h" 18 #include "ash/wm/window_properties.h"
17 #include "ash/wm/window_state.h" 19 #include "ash/wm/window_state.h"
18 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
19 #include "base/command_line.h" 21 #include "base/command_line.h"
20 #include "base/memory/scoped_ptr.h"
21 #include "ui/aura/client/focus_change_observer.h" 22 #include "ui/aura/client/focus_change_observer.h"
22 #include "ui/aura/client/focus_client.h" 23 #include "ui/aura/client/focus_client.h"
23 #include "ui/aura/client/window_tree_client.h" 24 #include "ui/aura/client/window_tree_client.h"
24 #include "ui/aura/env.h" 25 #include "ui/aura/env.h"
25 #include "ui/aura/test/test_window_delegate.h" 26 #include "ui/aura/test/test_window_delegate.h"
26 #include "ui/aura/test/test_windows.h" 27 #include "ui/aura/test/test_windows.h"
27 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
28 #include "ui/aura/window_event_dispatcher.h" 29 #include "ui/aura/window_event_dispatcher.h"
29 #include "ui/aura/window_tracker.h" 30 #include "ui/aura/window_tracker.h"
30 #include "ui/base/ime/dummy_text_input_client.h" 31 #include "ui/base/ime/dummy_text_input_client.h"
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 // 'right' is centered in the context menu. 945 // 'right' is centered in the context menu.
945 int window_height = keyboard_bounds.bottom(); 946 int window_height = keyboard_bounds.bottom();
946 int window_width = keyboard_bounds.width() / 2; 947 int window_width = keyboard_bounds.width() / 2;
947 int left = window_width / 2; 948 int left = window_width / 2;
948 int right = 3 * window_width / 2; 949 int right = 3 * window_width / 2;
949 int top = keyboard_bounds.y() / 2; 950 int top = keyboard_bounds.y() / 2;
950 int bottom = window_height - keyboard_height / 2; 951 int bottom = window_height - keyboard_height / 2;
951 952
952 // Normal window is partially occluded by the virtual keyboard. 953 // Normal window is partially occluded by the virtual keyboard.
953 aura::test::TestWindowDelegate delegate; 954 aura::test::TestWindowDelegate delegate;
954 scoped_ptr<aura::Window> normal(CreateTestWindowInShellWithDelegateAndType( 955 std::unique_ptr<aura::Window> normal(
955 &delegate, 956 CreateTestWindowInShellWithDelegateAndType(
956 ui::wm::WINDOW_TYPE_NORMAL, 957 &delegate, ui::wm::WINDOW_TYPE_NORMAL, 0,
957 0, 958 gfx::Rect(0, 0, window_width, window_height)));
958 gfx::Rect(0, 0, window_width, window_height)));
959 normal->set_owned_by_parent(false); 959 normal->set_owned_by_parent(false);
960 normal->Show(); 960 normal->Show();
961 TargetHitTestEventHandler normal_handler; 961 TargetHitTestEventHandler normal_handler;
962 normal->AddPreTargetHandler(&normal_handler); 962 normal->AddPreTargetHandler(&normal_handler);
963 963
964 // Test that only the click on the top portion of the window is picked up. The 964 // Test that only the click on the top portion of the window is picked up. The
965 // click on the bottom hits the virtual keyboard instead. 965 // click on the bottom hits the virtual keyboard instead.
966 generator.MoveMouseTo(left, top); 966 generator.MoveMouseTo(left, top);
967 generator.ClickLeftButton(); 967 generator.ClickLeftButton();
968 EXPECT_EQ(1, normal_handler.num_mouse_events()); 968 EXPECT_EQ(1, normal_handler.num_mouse_events());
969 generator.MoveMouseTo(left, bottom); 969 generator.MoveMouseTo(left, bottom);
970 generator.ClickLeftButton(); 970 generator.ClickLeftButton();
971 EXPECT_EQ(1, normal_handler.num_mouse_events()); 971 EXPECT_EQ(1, normal_handler.num_mouse_events());
972 972
973 // Menu overlaps virtual keyboard. 973 // Menu overlaps virtual keyboard.
974 aura::test::TestWindowDelegate delegate2; 974 aura::test::TestWindowDelegate delegate2;
975 scoped_ptr<aura::Window> menu(CreateTestWindowInShellWithDelegateAndType( 975 std::unique_ptr<aura::Window> menu(CreateTestWindowInShellWithDelegateAndType(
976 &delegate2, 976 &delegate2, ui::wm::WINDOW_TYPE_MENU, 0,
977 ui::wm::WINDOW_TYPE_MENU,
978 0,
979 gfx::Rect(window_width, 0, window_width, window_height))); 977 gfx::Rect(window_width, 0, window_width, window_height)));
980 menu->set_owned_by_parent(false); 978 menu->set_owned_by_parent(false);
981 menu->Show(); 979 menu->Show();
982 TargetHitTestEventHandler menu_handler; 980 TargetHitTestEventHandler menu_handler;
983 menu->AddPreTargetHandler(&menu_handler); 981 menu->AddPreTargetHandler(&menu_handler);
984 982
985 // Test that both clicks register. 983 // Test that both clicks register.
986 generator.MoveMouseTo(right, top); 984 generator.MoveMouseTo(right, top);
987 generator.ClickLeftButton(); 985 generator.ClickLeftButton();
988 EXPECT_EQ(1, menu_handler.num_mouse_events()); 986 EXPECT_EQ(1, menu_handler.num_mouse_events());
(...skipping 28 matching lines...) Expand all
1017 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1015 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1018 gfx::Rect(0, 400, 800, 200)); 1016 gfx::Rect(0, 400, 800, 200));
1019 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1017 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1020 1018
1021 UpdateDisplay("600x800"); 1019 UpdateDisplay("600x800");
1022 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1020 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1023 } 1021 }
1024 1022
1025 } // namespace test 1023 } // namespace test
1026 } // namespace ash 1024 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/rotator/screen_rotation_animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698