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

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

Issue 2355063002: Separate ash::test::DisplayManagerTestApi from ash (Closed)
Patch Set: review comment Created 4 years, 2 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/shelf/shelf_button.h" 8 #include "ash/common/shelf/shelf_button.h"
9 #include "ash/common/shelf/shelf_layout_manager.h" 9 #include "ash/common/shelf/shelf_layout_manager.h"
10 #include "ash/common/shelf/shelf_model.h" 10 #include "ash/common/shelf/shelf_model.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); 306 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get()));
307 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get())); 307 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get()));
308 } 308 }
309 309
310 // Tests for crashes during undocking. 310 // Tests for crashes during undocking.
311 // See https://crbug.com/632755 311 // See https://crbug.com/632755
312 TEST_F(PanelLayoutManagerTest, UndockTest) { 312 TEST_F(PanelLayoutManagerTest, UndockTest) {
313 std::vector<display::ManagedDisplayInfo> info_list; 313 std::vector<display::ManagedDisplayInfo> info_list;
314 314
315 const int64_t internal_display_id = 315 const int64_t internal_display_id =
316 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 316 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager())
317 .SetFirstDisplayAsInternalDisplay();
317 318
318 // Create the primary display info. 319 // Create the primary display info.
319 display::ManagedDisplayInfo internal_display = 320 display::ManagedDisplayInfo internal_display =
320 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720)); 321 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720));
321 // Create the secondary external display info. This will be docked display. 322 // Create the secondary external display info. This will be docked display.
322 display::ManagedDisplayInfo external_display_info = 323 display::ManagedDisplayInfo external_display_info =
323 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080)); 324 CreateDisplayInfo(2, gfx::Rect(0, 0, 1920, 1080));
324 325
325 info_list.push_back(external_display_info); 326 info_list.push_back(external_display_info);
326 // Docked state. 327 // Docked state.
327 display_manager()->OnNativeDisplaysChanged(info_list); 328 display_manager()->OnNativeDisplaysChanged(info_list);
328 329
329 // Create a panel in the docked state 330 // Create a panel in the docked state
330 std::unique_ptr<aura::Window> p1_d2( 331 std::unique_ptr<aura::Window> p1_d2(
331 CreatePanelWindow(gfx::Rect(1555, 800, 50, 50))); 332 CreatePanelWindow(gfx::Rect(1555, 800, 50, 50)));
332 333
333 info_list.clear(); 334 info_list.clear();
334 info_list.push_back(internal_display); 335 info_list.push_back(internal_display);
335 336
336 // Undock and bring back the native device display as primary display. 337 // Undock and bring back the native device display as primary display.
337 display_manager()->OnNativeDisplaysChanged(info_list); 338 display_manager()->OnNativeDisplaysChanged(info_list);
338 } 339 }
339 340
340 // Tests for any crash during docking and then undocking. 341 // Tests for any crash during docking and then undocking.
341 // See https://crbug.com/632755 342 // See https://crbug.com/632755
342 TEST_F(PanelLayoutManagerTest, DockUndockTest) { 343 TEST_F(PanelLayoutManagerTest, DockUndockTest) {
343 std::vector<display::ManagedDisplayInfo> info_list; 344 std::vector<display::ManagedDisplayInfo> info_list;
344 345
345 const int64_t internal_display_id = 346 const int64_t internal_display_id =
346 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); 347 test::DisplayManagerTestApi(Shell::GetInstance()->display_manager())
348 .SetFirstDisplayAsInternalDisplay();
347 349
348 // Create the primary display info. 350 // Create the primary display info.
349 display::ManagedDisplayInfo internal_display = 351 display::ManagedDisplayInfo internal_display =
350 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720)); 352 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 1280, 720));
351 353
352 info_list.push_back(internal_display); 354 info_list.push_back(internal_display);
353 display_manager()->OnNativeDisplaysChanged(info_list); 355 display_manager()->OnNativeDisplaysChanged(info_list);
354 356
355 // Create a panel in the undocked state. 357 // Create a panel in the undocked state.
356 std::unique_ptr<aura::Window> p1_d2( 358 std::unique_ptr<aura::Window> p1_d2(
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 913 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5));
912 target = targeter->FindTargetForEvent(root, &touch); 914 target = targeter->FindTargetForEvent(root, &touch);
913 EXPECT_NE(w.get(), target); 915 EXPECT_NE(w.get(), target);
914 } 916 }
915 917
916 INSTANTIATE_TEST_CASE_P(LtrRtl, 918 INSTANTIATE_TEST_CASE_P(LtrRtl,
917 PanelLayoutManagerTextDirectionTest, 919 PanelLayoutManagerTextDirectionTest,
918 testing::Bool()); 920 testing::Bool());
919 921
920 } // namespace ash 922 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_unittest.cc ('k') | ash/wm/system_gesture_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698