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 ui::ManagedDisplayInfo CreateDisplayInfo(int64_t id, const gfx::Rect& bounds) { |
30 DisplayInfo info(id, base::StringPrintf("x-%d", static_cast<int>(id)), false); | 30 ui::ManagedDisplayInfo info( |
| 31 id, base::StringPrintf("x-%d", static_cast<int>(id)), false); |
31 info.SetBounds(bounds); | 32 info.SetBounds(bounds); |
32 return info; | 33 return info; |
33 } | 34 } |
34 | 35 |
35 class MirrorOnBootTest : public test::AshTestBase { | 36 class MirrorOnBootTest : public test::AshTestBase { |
36 public: | 37 public: |
37 MirrorOnBootTest() {} | 38 MirrorOnBootTest() {} |
38 ~MirrorOnBootTest() override {} | 39 ~MirrorOnBootTest() override {} |
39 | 40 |
40 void SetUp() override { | 41 void SetUp() override { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 test_api.GetCursorHotPointLocationInRootWindow().ToString()); | 251 test_api.GetCursorHotPointLocationInRootWindow().ToString()); |
251 } | 252 } |
252 | 253 |
253 // Make sure that the compositor based mirroring can switch | 254 // Make sure that the compositor based mirroring can switch |
254 // from/to dock mode. | 255 // from/to dock mode. |
255 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { | 256 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { |
256 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 257 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
257 const int64_t internal_id = 1; | 258 const int64_t internal_id = 1; |
258 const int64_t external_id = 2; | 259 const int64_t external_id = 2; |
259 | 260 |
260 const DisplayInfo internal_display_info = | 261 const ui::ManagedDisplayInfo internal_display_info = |
261 CreateDisplayInfo(internal_id, gfx::Rect(0, 0, 500, 500)); | 262 CreateDisplayInfo(internal_id, gfx::Rect(0, 0, 500, 500)); |
262 const DisplayInfo external_display_info = | 263 const ui::ManagedDisplayInfo external_display_info = |
263 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100)); | 264 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100)); |
264 std::vector<DisplayInfo> display_info_list; | 265 std::vector<ui::ManagedDisplayInfo> display_info_list; |
265 | 266 |
266 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); | 267 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); |
267 | 268 |
268 // software mirroring. | 269 // software mirroring. |
269 display_info_list.push_back(internal_display_info); | 270 display_info_list.push_back(internal_display_info); |
270 display_info_list.push_back(external_display_info); | 271 display_info_list.push_back(external_display_info); |
271 display_manager->OnNativeDisplaysChanged(display_info_list); | 272 display_manager->OnNativeDisplaysChanged(display_info_list); |
272 const int64_t internal_display_id = | 273 const int64_t internal_display_id = |
273 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); | 274 test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay(); |
274 EXPECT_EQ(internal_id, internal_display_id); | 275 EXPECT_EQ(internal_id, internal_display_id); |
(...skipping 23 matching lines...) Expand all Loading... |
298 | 299 |
299 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { | 300 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { |
300 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 301 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
301 EXPECT_TRUE(display_manager->IsInMirrorMode()); | 302 EXPECT_TRUE(display_manager->IsInMirrorMode()); |
302 RunAllPendingInMessageLoop(); | 303 RunAllPendingInMessageLoop(); |
303 test::MirrorWindowTestApi test_api; | 304 test::MirrorWindowTestApi test_api; |
304 EXPECT_TRUE(test_api.GetHost()); | 305 EXPECT_TRUE(test_api.GetHost()); |
305 } | 306 } |
306 | 307 |
307 } // namespace ash | 308 } // namespace ash |
OLD | NEW |