| 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" | |
| 8 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
| 10 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 11 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 12 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/cursor_manager_test_api.h" | 12 #include "ash/test/cursor_manager_test_api.h" |
| 14 #include "ash/test/display_manager_test_api.h" | 13 #include "ash/test/display_manager_test_api.h" |
| 15 #include "ash/test/mirror_window_test_api.h" | 14 #include "ash/test/mirror_window_test_api.h" |
| 16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 17 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 18 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
| 19 #include "ui/aura/test/test_window_delegate.h" | 18 #include "ui/aura/test/test_window_delegate.h" |
| 20 #include "ui/aura/test/test_windows.h" | 19 #include "ui/aura/test/test_windows.h" |
| 21 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 23 #include "ui/base/hit_test.h" | 22 #include "ui/base/hit_test.h" |
| 23 #include "ui/display/display_switches.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 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, | 29 display::ManagedDisplayInfo CreateDisplayInfo(int64_t id, |
| 30 const gfx::Rect& bounds) { | 30 const gfx::Rect& bounds) { |
| 31 display::ManagedDisplayInfo info( | 31 display::ManagedDisplayInfo info( |
| 32 id, base::StringPrintf("x-%d", static_cast<int>(id)), false); | 32 id, base::StringPrintf("x-%d", static_cast<int>(id)), false); |
| 33 info.SetBounds(bounds); | 33 info.SetBounds(bounds); |
| 34 return info; | 34 return info; |
| 35 } | 35 } |
| 36 | 36 |
| 37 class MirrorOnBootTest : public test::AshTestBase { | 37 class MirrorOnBootTest : public test::AshTestBase { |
| 38 public: | 38 public: |
| 39 MirrorOnBootTest() {} | 39 MirrorOnBootTest() {} |
| 40 ~MirrorOnBootTest() override {} | 40 ~MirrorOnBootTest() override {} |
| 41 | 41 |
| 42 void SetUp() override { | 42 void SetUp() override { |
| 43 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 43 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 44 switches::kAshHostWindowBounds, "1+1-300x300,1+301-300x300"); | 44 ::switches::kHostWindowBounds, "1+1-300x300,1+301-300x300"); |
| 45 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 45 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 46 switches::kAshEnableSoftwareMirroring); | 46 ::switches::kEnableSoftwareMirroring); |
| 47 test::AshTestBase::SetUp(); | 47 test::AshTestBase::SetUp(); |
| 48 } | 48 } |
| 49 void TearDown() override { test::AshTestBase::TearDown(); } | 49 void TearDown() override { test::AshTestBase::TearDown(); } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(MirrorOnBootTest); | 52 DISALLOW_COPY_AND_ASSIGN(MirrorOnBootTest); |
| 53 }; | 53 }; |
| 54 } | 54 } |
| 55 | 55 |
| 56 typedef test::AshTestBase MirrorWindowControllerTest; | 56 typedef test::AshTestBase MirrorWindowControllerTest; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { | 301 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { |
| 302 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 302 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 303 EXPECT_TRUE(display_manager->IsInMirrorMode()); | 303 EXPECT_TRUE(display_manager->IsInMirrorMode()); |
| 304 RunAllPendingInMessageLoop(); | 304 RunAllPendingInMessageLoop(); |
| 305 test::MirrorWindowTestApi test_api; | 305 test::MirrorWindowTestApi test_api; |
| 306 EXPECT_TRUE(test_api.GetHost()); | 306 EXPECT_TRUE(test_api.GetHost()); |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace ash | 309 } // namespace ash |
| OLD | NEW |