| OLD | NEW |
| 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/display/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/display/display_info.h" | 11 #include "ash/common/display/display_info.h" |
| 11 #include "ash/common/material_design/material_design_controller.h" | 12 #include "ash/common/material_design/material_design_controller.h" |
| 12 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
| 15 #include "ash/common/wm/wm_screen_util.h" |
| 14 #include "ash/display/display_layout_store.h" | 16 #include "ash/display/display_layout_store.h" |
| 15 #include "ash/display/display_manager.h" | 17 #include "ash/display/display_manager.h" |
| 16 #include "ash/display/display_util.h" | 18 #include "ash/display/display_util.h" |
| 17 #include "ash/screen_util.h" | 19 #include "ash/screen_util.h" |
| 18 #include "ash/shelf/shelf.h" | 20 #include "ash/shelf/shelf.h" |
| 19 #include "ash/shelf/shelf_widget.h" | 21 #include "ash/shelf/shelf_widget.h" |
| 20 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 21 #include "ash/test/ash_md_test_base.h" | 23 #include "ash/test/ash_md_test_base.h" |
| 22 #include "ash/test/ash_test_base.h" | 24 #include "ash/test/ash_test_base.h" |
| 23 #include "ash/test/ash_test_helper.h" | 25 #include "ash/test/ash_test_helper.h" |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 namespace { | 1292 namespace { |
| 1291 | 1293 |
| 1292 class RootWindowTestObserver : public aura::WindowObserver { | 1294 class RootWindowTestObserver : public aura::WindowObserver { |
| 1293 public: | 1295 public: |
| 1294 RootWindowTestObserver() {} | 1296 RootWindowTestObserver() {} |
| 1295 ~RootWindowTestObserver() override {} | 1297 ~RootWindowTestObserver() override {} |
| 1296 | 1298 |
| 1297 void OnWindowBoundsChanged(aura::Window* window, | 1299 void OnWindowBoundsChanged(aura::Window* window, |
| 1298 const gfx::Rect& old_bounds, | 1300 const gfx::Rect& old_bounds, |
| 1299 const gfx::Rect& new_bounds) override { | 1301 const gfx::Rect& new_bounds) override { |
| 1300 shelf_display_bounds_ = ScreenUtil::GetShelfDisplayBoundsInRoot(window); | 1302 shelf_display_bounds_ = |
| 1303 wm::GetDisplayBoundsWithShelf(WmWindowAura::Get(window)); |
| 1301 } | 1304 } |
| 1302 | 1305 |
| 1303 const gfx::Rect& shelf_display_bounds() const { | 1306 const gfx::Rect& shelf_display_bounds() const { |
| 1304 return shelf_display_bounds_; | 1307 return shelf_display_bounds_; |
| 1305 } | 1308 } |
| 1306 | 1309 |
| 1307 private: | 1310 private: |
| 1308 gfx::Rect shelf_display_bounds_; | 1311 gfx::Rect shelf_display_bounds_; |
| 1309 | 1312 |
| 1310 DISALLOW_COPY_AND_ASSIGN(RootWindowTestObserver); | 1313 DISALLOW_COPY_AND_ASSIGN(RootWindowTestObserver); |
| 1311 }; | 1314 }; |
| 1312 | 1315 |
| 1313 } // names | 1316 } // names |
| 1314 | 1317 |
| 1315 // Make sure that GetShelfDisplayBoundsInRoot returns the correct bounds | 1318 // Make sure that GetDisplayBoundsWithShelf returns the correct bounds |
| 1316 // when primary display gets replaced in a following scenario. | 1319 // when the primary display gets replaced in one of the following scenarios: |
| 1317 // 1) Two displays connected: a) b) | 1320 // 1) Two displays connected: a) b) |
| 1318 // 2) both are disconnected and new one with the same size as b) is connected | 1321 // 2) both are disconnected and new one with the same size as b) is connected |
| 1319 // in one configuration event. | 1322 // in one configuration event. |
| 1320 // See crbug.com/547280. | 1323 // See crbug.com/547280. |
| 1321 TEST_P(WindowTreeHostManagerTest, ReplacePrimary) { | 1324 TEST_P(WindowTreeHostManagerTest, ReplacePrimary) { |
| 1322 if (!SupportsMultipleDisplays()) | 1325 if (!SupportsMultipleDisplays()) |
| 1323 return; | 1326 return; |
| 1324 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 1327 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 1325 | 1328 |
| 1326 DisplayInfo first_display_info = | 1329 DisplayInfo first_display_info = |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 widget->GetNativeWindow()->GetRootWindow()); | 1527 widget->GetNativeWindow()->GetRootWindow()); |
| 1525 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); | 1528 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); |
| 1526 | 1529 |
| 1527 UpdateDisplay("300x300"); | 1530 UpdateDisplay("300x300"); |
| 1528 watcher.Stop(); | 1531 watcher.Stop(); |
| 1529 | 1532 |
| 1530 widget->CloseNow(); | 1533 widget->CloseNow(); |
| 1531 } | 1534 } |
| 1532 | 1535 |
| 1533 } // namespace ash | 1536 } // namespace ash |
| OLD | NEW |