| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/display/chromeos/display_configurator.h" | 5 #include "ui/display/manager/chromeos/display_configurator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/display/chromeos/test/action_logger_util.h" | |
| 17 #include "ui/display/chromeos/test/test_native_display_delegate.h" | |
| 18 #include "ui/display/fake_display_snapshot.h" | 16 #include "ui/display/fake_display_snapshot.h" |
| 17 #include "ui/display/manager/chromeos/test/action_logger_util.h" |
| 18 #include "ui/display/manager/chromeos/test/test_native_display_delegate.h" |
| 19 #include "ui/display/util/display_util.h" | 19 #include "ui/display/util/display_util.h" |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 namespace test { | 22 namespace test { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 int64_t kDisplayIds[3] = {123, 456, 789}; | 26 int64_t kDisplayIds[3] = {123, 456, 789}; |
| 27 | 27 |
| 28 std::unique_ptr<ui::DisplayMode> MakeDisplayMode(int width, | 28 std::unique_ptr<ui::DisplayMode> MakeDisplayMode(int width, |
| (...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 log_->GetActionsAndClear()); | 1733 log_->GetActionsAndClear()); |
| 1734 } | 1734 } |
| 1735 | 1735 |
| 1736 TEST_F(DisplayConfiguratorTest, ExternalControl) { | 1736 TEST_F(DisplayConfiguratorTest, ExternalControl) { |
| 1737 InitWithSingleOutput(); | 1737 InitWithSingleOutput(); |
| 1738 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_SINGLE); | 1738 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_SINGLE); |
| 1739 configurator_.RelinquishControl( | 1739 configurator_.RelinquishControl( |
| 1740 base::Bind(&DisplayConfiguratorTest::OnDisplayControlUpdated, | 1740 base::Bind(&DisplayConfiguratorTest::OnDisplayControlUpdated, |
| 1741 base::Unretained(this))); | 1741 base::Unretained(this))); |
| 1742 EXPECT_EQ(CALLBACK_SUCCESS, PopDisplayControlResult()); | 1742 EXPECT_EQ(CALLBACK_SUCCESS, PopDisplayControlResult()); |
| 1743 EXPECT_EQ( | 1743 EXPECT_EQ(JoinActions( |
| 1744 JoinActions( | 1744 kGrab, GetFramebufferAction(small_mode_.size(), |
| 1745 kGrab, | 1745 outputs_[0].get(), nullptr) |
| 1746 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) | 1746 .c_str(), |
| 1747 .c_str(), | 1747 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), |
| 1748 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), | 1748 kUngrab, kRelinquishDisplayControl, nullptr), |
| 1749 kUngrab, kRelinquishDisplayControl, nullptr), | 1749 log_->GetActionsAndClear()); |
| 1750 log_->GetActionsAndClear()); | |
| 1751 configurator_.TakeControl( | 1750 configurator_.TakeControl( |
| 1752 base::Bind(&DisplayConfiguratorTest::OnDisplayControlUpdated, | 1751 base::Bind(&DisplayConfiguratorTest::OnDisplayControlUpdated, |
| 1753 base::Unretained(this))); | 1752 base::Unretained(this))); |
| 1754 EXPECT_EQ(CALLBACK_SUCCESS, PopDisplayControlResult()); | 1753 EXPECT_EQ(CALLBACK_SUCCESS, PopDisplayControlResult()); |
| 1755 EXPECT_EQ( | 1754 EXPECT_EQ( |
| 1756 JoinActions( | 1755 JoinActions( |
| 1757 kTakeDisplayControl, kGrab, | 1756 kTakeDisplayControl, kGrab, |
| 1758 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) | 1757 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) |
| 1759 .c_str(), | 1758 .c_str(), |
| 1760 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1759 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 configurator_.ResumeDisplays(); | 2172 configurator_.ResumeDisplays(); |
| 2174 EXPECT_EQ(kLongDelay, config_waiter_.Wait()); | 2173 EXPECT_EQ(kLongDelay, config_waiter_.Wait()); |
| 2175 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, | 2174 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON, |
| 2176 configurator_.current_power_state()); | 2175 configurator_.current_power_state()); |
| 2177 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED, | 2176 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED, |
| 2178 configurator_.display_state()); | 2177 configurator_.display_state()); |
| 2179 } | 2178 } |
| 2180 | 2179 |
| 2181 } // namespace test | 2180 } // namespace test |
| 2182 } // namespace ui | 2181 } // namespace ui |
| OLD | NEW |