OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/mirror_window_controller.h" | 5 #include "ash/display/mirror_window_controller.h" |
6 | 6 |
7 #include "ash/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
13 #include "ash/test/cursor_manager_test_api.h" | 13 #include "ash/test/cursor_manager_test_api.h" |
14 #include "ash/test/display_manager_test_api.h" | 14 #include "ash/test/display_manager_test_api.h" |
15 #include "ash/test/mirror_window_test_api.h" | 15 #include "ash/test/mirror_window_test_api.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
19 #include "ui/aura/test/test_window_delegate.h" | 19 #include "ui/aura/test/test_window_delegate.h" |
20 #include "ui/aura/test/test_windows.h" | 20 #include "ui/aura/test/test_windows.h" |
21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
22 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
23 #include "ui/base/hit_test.h" | 23 #include "ui/base/hit_test.h" |
24 #include "ui/events/test/event_generator.h" | 24 #include "ui/events/test/event_generator.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 namespace { | 28 namespace { |
29 DisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) { | 29 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, |
30 DisplayInfo info(id, base::StringPrintf("x-%d", static_cast<int>(id)), false); | 30 const gfx::Rect& bounds) { |
| 31 display::ManagedDisplayInfo info( |
| 32 id, base::StringPrintf("x-%d", static_cast<int>(id)), false); |
31 info.SetBounds(bounds); | 33 info.SetBounds(bounds); |
32 return info; | 34 return info; |
33 } | 35 } |
34 | 36 |
35 class MirrorOnBootTest : public test::AshTestBase { | 37 class MirrorOnBootTest : public test::AshTestBase { |
36 public: | 38 public: |
37 MirrorOnBootTest() {} | 39 MirrorOnBootTest() {} |
38 ~MirrorOnBootTest() override {} | 40 ~MirrorOnBootTest() override {} |
39 | 41 |
40 void SetUp() override { | 42 void SetUp() override { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 test_api.GetCursorHotPointLocationInRootWindow().ToString()); | 252 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
251 } | 253 } |
252 | 254 |
253 // Make sure that the compositor based mirroring can switch | 255 // Make sure that the compositor based mirroring can switch |
254 // from/to dock mode. | 256 // from/to dock mode. |
255 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { | 257 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { |
256 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 258 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
257 const int64_t internal_id = 1; | 259 const int64_t internal_id = 1; |
258 const int64_t external_id = 2; | 260 const int64_t external_id = 2; |
259 | 261 |
260 const DisplayInfo internal_display_info = | 262 const display::ManagedDisplayInfo internal_display_info = |
261 CreateDisplayInfo(internal_id, gfx::Rect(0, 0, 500, 500)); | 263 CreateDisplayInfo(internal_id, gfx::Rect(0, 0, 500, 500)); |
262 const DisplayInfo external_display_info = | 264 const display::ManagedDisplayInfo external_display_info = |
263 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100)); | 265 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100)); |
264 std::vector<DisplayInfo> display_info_list; | 266 std::vector<display::ManagedDisplayInfo> display_info_list; |
265 | 267 |
266 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); | 268 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); |
267 | 269 |
268 // software mirroring. | 270 // software mirroring. |
269 display_info_list.push_back(internal_display_info); | 271 display_info_list.push_back(internal_display_info); |
270 display_info_list.push_back(external_display_info); | 272 display_info_list.push_back(external_display_info); |
271 display_manager->OnNativeDisplaysChanged(display_info_list); | 273 display_manager->OnNativeDisplaysChanged(display_info_list); |
272 const int64_t internal_display_id = | 274 const int64_t internal_display_id = |
273 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); | 275 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); |
274 EXPECT_EQ(internal_id, internal_display_id); | 276 EXPECT_EQ(internal_id, internal_display_id); |
(...skipping 23 matching lines...) Expand all Loading... |
298 | 300 |
299 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { | 301 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { |
300 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 302 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
301 EXPECT_TRUE(display_manager->IsInMirrorMode()); | 303 EXPECT_TRUE(display_manager->IsInMirrorMode()); |
302 RunAllPendingInMessageLoop(); | 304 RunAllPendingInMessageLoop(); |
303 test::MirrorWindowTestApi test_api; | 305 test::MirrorWindowTestApi test_api; |
304 EXPECT_TRUE(test_api.GetHost()); | 306 EXPECT_TRUE(test_api.GetHost()); |
305 } | 307 } |
306 | 308 |
307 } // namespace ash | 309 } // namespace ash |
OLD | NEW |