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

Side by Side Diff: ash/wm/panels/panel_layout_manager_unittest.cc

Issue 2270553002: Move ash::DisplayInfo to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build Created 4 years, 3 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 (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/common/wm/panels/panel_layout_manager.h" 5 #include "ash/common/wm/panels/panel_layout_manager.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/ash_switches.h" 8 #include "ash/common/ash_switches.h"
9 #include "ash/common/display/display_info.h"
10 #include "ash/common/shelf/shelf_button.h" 9 #include "ash/common/shelf/shelf_button.h"
11 #include "ash/common/shelf/shelf_layout_manager.h" 10 #include "ash/common/shelf/shelf_layout_manager.h"
12 #include "ash/common/shelf/shelf_model.h" 11 #include "ash/common/shelf/shelf_model.h"
13 #include "ash/common/shelf/shelf_types.h" 12 #include "ash/common/shelf/shelf_types.h"
14 #include "ash/common/shelf/shelf_view.h" 13 #include "ash/common/shelf/shelf_view.h"
15 #include "ash/common/shelf/shelf_widget.h" 14 #include "ash/common/shelf/shelf_widget.h"
16 #include "ash/common/shelf/wm_shelf.h" 15 #include "ash/common/shelf/wm_shelf.h"
17 #include "ash/common/shell_window_ids.h" 16 #include "ash/common/shell_window_ids.h"
18 #include "ash/common/system/web_notification/web_notification_tray.h" 17 #include "ash/common/system/web_notification/web_notification_tray.h"
19 #include "ash/common/wm/mru_window_tracker.h" 18 #include "ash/common/wm/mru_window_tracker.h"
(...skipping 13 matching lines...) Expand all
33 #include "ash/wm/window_util.h" 32 #include "ash/wm/window_util.h"
34 #include "base/command_line.h" 33 #include "base/command_line.h"
35 #include "base/compiler_specific.h" 34 #include "base/compiler_specific.h"
36 #include "base/i18n/rtl.h" 35 #include "base/i18n/rtl.h"
37 #include "base/run_loop.h" 36 #include "base/run_loop.h"
38 #include "base/strings/string_number_conversions.h" 37 #include "base/strings/string_number_conversions.h"
39 #include "ui/aura/client/aura_constants.h" 38 #include "ui/aura/client/aura_constants.h"
40 #include "ui/aura/test/test_windows.h" 39 #include "ui/aura/test/test_windows.h"
41 #include "ui/aura/window.h" 40 #include "ui/aura/window.h"
42 #include "ui/aura/window_event_dispatcher.h" 41 #include "ui/aura/window_event_dispatcher.h"
42 #include "ui/display/manager/managed_display_info.h"
43 #include "ui/events/event_utils.h" 43 #include "ui/events/event_utils.h"
44 #include "ui/events/test/event_generator.h" 44 #include "ui/events/test/event_generator.h"
45 #include "ui/views/widget/widget.h" 45 #include "ui/views/widget/widget.h"
46 46
47 namespace ash { 47 namespace ash {
48 48
49 namespace { 49 namespace {
50 50
51 std::string ToDisplayName(int64_t id) { 51 std::string ToDisplayName(int64_t id) {
52 return "x-" + base::Int64ToString(id); 52 return "x-" + base::Int64ToString(id);
53 } 53 }
54 54
55 DisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) { 55 ui::ManagedDisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) {
56 DisplayInfo info(id, ToDisplayName(id), false); 56 ui::ManagedDisplayInfo info(id, ToDisplayName(id), false);
57 info.SetBounds(bounds); 57 info.SetBounds(bounds);
58 return info; 58 return info;
59 } 59 }
60 60
61 DisplayManager* display_manager() { 61 DisplayManager* display_manager() {
62 return Shell::GetInstance()->display_manager(); 62 return Shell::GetInstance()->display_manager();
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 gfx::Rect bounds(0, 0, 201, 201); 305 gfx::Rect bounds(0, 0, 201, 201);
306 std::unique_ptr<aura::Window> window(CreatePanelWindow(bounds)); 306 std::unique_ptr<aura::Window> window(CreatePanelWindow(bounds));
307 EXPECT_EQ(GetPanelContainer(window.get()), window->parent()); 307 EXPECT_EQ(GetPanelContainer(window.get()), window->parent());
308 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); 308 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get()));
309 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get())); 309 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get()));
310 } 310 }
311 311
312 // Tests for crashes during undocking. 312 // Tests for crashes during undocking.
313 // See https://crbug.com/632755 313 // See https://crbug.com/632755
314 TEST_F(PanelLayoutManagerTest, UndockTest) { 314 TEST_F(PanelLayoutManagerTest, UndockTest) {
315 std::vector<DisplayInfo> info_list; 315 std::vector<ui::ManagedDisplayInfo> info_list;
316 316
317 const int64_t internal_display_id = 317 const int64_t internal_display_id =
318 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 318 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
319 319
320 // Create the primary display info. 320 // Create the primary display info.
321 DisplayInfo internal_display = 321 ui::ManagedDisplayInfo internal_display =
322 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720)); 322 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720));
323 // Create the secondary external display info. This will be docked display. 323 // Create the secondary external display info. This will be docked display.
324 DisplayInfo external_display_info = 324 ui::ManagedDisplayInfo external_display_info =
325 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080)); 325 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080));
326 326
327 info_list.push_back(external_display_info); 327 info_list.push_back(external_display_info);
328 // Docked state. 328 // Docked state.
329 display_manager()->OnNativeDisplaysChanged(info_list); 329 display_manager()->OnNativeDisplaysChanged(info_list);
330 330
331 // Create a panel in the docked state 331 // Create a panel in the docked state
332 std::unique_ptr<aura::Window> p1_d2( 332 std::unique_ptr<aura::Window> p1_d2(
333 CreatePanelWindow(gfx::Rect(1555, 800, 50, 50))); 333 CreatePanelWindow(gfx::Rect(1555, 800, 50, 50)));
334 334
335 info_list.clear(); 335 info_list.clear();
336 info_list.push_back(internal_display); 336 info_list.push_back(internal_display);
337 337
338 // Undock and bring back the native device display as primary display. 338 // Undock and bring back the native device display as primary display.
339 display_manager()->OnNativeDisplaysChanged(info_list); 339 display_manager()->OnNativeDisplaysChanged(info_list);
340 } 340 }
341 341
342 // Tests for any crash during docking and then undocking. 342 // Tests for any crash during docking and then undocking.
343 // See https://crbug.com/632755 343 // See https://crbug.com/632755
344 TEST_F(PanelLayoutManagerTest, DockUndockTest) { 344 TEST_F(PanelLayoutManagerTest, DockUndockTest) {
345 std::vector<DisplayInfo> info_list; 345 std::vector<ui::ManagedDisplayInfo> info_list;
346 346
347 const int64_t internal_display_id = 347 const int64_t internal_display_id =
348 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 348 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
349 349
350 // Create the primary display info. 350 // Create the primary display info.
351 DisplayInfo internal_display = 351 ui::ManagedDisplayInfo internal_display =
352 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720)); 352 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720));
353 353
354 info_list.push_back(internal_display); 354 info_list.push_back(internal_display);
355 display_manager()->OnNativeDisplaysChanged(info_list); 355 display_manager()->OnNativeDisplaysChanged(info_list);
356 356
357 // Create a panel in the undocked state. 357 // Create a panel in the undocked state.
358 std::unique_ptr<aura::Window> p1_d2( 358 std::unique_ptr<aura::Window> p1_d2(
359 CreatePanelWindow(gfx::Rect(600, 200, 50, 50))); 359 CreatePanelWindow(gfx::Rect(600, 200, 50, 50)));
360 360
361 // Create the secondary external display info. This will be docked display. 361 // Create the secondary external display info. This will be docked display.
362 DisplayInfo external_display_info = 362 ui::ManagedDisplayInfo external_display_info =
363 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080)); 363 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080));
364 364
365 info_list.push_back(external_display_info); 365 info_list.push_back(external_display_info);
366 // Adding external Display 366 // Adding external Display
367 display_manager()->OnNativeDisplaysChanged(info_list); 367 display_manager()->OnNativeDisplaysChanged(info_list);
368 368
369 info_list.clear(); 369 info_list.clear();
370 info_list.push_back(external_display_info); 370 info_list.push_back(external_display_info);
371 371
372 // Docked state. 372 // Docked state.
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 913 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5));
914 target = targeter->FindTargetForEvent(root, &touch); 914 target = targeter->FindTargetForEvent(root, &touch);
915 EXPECT_NE(w.get(), target); 915 EXPECT_NE(w.get(), target);
916 } 916 }
917 917
918 INSTANTIATE_TEST_CASE_P(LtrRtl, 918 INSTANTIATE_TEST_CASE_P(LtrRtl,
919 PanelLayoutManagerTextDirectionTest, 919 PanelLayoutManagerTextDirectionTest,
920 testing::Bool()); 920 testing::Bool());
921 921
922 } // namespace ash 922 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698