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

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: rebased 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 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id,
56 DisplayInfo info(id, ToDisplayName(id), false); 56 const gfx::Rect& bounds) {
57 display::ManagedDisplayInfo info(id, ToDisplayName(id), false);
57 info.SetBounds(bounds); 58 info.SetBounds(bounds);
58 return info; 59 return info;
59 } 60 }
60 61
61 DisplayManager* display_manager() { 62 DisplayManager* display_manager() {
62 return Shell::GetInstance()->display_manager(); 63 return Shell::GetInstance()->display_manager();
63 } 64 }
64 65
65 } // namespace 66 } // namespace
66 67
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 gfx::Rect bounds(0, 0, 201, 201); 305 gfx::Rect bounds(0, 0, 201, 201);
305 std::unique_ptr<aura::Window> window(CreatePanelWindow(bounds)); 306 std::unique_ptr<aura::Window> window(CreatePanelWindow(bounds));
306 EXPECT_EQ(GetPanelContainer(window.get()), window->parent()); 307 EXPECT_EQ(GetPanelContainer(window.get()), window->parent());
307 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); 308 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get()));
308 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get())); 309 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get()));
309 } 310 }
310 311
311 // Tests for crashes during undocking. 312 // Tests for crashes during undocking.
312 // See https://crbug.com/632755 313 // See https://crbug.com/632755
313 TEST_F(PanelLayoutManagerTest, UndockTest) { 314 TEST_F(PanelLayoutManagerTest, UndockTest) {
314 std::vector<DisplayInfo> info_list; 315 std::vector<display::ManagedDisplayInfo> info_list;
315 316
316 const int64_t internal_display_id = 317 const int64_t internal_display_id =
317 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 318 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
318 319
319 // Create the primary display info. 320 // Create the primary display info.
320 DisplayInfo internal_display = 321 display::ManagedDisplayInfo internal_display =
321 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720)); 322 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720));
322 // Create the secondary external display info. This will be docked display. 323 // Create the secondary external display info. This will be docked display.
323 DisplayInfo external_display_info = 324 display::ManagedDisplayInfo external_display_info =
324 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080)); 325 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080));
325 326
326 info_list.push_back(external_display_info); 327 info_list.push_back(external_display_info);
327 // Docked state. 328 // Docked state.
328 display_manager()->OnNativeDisplaysChanged(info_list); 329 display_manager()->OnNativeDisplaysChanged(info_list);
329 330
330 // Create a panel in the docked state 331 // Create a panel in the docked state
331 std::unique_ptr<aura::Window> p1_d2( 332 std::unique_ptr<aura::Window> p1_d2(
332 CreatePanelWindow(gfx::Rect(1555, 800, 50, 50))); 333 CreatePanelWindow(gfx::Rect(1555, 800, 50, 50)));
333 334
334 info_list.clear(); 335 info_list.clear();
335 info_list.push_back(internal_display); 336 info_list.push_back(internal_display);
336 337
337 // Undock and bring back the native device display as primary display. 338 // Undock and bring back the native device display as primary display.
338 display_manager()->OnNativeDisplaysChanged(info_list); 339 display_manager()->OnNativeDisplaysChanged(info_list);
339 } 340 }
340 341
341 // Tests for any crash during docking and then undocking. 342 // Tests for any crash during docking and then undocking.
342 // See https://crbug.com/632755 343 // See https://crbug.com/632755
343 TEST_F(PanelLayoutManagerTest, DockUndockTest) { 344 TEST_F(PanelLayoutManagerTest, DockUndockTest) {
344 std::vector<DisplayInfo> info_list; 345 std::vector<display::ManagedDisplayInfo> info_list;
345 346
346 const int64_t internal_display_id = 347 const int64_t internal_display_id =
347 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 348 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
348 349
349 // Create the primary display info. 350 // Create the primary display info.
350 DisplayInfo internal_display = 351 display::ManagedDisplayInfo internal_display =
351 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720)); 352 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720));
352 353
353 info_list.push_back(internal_display); 354 info_list.push_back(internal_display);
354 display_manager()->OnNativeDisplaysChanged(info_list); 355 display_manager()->OnNativeDisplaysChanged(info_list);
355 356
356 // Create a panel in the undocked state. 357 // Create a panel in the undocked state.
357 std::unique_ptr<aura::Window> p1_d2( 358 std::unique_ptr<aura::Window> p1_d2(
358 CreatePanelWindow(gfx::Rect(600, 200, 50, 50))); 359 CreatePanelWindow(gfx::Rect(600, 200, 50, 50)));
359 360
360 // Create the secondary external display info. This will be docked display. 361 // Create the secondary external display info. This will be docked display.
361 DisplayInfo external_display_info = 362 display::ManagedDisplayInfo external_display_info =
362 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080)); 363 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080));
363 364
364 info_list.push_back(external_display_info); 365 info_list.push_back(external_display_info);
365 // Adding external Display 366 // Adding external Display
366 display_manager()->OnNativeDisplaysChanged(info_list); 367 display_manager()->OnNativeDisplaysChanged(info_list);
367 368
368 info_list.clear(); 369 info_list.clear();
369 info_list.push_back(external_display_info); 370 info_list.push_back(external_display_info);
370 371
371 // Docked state. 372 // Docked state.
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 913 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5));
913 target = targeter->FindTargetForEvent(root, &touch); 914 target = targeter->FindTargetForEvent(root, &touch);
914 EXPECT_NE(w.get(), target); 915 EXPECT_NE(w.get(), target);
915 } 916 }
916 917
917 INSTANTIATE_TEST_CASE_P(LtrRtl, 918 INSTANTIATE_TEST_CASE_P(LtrRtl,
918 PanelLayoutManagerTextDirectionTest, 919 PanelLayoutManagerTextDirectionTest,
919 testing::Bool()); 920 testing::Bool());
920 921
921 } // namespace ash 922 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller_unittest.cc ('k') | chrome/browser/chromeos/display/display_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698