Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1288)

Side by Side Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 2427843002: Delay display configuration after waking up from suspend with multi displays (Closed)
Patch Set: Comments and nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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"
(...skipping 15 matching lines...) Expand all
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,
29 int height, 29 int height,
30 bool is_interlaced, 30 bool is_interlaced,
31 float refresh_rate) { 31 float refresh_rate) {
32 return base::MakeUnique<ui::DisplayMode>(gfx::Size(width, height), 32 return base::MakeUnique<ui::DisplayMode>(gfx::Size(width, height),
33 is_interlaced, refresh_rate); 33 is_interlaced, refresh_rate);
34 } 34 }
35 35
36 enum CallbackResult {
37 CALLBACK_FAILURE,
38 CALLBACK_SUCCESS,
39 CALLBACK_NOT_CALLED,
40 };
41
42 // Expected immediate configurations should be done without any delays.
43 constexpr base::TimeDelta kNoDelay = base::TimeDelta::FromMilliseconds(0);
44
45 // The expected configuration delay when resuming from suspend while in 2+
46 // display mode.
47 constexpr base::TimeDelta kLongDelayMs = base::TimeDelta::FromMilliseconds(
Daniel Erat 2016/10/31 18:25:46 nit: rename to 'kLongDelay' (sorry, i gave a bad s
afakhry 2016/10/31 21:20:14 Done.
48 DisplayConfigurator::kResumeConfigureMultiDisplayDelayMs);
49
36 class TestObserver : public DisplayConfigurator::Observer { 50 class TestObserver : public DisplayConfigurator::Observer {
37 public: 51 public:
38 explicit TestObserver(DisplayConfigurator* configurator) 52 explicit TestObserver(DisplayConfigurator* configurator)
39 : configurator_(configurator) { 53 : configurator_(configurator) {
40 Reset(); 54 Reset();
41 configurator_->AddObserver(this); 55 configurator_->AddObserver(this);
42 } 56 }
43 ~TestObserver() override { configurator_->RemoveObserver(this); } 57 ~TestObserver() override { configurator_->RemoveObserver(this); }
44 58
45 int num_changes() const { return num_changes_; } 59 int num_changes() const { return num_changes_; }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 bool SoftwareMirroringEnabled() const override { 136 bool SoftwareMirroringEnabled() const override {
123 return software_mirroring_enabled_; 137 return software_mirroring_enabled_;
124 } 138 }
125 139
126 private: 140 private:
127 bool software_mirroring_enabled_; 141 bool software_mirroring_enabled_;
128 142
129 DISALLOW_COPY_AND_ASSIGN(TestMirroringController); 143 DISALLOW_COPY_AND_ASSIGN(TestMirroringController);
130 }; 144 };
131 145
146 // Abstracts waiting for the display configuration to be completed and getting
147 // the time it took to complete.
148 class ConfigurationWaiter {
149 public:
150 ConfigurationWaiter(DisplayConfigurator::TestApi* test_api)
151 : on_configured_callback_(base::Bind(&ConfigurationWaiter::OnConfigured,
152 base::Unretained(this))),
153 test_api_(test_api),
154 callback_result_(CALLBACK_NOT_CALLED) {}
155
156 ~ConfigurationWaiter() = default;
157
158 const DisplayConfigurator::ConfigurationCallback& on_configuration_callback()
159 const {
160 return on_configured_callback_;
161 }
162
163 CallbackResult callback_result() const { return callback_result_; }
164
165 void Reset() {
166 callback_result_ = CALLBACK_NOT_CALLED;
167 }
168
169 // Simulates waiting for the next configuration. If an async task is pending,
170 // runs it and returns base::TimeDelta(). Otherwise, triggers the
171 // configuration timer and returns its delay. If the timer wasn't running,
172 // returns base::TimeDelta::Max().
173 base::TimeDelta Wait() WARN_UNUSED_RESULT {
174 base::RunLoop().RunUntilIdle();
175 if (callback_result_ != CALLBACK_NOT_CALLED)
176 return base::TimeDelta();
177
178 const base::TimeDelta delay = test_api_->GetConfigureDelay();
179 if (!test_api_->TriggerConfigureTimeout())
180 return base::TimeDelta::Max();
181
182 return delay;
183 }
184
185 private:
186 void OnConfigured(bool status) {
Daniel Erat 2016/10/31 18:25:46 is it possible to CHECK_EQ(callback_result_, CALLB
afakhry 2016/10/31 21:20:14 Done.
187 callback_result_ = status ? CALLBACK_SUCCESS : CALLBACK_FAILURE;
188 }
189
190 // The callback that should be used with the DisplayConfigurator calls to be
191 // invoked with the display configuration is done. It will always execute this
192 // waiter's OnConfigured().
Daniel Erat 2016/10/31 18:25:46 nit: maybe simplify to "Passed with configuration
afakhry 2016/10/31 21:20:14 Done.
193 const DisplayConfigurator::ConfigurationCallback on_configured_callback_;
194
195 DisplayConfigurator::TestApi* test_api_; // Not owned.
196
197 // The status of the display configuration.
198 CallbackResult callback_result_;
199
200 DISALLOW_COPY_AND_ASSIGN(ConfigurationWaiter);
201 };
202
132 class DisplayConfiguratorTest : public testing::Test { 203 class DisplayConfiguratorTest : public testing::Test {
133 public: 204 public:
134 enum CallbackResult {
135 CALLBACK_FAILURE,
136 CALLBACK_SUCCESS,
137 CALLBACK_NOT_CALLED,
138 };
139
140 DisplayConfiguratorTest() 205 DisplayConfiguratorTest()
141 : small_mode_(gfx::Size(1366, 768), false, 60.0f), 206 : small_mode_(gfx::Size(1366, 768), false, 60.0f),
142 big_mode_(gfx::Size(2560, 1600), false, 60.0f), 207 big_mode_(gfx::Size(2560, 1600), false, 60.0f),
143 observer_(&configurator_), 208 observer_(&configurator_),
144 test_api_(&configurator_), 209 test_api_(&configurator_),
210 config_waiter_(&test_api_),
145 enable_content_protection_status_(0), 211 enable_content_protection_status_(0),
146 enable_content_protection_call_count_(0), 212 enable_content_protection_call_count_(0),
147 query_content_protection_call_count_(0), 213 query_content_protection_call_count_(0),
148 callback_result_(CALLBACK_NOT_CALLED),
149 display_control_result_(CALLBACK_NOT_CALLED) {} 214 display_control_result_(CALLBACK_NOT_CALLED) {}
150 ~DisplayConfiguratorTest() override {} 215 ~DisplayConfiguratorTest() override {}
151 216
152 void SetUp() override { 217 void SetUp() override {
153 log_.reset(new ActionLogger()); 218 log_.reset(new ActionLogger());
154 219
155 native_display_delegate_ = new TestNativeDisplayDelegate(log_.get()); 220 native_display_delegate_ = new TestNativeDisplayDelegate(log_.get());
156 configurator_.SetDelegateForTesting( 221 configurator_.SetDelegateForTesting(
157 std::unique_ptr<NativeDisplayDelegate>(native_display_delegate_)); 222 std::unique_ptr<NativeDisplayDelegate>(native_display_delegate_));
158 223
(...skipping 21 matching lines...) Expand all
180 .SetId(kDisplayIds[2]) 245 .SetId(kDisplayIds[2])
181 .SetNativeMode(small_mode_.Clone()) 246 .SetNativeMode(small_mode_.Clone())
182 .SetCurrentMode(small_mode_.Clone()) 247 .SetCurrentMode(small_mode_.Clone())
183 .SetType(DISPLAY_CONNECTION_TYPE_HDMI) 248 .SetType(DISPLAY_CONNECTION_TYPE_HDMI)
184 .SetIsAspectPerservingScaling(true) 249 .SetIsAspectPerservingScaling(true)
185 .Build(); 250 .Build();
186 251
187 UpdateOutputs(2, false); 252 UpdateOutputs(2, false);
188 } 253 }
189 254
190 void OnConfiguredCallback(bool status) {
191 callback_result_ = (status ? CALLBACK_SUCCESS : CALLBACK_FAILURE);
192 }
193
194 void OnDisplayControlUpdated(bool status) { 255 void OnDisplayControlUpdated(bool status) {
195 display_control_result_ = (status ? CALLBACK_SUCCESS : CALLBACK_FAILURE); 256 display_control_result_ = (status ? CALLBACK_SUCCESS : CALLBACK_FAILURE);
196 } 257 }
197 258
198 void EnableContentProtectionCallback(bool status) { 259 void EnableContentProtectionCallback(bool status) {
199 enable_content_protection_status_ = status; 260 enable_content_protection_status_ = status;
200 enable_content_protection_call_count_++; 261 enable_content_protection_call_count_++;
201 } 262 }
202 263
203 void QueryContentProtectionCallback( 264 void QueryContentProtectionCallback(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_EQ( 305 EXPECT_EQ(
245 JoinActions( 306 JoinActions(
246 kInitXRandR, kGrab, 307 kInitXRandR, kGrab,
247 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) 308 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
248 .c_str(), 309 .c_str(),
249 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 310 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
250 kForceDPMS, kUngrab, nullptr), 311 kForceDPMS, kUngrab, nullptr),
251 log_->GetActionsAndClear()); 312 log_->GetActionsAndClear());
252 } 313 }
253 314
254 CallbackResult PopCallbackResult() {
255 CallbackResult result = callback_result_;
256 callback_result_ = CALLBACK_NOT_CALLED;
257 return result;
258 }
259
260 CallbackResult PopDisplayControlResult() { 315 CallbackResult PopDisplayControlResult() {
261 CallbackResult result = display_control_result_; 316 CallbackResult result = display_control_result_;
262 display_control_result_ = CALLBACK_NOT_CALLED; 317 display_control_result_ = CALLBACK_NOT_CALLED;
263 return result; 318 return result;
264 } 319 }
265 320
266 base::MessageLoop message_loop_; 321 base::MessageLoop message_loop_;
267 TestStateController state_controller_; 322 TestStateController state_controller_;
268 TestMirroringController mirroring_controller_; 323 TestMirroringController mirroring_controller_;
269 DisplayConfigurator configurator_; 324 DisplayConfigurator configurator_;
270 TestObserver observer_; 325 TestObserver observer_;
271 std::unique_ptr<ActionLogger> log_; 326 std::unique_ptr<ActionLogger> log_;
272 TestNativeDisplayDelegate* native_display_delegate_; // not owned 327 TestNativeDisplayDelegate* native_display_delegate_; // not owned
273 DisplayConfigurator::TestApi test_api_; 328 DisplayConfigurator::TestApi test_api_;
274 329 ConfigurationWaiter config_waiter_;
275 bool enable_content_protection_status_; 330 bool enable_content_protection_status_;
276 int enable_content_protection_call_count_; 331 int enable_content_protection_call_count_;
277 DisplayConfigurator::QueryProtectionResponse 332 DisplayConfigurator::QueryProtectionResponse
278 query_content_protection_response_; 333 query_content_protection_response_;
279 int query_content_protection_call_count_; 334 int query_content_protection_call_count_;
280 335
281 std::unique_ptr<DisplaySnapshot> outputs_[3]; 336 std::unique_ptr<DisplaySnapshot> outputs_[3];
282 337
283 CallbackResult callback_result_;
284 CallbackResult display_control_result_; 338 CallbackResult display_control_result_;
285 339
286 private: 340 private:
287 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorTest); 341 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorTest);
288 }; 342 };
289 343
290 } // namespace 344 } // namespace
291 345
292 TEST_F(DisplayConfiguratorTest, FindDisplayModeMatchingSize) { 346 TEST_F(DisplayConfiguratorTest, FindDisplayModeMatchingSize) {
293 std::unique_ptr<ui::DisplaySnapshot> output = 347 std::unique_ptr<ui::DisplaySnapshot> output =
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 704 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
651 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 705 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
652 kUngrab, nullptr), 706 kUngrab, nullptr),
653 log_->GetActionsAndClear()); 707 log_->GetActionsAndClear());
654 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled()); 708 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
655 EXPECT_EQ(1, observer_.num_changes()); 709 EXPECT_EQ(1, observer_.num_changes());
656 710
657 // Turning off the internal display should switch the external display to 711 // Turning off the internal display should switch the external display to
658 // its native mode. 712 // its native mode.
659 observer_.Reset(); 713 observer_.Reset();
714 config_waiter_.Reset();
660 configurator_.SetDisplayPower( 715 configurator_.SetDisplayPower(
661 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 716 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
662 DisplayConfigurator::kSetDisplayPowerNoFlags, 717 DisplayConfigurator::kSetDisplayPowerNoFlags,
663 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 718 config_waiter_.on_configuration_callback());
Daniel Erat 2016/10/31 18:25:46 i'm not sure if it applies to this particular test
afakhry 2016/10/31 21:20:14 We have a similar check in line 1780 of this file:
664 base::Unretained(this))); 719 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
665 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 720 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
666 EXPECT_EQ( 721 EXPECT_EQ(
667 JoinActions( 722 JoinActions(
668 kGrab, GetFramebufferAction(big_mode_.size(), outputs_[0].get(), 723 kGrab, GetFramebufferAction(big_mode_.size(), outputs_[0].get(),
669 outputs_[1].get()) 724 outputs_[1].get())
670 .c_str(), 725 .c_str(),
671 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 726 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
672 GetCrtcAction(*outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(), 727 GetCrtcAction(*outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(),
673 kForceDPMS, kUngrab, nullptr), 728 kForceDPMS, kUngrab, nullptr),
674 log_->GetActionsAndClear()); 729 log_->GetActionsAndClear());
675 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state()); 730 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state());
676 EXPECT_EQ(1, observer_.num_changes()); 731 EXPECT_EQ(1, observer_.num_changes());
677 732
678 // When all displays are turned off, the framebuffer should switch back 733 // When all displays are turned off, the framebuffer should switch back
679 // to the mirrored size. 734 // to the mirrored size.
680 observer_.Reset(); 735 observer_.Reset();
681 configurator_.SetDisplayPower( 736 config_waiter_.Reset();
682 chromeos::DISPLAY_POWER_ALL_OFF, 737 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
683 DisplayConfigurator::kSetDisplayPowerNoFlags, 738 DisplayConfigurator::kSetDisplayPowerNoFlags,
684 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 739 config_waiter_.on_configuration_callback());
685 base::Unretained(this))); 740 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
686 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 741 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
687 EXPECT_EQ( 742 EXPECT_EQ(
688 JoinActions( 743 JoinActions(
689 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 744 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
690 outputs_[1].get()) 745 outputs_[1].get())
691 .c_str(), 746 .c_str(),
692 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 747 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
693 GetCrtcAction(*outputs_[1], nullptr, gfx::Point(0, 0)).c_str(), 748 GetCrtcAction(*outputs_[1], nullptr, gfx::Point(0, 0)).c_str(),
694 kUngrab, nullptr), 749 kUngrab, nullptr),
695 log_->GetActionsAndClear()); 750 log_->GetActionsAndClear());
696 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); 751 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
697 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled()); 752 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
698 EXPECT_EQ(1, observer_.num_changes()); 753 EXPECT_EQ(1, observer_.num_changes());
699 754
700 // Turn all displays on and check that mirroring is still used. 755 // Turn all displays on and check that mirroring is still used.
701 observer_.Reset(); 756 observer_.Reset();
702 configurator_.SetDisplayPower( 757 config_waiter_.Reset();
703 chromeos::DISPLAY_POWER_ALL_ON, 758 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
704 DisplayConfigurator::kSetDisplayPowerNoFlags, 759 DisplayConfigurator::kSetDisplayPowerNoFlags,
705 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 760 config_waiter_.on_configuration_callback());
706 base::Unretained(this))); 761 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
707 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 762 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
708 EXPECT_EQ( 763 EXPECT_EQ(
709 JoinActions( 764 JoinActions(
710 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 765 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
711 outputs_[1].get()) 766 outputs_[1].get())
712 .c_str(), 767 .c_str(),
713 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 768 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
714 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 769 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
715 kForceDPMS, kUngrab, nullptr), 770 kForceDPMS, kUngrab, nullptr),
716 log_->GetActionsAndClear()); 771 log_->GetActionsAndClear());
717 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); 772 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
(...skipping 29 matching lines...) Expand all
747 kUngrab, nullptr), 802 kUngrab, nullptr),
748 log_->GetActionsAndClear()); 803 log_->GetActionsAndClear());
749 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 804 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
750 configurator_.display_state()); 805 configurator_.display_state());
751 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled()); 806 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
752 EXPECT_EQ(1, observer_.num_changes()); 807 EXPECT_EQ(1, observer_.num_changes());
753 808
754 // Turning off the internal display should switch the external display to 809 // Turning off the internal display should switch the external display to
755 // its native mode. 810 // its native mode.
756 observer_.Reset(); 811 observer_.Reset();
812 config_waiter_.Reset();
757 configurator_.SetDisplayPower( 813 configurator_.SetDisplayPower(
758 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 814 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
759 DisplayConfigurator::kSetDisplayPowerNoFlags, 815 DisplayConfigurator::kSetDisplayPowerNoFlags,
760 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 816 config_waiter_.on_configuration_callback());
761 base::Unretained(this))); 817 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
762 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 818 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
763 EXPECT_EQ( 819 EXPECT_EQ(
764 JoinActions( 820 JoinActions(
765 kGrab, GetFramebufferAction(big_mode_.size(), outputs_[0].get(), 821 kGrab, GetFramebufferAction(big_mode_.size(), outputs_[0].get(),
766 outputs_[1].get()) 822 outputs_[1].get())
767 .c_str(), 823 .c_str(),
768 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 824 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
769 GetCrtcAction(*outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(), 825 GetCrtcAction(*outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(),
770 kForceDPMS, kUngrab, nullptr), 826 kForceDPMS, kUngrab, nullptr),
771 log_->GetActionsAndClear()); 827 log_->GetActionsAndClear());
772 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state()); 828 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state());
773 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled()); 829 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
774 EXPECT_EQ(1, observer_.num_changes()); 830 EXPECT_EQ(1, observer_.num_changes());
775 831
776 // When all displays are turned off, the framebuffer should switch back 832 // When all displays are turned off, the framebuffer should switch back
777 // to the extended + software mirroring. 833 // to the extended + software mirroring.
778 observer_.Reset(); 834 observer_.Reset();
779 configurator_.SetDisplayPower( 835 config_waiter_.Reset();
780 chromeos::DISPLAY_POWER_ALL_OFF, 836 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
781 DisplayConfigurator::kSetDisplayPowerNoFlags, 837 DisplayConfigurator::kSetDisplayPowerNoFlags,
782 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 838 config_waiter_.on_configuration_callback());
783 base::Unretained(this))); 839 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
784 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 840 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
785 EXPECT_EQ( 841 EXPECT_EQ(
786 JoinActions( 842 JoinActions(
787 kGrab, 843 kGrab,
788 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 844 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
789 outputs_[0].get(), outputs_[1].get()) 845 outputs_[0].get(), outputs_[1].get())
790 .c_str(), 846 .c_str(),
791 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 847 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
792 GetCrtcAction(*outputs_[1], nullptr, 848 GetCrtcAction(*outputs_[1], nullptr,
793 gfx::Point(0, small_mode_.size().height() + 849 gfx::Point(0, small_mode_.size().height() +
794 DisplayConfigurator::kVerticalGap)) 850 DisplayConfigurator::kVerticalGap))
795 .c_str(), 851 .c_str(),
796 kUngrab, nullptr), 852 kUngrab, nullptr),
797 log_->GetActionsAndClear()); 853 log_->GetActionsAndClear());
798 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 854 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
799 configurator_.display_state()); 855 configurator_.display_state());
800 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled()); 856 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
801 EXPECT_EQ(1, observer_.num_changes()); 857 EXPECT_EQ(1, observer_.num_changes());
802 858
803 // Turn all displays on and check that mirroring is still used. 859 // Turn all displays on and check that mirroring is still used.
804 observer_.Reset(); 860 observer_.Reset();
805 configurator_.SetDisplayPower( 861 config_waiter_.Reset();
806 chromeos::DISPLAY_POWER_ALL_ON, 862 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
807 DisplayConfigurator::kSetDisplayPowerNoFlags, 863 DisplayConfigurator::kSetDisplayPowerNoFlags,
808 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 864 config_waiter_.on_configuration_callback());
809 base::Unretained(this))); 865 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
810 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 866 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
811 EXPECT_EQ( 867 EXPECT_EQ(
812 JoinActions( 868 JoinActions(
813 kGrab, 869 kGrab,
814 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 870 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
815 outputs_[0].get(), outputs_[1].get()) 871 outputs_[0].get(), outputs_[1].get())
816 .c_str(), 872 .c_str(),
817 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 873 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
818 GetCrtcAction(*outputs_[1], &big_mode_, 874 GetCrtcAction(*outputs_[1], &big_mode_,
819 gfx::Point(0, small_mode_.size().height() + 875 gfx::Point(0, small_mode_.size().height() +
820 DisplayConfigurator::kVerticalGap)) 876 DisplayConfigurator::kVerticalGap))
821 .c_str(), 877 .c_str(),
822 kForceDPMS, kUngrab, nullptr), 878 kForceDPMS, kUngrab, nullptr),
823 log_->GetActionsAndClear()); 879 log_->GetActionsAndClear());
824 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 880 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
825 configurator_.display_state()); 881 configurator_.display_state());
826 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled()); 882 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
827 EXPECT_EQ(1, observer_.num_changes()); 883 EXPECT_EQ(1, observer_.num_changes());
828 } 884 }
829 885
830 TEST_F(DisplayConfiguratorTest, SuspendAndResume) { 886 TEST_F(DisplayConfiguratorTest, SuspendAndResume) {
831 InitWithSingleOutput(); 887 InitWithSingleOutput();
832 888
833 // No preparation is needed before suspending when the display is already 889 // No preparation is needed before suspending when the display is already
834 // on. The configurator should still reprobe on resume in case a display 890 // on. The configurator should still reprobe on resume in case a display
835 // was connected while suspended. 891 // was connected while suspended.
836 const gfx::Size framebuffer_size = configurator_.framebuffer_size(); 892 const gfx::Size framebuffer_size = configurator_.framebuffer_size();
837 DCHECK(!framebuffer_size.IsEmpty()); 893 DCHECK(!framebuffer_size.IsEmpty());
838 configurator_.SuspendDisplays(base::Bind( 894 config_waiter_.Reset();
839 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); 895 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
840 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 896 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
897 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
841 EXPECT_EQ(framebuffer_size.ToString(), 898 EXPECT_EQ(framebuffer_size.ToString(),
842 configurator_.framebuffer_size().ToString()); 899 configurator_.framebuffer_size().ToString());
843 EXPECT_EQ(JoinActions( 900 EXPECT_EQ(JoinActions(
844 kGrab, GetFramebufferAction(small_mode_.size(), 901 kGrab, GetFramebufferAction(small_mode_.size(),
845 outputs_[0].get(), nullptr) 902 outputs_[0].get(), nullptr)
846 .c_str(), 903 .c_str(),
847 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 904 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
848 kUngrab, kSync, nullptr), 905 kUngrab, kSync, nullptr),
849 log_->GetActionsAndClear()); 906 log_->GetActionsAndClear());
907
908 // No resume delay in single display mode.
909 config_waiter_.Reset();
850 configurator_.ResumeDisplays(); 910 configurator_.ResumeDisplays();
911 // The timer should not be running.
912 EXPECT_EQ(base::TimeDelta::Max(), config_waiter_.Wait());
851 EXPECT_EQ( 913 EXPECT_EQ(
852 JoinActions( 914 JoinActions(
853 kGrab, 915 kGrab,
854 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) 916 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
855 .c_str(), 917 .c_str(),
856 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 918 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
857 kForceDPMS, kUngrab, nullptr), 919 kForceDPMS, kUngrab, nullptr),
858 log_->GetActionsAndClear()); 920 log_->GetActionsAndClear());
859 921
860 // Now turn the display off before suspending and check that the 922 // Now turn the display off before suspending and check that the
861 // configurator turns it back on and syncs with the server. 923 // configurator turns it back on and syncs with the server.
862 configurator_.SetDisplayPower( 924 config_waiter_.Reset();
863 chromeos::DISPLAY_POWER_ALL_OFF, 925 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
864 DisplayConfigurator::kSetDisplayPowerNoFlags, 926 DisplayConfigurator::kSetDisplayPowerNoFlags,
865 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 927 config_waiter_.on_configuration_callback());
866 base::Unretained(this))); 928 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
867 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 929 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
868 EXPECT_EQ(JoinActions( 930 EXPECT_EQ(JoinActions(
869 kGrab, GetFramebufferAction(small_mode_.size(), 931 kGrab, GetFramebufferAction(small_mode_.size(),
870 outputs_[0].get(), nullptr) 932 outputs_[0].get(), nullptr)
871 .c_str(), 933 .c_str(),
872 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 934 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
873 kUngrab, nullptr), 935 kUngrab, nullptr),
874 log_->GetActionsAndClear()); 936 log_->GetActionsAndClear());
875 937
876 configurator_.SuspendDisplays(base::Bind( 938 config_waiter_.Reset();
877 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); 939 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
878 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 940 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
941 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
879 EXPECT_EQ(kSync, log_->GetActionsAndClear()); 942 EXPECT_EQ(kSync, log_->GetActionsAndClear());
880 943
944 config_waiter_.Reset();
881 configurator_.ResumeDisplays(); 945 configurator_.ResumeDisplays();
946 // The timer should not be running.
947 EXPECT_EQ(base::TimeDelta::Max(), config_waiter_.Wait());
882 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 948 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
883 949
884 configurator_.SetDisplayPower( 950 config_waiter_.Reset();
885 chromeos::DISPLAY_POWER_ALL_ON, 951 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
886 DisplayConfigurator::kSetDisplayPowerNoFlags, 952 DisplayConfigurator::kSetDisplayPowerNoFlags,
887 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 953 config_waiter_.on_configuration_callback());
888 base::Unretained(this))); 954 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
955 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
889 EXPECT_EQ( 956 EXPECT_EQ(
890 JoinActions( 957 JoinActions(
891 kGrab, 958 kGrab,
892 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) 959 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
893 .c_str(), 960 .c_str(),
894 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 961 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
895 kForceDPMS, kUngrab, nullptr), 962 kForceDPMS, kUngrab, nullptr),
896 log_->GetActionsAndClear()); 963 log_->GetActionsAndClear());
897 964
898 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); 965 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
899 UpdateOutputs(2, true); 966 UpdateOutputs(2, true);
900 EXPECT_EQ( 967 EXPECT_EQ(
901 JoinActions( 968 JoinActions(
902 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 969 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
903 outputs_[1].get()) 970 outputs_[1].get())
904 .c_str(), 971 .c_str(),
905 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 972 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
906 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 973 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
907 kUngrab, nullptr), 974 kUngrab, nullptr),
908 log_->GetActionsAndClear()); 975 log_->GetActionsAndClear());
909 976
910 configurator_.SetDisplayPower( 977 config_waiter_.Reset();
911 chromeos::DISPLAY_POWER_ALL_OFF, 978 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
912 DisplayConfigurator::kSetDisplayPowerNoFlags, 979 DisplayConfigurator::kSetDisplayPowerNoFlags,
913 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 980 config_waiter_.on_configuration_callback());
914 base::Unretained(this))); 981 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
915 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 982 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
983 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
916 EXPECT_EQ( 984 EXPECT_EQ(
917 JoinActions( 985 JoinActions(
918 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 986 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
919 outputs_[1].get()) 987 outputs_[1].get())
920 .c_str(), 988 .c_str(),
921 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 989 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
922 GetCrtcAction(*outputs_[1], nullptr, gfx::Point(0, 0)).c_str(), 990 GetCrtcAction(*outputs_[1], nullptr, gfx::Point(0, 0)).c_str(),
923 kUngrab, nullptr), 991 kUngrab, nullptr),
924 log_->GetActionsAndClear()); 992 log_->GetActionsAndClear());
925 993
926 configurator_.SuspendDisplays(base::Bind( 994 // No delay in suspend.
927 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); 995 config_waiter_.Reset();
928 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 996 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
997 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
998 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
999 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_OFF,
1000 configurator_.current_power_state());
1001 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
929 EXPECT_EQ(kSync, log_->GetActionsAndClear()); 1002 EXPECT_EQ(kSync, log_->GetActionsAndClear());
930 1003
931 // If a display is disconnected while suspended, the configurator should 1004 // If a display is disconnected while suspended, the configurator should
932 // pick up the change and only turn on the internal display. 1005 // pick up the change and only turn on the internal display. The should be
1006 // a longer configuration delay when we set the displays back to on.
933 UpdateOutputs(1, false); 1007 UpdateOutputs(1, false);
1008 config_waiter_.Reset();
934 configurator_.ResumeDisplays(); 1009 configurator_.ResumeDisplays();
1010 // Since we were in dual display mirror mode before suspend, the timer should
1011 // be running with kMinLongDelayMs.
1012 EXPECT_EQ(kLongDelayMs, test_api_.GetConfigureDelay());
935 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1013 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
936 1014
937 configurator_.SetDisplayPower( 1015 config_waiter_.Reset();
938 chromeos::DISPLAY_POWER_ALL_ON, 1016 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
939 DisplayConfigurator::kSetDisplayPowerNoFlags, 1017 DisplayConfigurator::kSetDisplayPowerNoFlags,
940 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1018 config_waiter_.on_configuration_callback());
941 base::Unretained(this))); 1019 EXPECT_EQ(kLongDelayMs, config_waiter_.Wait());
1020 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
942 EXPECT_EQ( 1021 EXPECT_EQ(
943 JoinActions( 1022 JoinActions(
944 kGrab, 1023 kGrab,
945 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) 1024 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
946 .c_str(), 1025 .c_str(),
947 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1026 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
948 kForceDPMS, kUngrab, nullptr), 1027 kForceDPMS, kUngrab, nullptr),
949 log_->GetActionsAndClear()); 1028 log_->GetActionsAndClear());
950 } 1029 }
951 1030
952 TEST_F(DisplayConfiguratorTest, Headless) { 1031 TEST_F(DisplayConfiguratorTest, Headless) {
953 UpdateOutputs(0, false); 1032 UpdateOutputs(0, false);
954 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1033 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
955 Init(false); 1034 Init(false);
956 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1035 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
957 configurator_.ForceInitialConfigure(0); 1036 configurator_.ForceInitialConfigure(0);
958 EXPECT_EQ(JoinActions(kInitXRandR, kGrab, kForceDPMS, kUngrab, nullptr), 1037 EXPECT_EQ(JoinActions(kInitXRandR, kGrab, kForceDPMS, kUngrab, nullptr),
959 log_->GetActionsAndClear()); 1038 log_->GetActionsAndClear());
960 1039
961 // Not much should happen when the display power state is changed while 1040 // Not much should happen when the display power state is changed while
962 // no displays are connected. 1041 // no displays are connected.
963 configurator_.SetDisplayPower( 1042 config_waiter_.Reset();
964 chromeos::DISPLAY_POWER_ALL_OFF, 1043 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
965 DisplayConfigurator::kSetDisplayPowerNoFlags, 1044 DisplayConfigurator::kSetDisplayPowerNoFlags,
966 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1045 config_waiter_.on_configuration_callback());
967 base::Unretained(this))); 1046 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
968 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1047 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
969 EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_->GetActionsAndClear()); 1048 EXPECT_EQ(JoinActions(kGrab, kUngrab, nullptr), log_->GetActionsAndClear());
970 configurator_.SetDisplayPower( 1049 config_waiter_.Reset();
971 chromeos::DISPLAY_POWER_ALL_ON, 1050 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
972 DisplayConfigurator::kSetDisplayPowerNoFlags, 1051 DisplayConfigurator::kSetDisplayPowerNoFlags,
973 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1052 config_waiter_.on_configuration_callback());
974 base::Unretained(this))); 1053 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
975 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1054 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
976 EXPECT_EQ(JoinActions(kGrab, kForceDPMS, kUngrab, nullptr), 1055 EXPECT_EQ(JoinActions(kGrab, kForceDPMS, kUngrab, nullptr),
977 log_->GetActionsAndClear()); 1056 log_->GetActionsAndClear());
978 1057
979 // Connect an external display and check that it's configured correctly. 1058 // Connect an external display and check that it's configured correctly.
980 outputs_[0] = display::FakeDisplaySnapshot::Builder() 1059 outputs_[0] = display::FakeDisplaySnapshot::Builder()
981 .SetId(kDisplayIds[0]) 1060 .SetId(kDisplayIds[0])
982 .SetNativeMode(big_mode_.Clone()) 1061 .SetNativeMode(big_mode_.Clone())
983 .SetCurrentMode(big_mode_.Clone()) 1062 .SetCurrentMode(big_mode_.Clone())
984 .AddMode(small_mode_.Clone()) 1063 .AddMode(small_mode_.Clone())
985 .SetType(DISPLAY_CONNECTION_TYPE_INTERNAL) 1064 .SetType(DISPLAY_CONNECTION_TYPE_INTERNAL)
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 log_->GetActionsAndClear()); 1288 log_->GetActionsAndClear());
1210 } 1289 }
1211 1290
1212 TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) { 1291 TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) {
1213 InitWithSingleOutput(); 1292 InitWithSingleOutput();
1214 1293
1215 // The DisplayConfigurator may occasionally receive OnConfigurationChanged() 1294 // The DisplayConfigurator may occasionally receive OnConfigurationChanged()
1216 // after the displays have been suspended. This event should be ignored since 1295 // after the displays have been suspended. This event should be ignored since
1217 // the DisplayConfigurator will force a probe and reconfiguration of displays 1296 // the DisplayConfigurator will force a probe and reconfiguration of displays
1218 // at resume time. 1297 // at resume time.
1219 configurator_.SuspendDisplays(base::Bind( 1298 config_waiter_.Reset();
1220 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); 1299 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
1221 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1300 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1301 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1222 EXPECT_EQ(JoinActions( 1302 EXPECT_EQ(JoinActions(
1223 kGrab, GetFramebufferAction(small_mode_.size(), 1303 kGrab, GetFramebufferAction(small_mode_.size(),
1224 outputs_[0].get(), nullptr) 1304 outputs_[0].get(), nullptr)
1225 .c_str(), 1305 .c_str(),
1226 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1306 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1227 kUngrab, kSync, nullptr), 1307 kUngrab, kSync, nullptr),
1228 log_->GetActionsAndClear()); 1308 log_->GetActionsAndClear());
1229 1309
1230 // The configuration timer should not be started when the displays 1310 // The configuration timer should not be started when the displays
1231 // are suspended. 1311 // are suspended.
1232 configurator_.OnConfigurationChanged(); 1312 configurator_.OnConfigurationChanged();
1233 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); 1313 EXPECT_FALSE(test_api_.TriggerConfigureTimeout());
1234 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1314 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1235 1315
1236 // Calls to SetDisplayPower should do nothing if the power state doesn't 1316 // Calls to SetDisplayPower should do nothing if the power state doesn't
1237 // change. 1317 // change.
1238 configurator_.SetDisplayPower( 1318 config_waiter_.Reset();
1239 chromeos::DISPLAY_POWER_ALL_OFF, 1319 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
1240 DisplayConfigurator::kSetDisplayPowerNoFlags, 1320 DisplayConfigurator::kSetDisplayPowerNoFlags,
1241 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1321 config_waiter_.on_configuration_callback());
1242 base::Unretained(this))); 1322 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1243 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1323 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1244 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1324 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1245 configurator_.SetDisplayPower( 1325 config_waiter_.Reset();
1246 chromeos::DISPLAY_POWER_ALL_ON, 1326 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
1247 DisplayConfigurator::kSetDisplayPowerNoFlags, 1327 DisplayConfigurator::kSetDisplayPowerNoFlags,
1248 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1328 config_waiter_.on_configuration_callback());
1249 base::Unretained(this))); 1329 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1250 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1330 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1251 EXPECT_EQ( 1331 EXPECT_EQ(
1252 JoinActions( 1332 JoinActions(
1253 kGrab, 1333 kGrab,
1254 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) 1334 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
1255 .c_str(), 1335 .c_str(),
1256 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1336 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1257 kForceDPMS, kUngrab, nullptr), 1337 kForceDPMS, kUngrab, nullptr),
1258 log_->GetActionsAndClear()); 1338 log_->GetActionsAndClear());
1259 1339
1260 UpdateOutputs(2, false); 1340 UpdateOutputs(2, false);
1261 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); 1341 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
1262 EXPECT_EQ( 1342 EXPECT_EQ(
1263 JoinActions( 1343 JoinActions(
1264 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 1344 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
1265 outputs_[1].get()) 1345 outputs_[1].get())
1266 .c_str(), 1346 .c_str(),
1267 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1347 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1268 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 1348 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
1269 kUngrab, nullptr), 1349 kUngrab, nullptr),
1270 log_->GetActionsAndClear()); 1350 log_->GetActionsAndClear());
1271 1351
1272 // The DisplayConfigurator should do nothing at resume time if there is no 1352 // The DisplayConfigurator should do nothing at resume time if there is no
1273 // state change. 1353 // state change.
1354 config_waiter_.Reset();
1274 UpdateOutputs(1, false); 1355 UpdateOutputs(1, false);
1275 configurator_.ResumeDisplays(); 1356 configurator_.ResumeDisplays();
1276 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1357 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1277 1358
1278 // If a configuration task is pending when the displays are suspended, that 1359 // If a configuration task is pending when the displays are suspended, that
1279 // task should not run either and the timer should be stopped. The displays 1360 // task should not run either and the timer should be stopped. The displays
1280 // should be turned off by suspend. 1361 // should be turned off by suspend.
1281 configurator_.OnConfigurationChanged(); 1362 configurator_.OnConfigurationChanged();
1282 configurator_.SuspendDisplays(base::Bind( 1363 config_waiter_.Reset();
1283 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); 1364 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
1284 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1365 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1366 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1285 EXPECT_EQ(JoinActions( 1367 EXPECT_EQ(JoinActions(
1286 kGrab, GetFramebufferAction(small_mode_.size(), 1368 kGrab, GetFramebufferAction(small_mode_.size(),
1287 outputs_[0].get(), nullptr) 1369 outputs_[0].get(), nullptr)
1288 .c_str(), 1370 .c_str(),
1289 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1371 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1290 kUngrab, kSync, nullptr), 1372 kUngrab, kSync, nullptr),
1291 log_->GetActionsAndClear()); 1373 log_->GetActionsAndClear());
1292
1293 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); 1374 EXPECT_FALSE(test_api_.TriggerConfigureTimeout());
1294 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1375 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1295 1376
1377 config_waiter_.Reset();
1296 configurator_.ResumeDisplays(); 1378 configurator_.ResumeDisplays();
1379 // The timer should not be running.
1380 EXPECT_EQ(base::TimeDelta::Max(), config_waiter_.Wait());
1297 EXPECT_EQ( 1381 EXPECT_EQ(
1298 JoinActions( 1382 JoinActions(
1299 kGrab, 1383 kGrab,
1300 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr) 1384 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
1301 .c_str(), 1385 .c_str(),
1302 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1386 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1303 kForceDPMS, kUngrab, nullptr), 1387 kForceDPMS, kUngrab, nullptr),
1304 log_->GetActionsAndClear()); 1388 log_->GetActionsAndClear());
1305 } 1389 }
1306 1390
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); 1604 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
1521 Init(false); 1605 Init(false);
1522 configurator_.ForceInitialConfigure(0); 1606 configurator_.ForceInitialConfigure(0);
1523 log_->GetActionsAndClear(); 1607 log_->GetActionsAndClear();
1524 observer_.Reset(); 1608 observer_.Reset();
1525 1609
1526 // Turn off the internal display, simulating docked mode. 1610 // Turn off the internal display, simulating docked mode.
1527 configurator_.SetDisplayPower( 1611 configurator_.SetDisplayPower(
1528 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 1612 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
1529 DisplayConfigurator::kSetDisplayPowerNoFlags, 1613 DisplayConfigurator::kSetDisplayPowerNoFlags,
1530 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1614 config_waiter_.on_configuration_callback());
1531 base::Unretained(this))); 1615 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1532 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1616 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1533 EXPECT_EQ(1, observer_.num_changes()); 1617 EXPECT_EQ(1, observer_.num_changes());
1534 EXPECT_EQ(0, observer_.num_failures()); 1618 EXPECT_EQ(0, observer_.num_failures());
1535 log_->GetActionsAndClear(); 1619 log_->GetActionsAndClear();
1536 1620
1537 // Make all subsequent configuration requests fail and try to turn the 1621 // Make all subsequent configuration requests fail and try to turn the
1538 // internal display back on. 1622 // internal display back on.
1539 native_display_delegate_->set_max_configurable_pixels(1); 1623 native_display_delegate_->set_max_configurable_pixels(1);
1540 configurator_.SetDisplayPower( 1624 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
1541 chromeos::DISPLAY_POWER_ALL_ON, 1625 DisplayConfigurator::kSetDisplayPowerNoFlags,
1542 DisplayConfigurator::kSetDisplayPowerNoFlags, 1626 config_waiter_.on_configuration_callback());
1543 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1627 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1544 base::Unretained(this))); 1628 EXPECT_EQ(CALLBACK_FAILURE, config_waiter_.callback_result());
1545 EXPECT_EQ(CALLBACK_FAILURE, PopCallbackResult());
1546 EXPECT_EQ(1, observer_.num_changes()); 1629 EXPECT_EQ(1, observer_.num_changes());
1547 EXPECT_EQ(1, observer_.num_failures()); 1630 EXPECT_EQ(1, observer_.num_failures());
1548 log_->GetActionsAndClear(); 1631 log_->GetActionsAndClear();
1549 1632
1550 // Simulate the external display getting disconnected and check that the 1633 // Simulate the external display getting disconnected and check that the
1551 // internal display is turned on (i.e. DISPLAY_POWER_ALL_ON is used) rather 1634 // internal display is turned on (i.e. DISPLAY_POWER_ALL_ON is used) rather
1552 // than the earlier DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON state. 1635 // than the earlier DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON state.
1553 native_display_delegate_->set_max_configurable_pixels(0); 1636 native_display_delegate_->set_max_configurable_pixels(0);
1554 UpdateOutputs(1, true); 1637 UpdateOutputs(1, true);
1555 EXPECT_EQ( 1638 EXPECT_EQ(
(...skipping 14 matching lines...) Expand all
1570 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); 1653 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
1571 Init(false); 1654 Init(false);
1572 configurator_.ForceInitialConfigure(0); 1655 configurator_.ForceInitialConfigure(0);
1573 log_->GetActionsAndClear(); 1656 log_->GetActionsAndClear();
1574 observer_.Reset(); 1657 observer_.Reset();
1575 1658
1576 // Turn off the internal display, simulating docked mode. 1659 // Turn off the internal display, simulating docked mode.
1577 configurator_.SetDisplayPower( 1660 configurator_.SetDisplayPower(
1578 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 1661 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
1579 DisplayConfigurator::kSetDisplayPowerNoFlags, 1662 DisplayConfigurator::kSetDisplayPowerNoFlags,
1580 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1663 config_waiter_.on_configuration_callback());
1581 base::Unretained(this))); 1664 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1582 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1665 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1583 EXPECT_EQ(1, observer_.num_changes()); 1666 EXPECT_EQ(1, observer_.num_changes());
1584 EXPECT_EQ(0, observer_.num_failures()); 1667 EXPECT_EQ(0, observer_.num_failures());
1585 EXPECT_EQ( 1668 EXPECT_EQ(
1586 JoinActions( 1669 JoinActions(
1587 kGrab, GetFramebufferAction(big_mode_.size(), outputs_[0].get(), 1670 kGrab, GetFramebufferAction(big_mode_.size(), outputs_[0].get(),
1588 outputs_[1].get()) 1671 outputs_[1].get())
1589 .c_str(), 1672 .c_str(),
1590 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1673 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1591 GetCrtcAction(*outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(), 1674 GetCrtcAction(*outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(),
1592 kForceDPMS, kUngrab, nullptr), 1675 kForceDPMS, kUngrab, nullptr),
1593 log_->GetActionsAndClear()); 1676 log_->GetActionsAndClear());
1594 1677
1595 // Suspend and resume the system. Resuming should restore the previous power 1678 // Suspend and resume the system. Resuming should restore the previous power
1596 // state and force a probe. Suspend should turn off the displays since an 1679 // state and force a probe. Suspend should turn off the displays since an
1597 // external monitor is connected. 1680 // external monitor is connected.
1598 configurator_.SuspendDisplays(base::Bind( 1681 config_waiter_.Reset();
1599 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); 1682 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
1600 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1683 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1684 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1601 EXPECT_EQ(2, observer_.num_changes()); 1685 EXPECT_EQ(2, observer_.num_changes());
1602 EXPECT_EQ( 1686 EXPECT_EQ(
1603 JoinActions( 1687 JoinActions(
1604 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 1688 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
1605 outputs_[1].get()) 1689 outputs_[1].get())
1606 .c_str(), 1690 .c_str(),
1607 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1691 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1608 GetCrtcAction(*outputs_[1], nullptr, gfx::Point(0, 0)).c_str(), 1692 GetCrtcAction(*outputs_[1], nullptr, gfx::Point(0, 0)).c_str(),
1609 kUngrab, kSync, nullptr), 1693 kUngrab, kSync, nullptr),
1610 log_->GetActionsAndClear()); 1694 log_->GetActionsAndClear());
1611 1695
1612 // Before the task runs, exit docked mode. 1696 // Before the task runs, exit docked mode.
1613 configurator_.SetDisplayPower( 1697 config_waiter_.Reset();
1614 chromeos::DISPLAY_POWER_ALL_ON, 1698 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
1615 DisplayConfigurator::kSetDisplayPowerNoFlags, 1699 DisplayConfigurator::kSetDisplayPowerNoFlags,
1616 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1700 config_waiter_.on_configuration_callback());
1617 base::Unretained(this))); 1701 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1618 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1702 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1619 EXPECT_EQ(3, observer_.num_changes()); 1703 EXPECT_EQ(3, observer_.num_changes());
1620 EXPECT_EQ(0, observer_.num_failures()); 1704 EXPECT_EQ(0, observer_.num_failures());
1621 EXPECT_EQ( 1705 EXPECT_EQ(
1622 JoinActions( 1706 JoinActions(
1623 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(), 1707 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
1624 outputs_[1].get()) 1708 outputs_[1].get())
1625 .c_str(), 1709 .c_str(),
1626 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1710 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1627 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 1711 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
1628 kForceDPMS, kUngrab, nullptr), 1712 kForceDPMS, kUngrab, nullptr),
1629 log_->GetActionsAndClear()); 1713 log_->GetActionsAndClear());
1630 1714
1631 // Check that the display states are not changed after resuming. 1715 // Check that the display states are not changed after resuming.
1716 config_waiter_.Reset();
1717 // Since we are in dual display mode, a configuration task is scheduled after
1718 // kMinLongDelayMs delay.
1632 configurator_.ResumeDisplays(); 1719 configurator_.ResumeDisplays();
1720 EXPECT_EQ(kLongDelayMs, test_api_.GetConfigureDelay());
1721 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON,
1722 configurator_.current_power_state());
1633 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); 1723 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1724 // Now trigger that delayed configuration.
1725 EXPECT_EQ(kLongDelayMs, config_waiter_.Wait());
1726 EXPECT_EQ(
1727 JoinActions(
1728 kGrab, GetFramebufferAction(small_mode_.size(), outputs_[0].get(),
1729 outputs_[1].get())
1730 .c_str(),
1731 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1732 GetCrtcAction(*outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
1733 kUngrab, nullptr),
1734 log_->GetActionsAndClear());
1634 } 1735 }
1635 1736
1636 TEST_F(DisplayConfiguratorTest, ExternalControl) { 1737 TEST_F(DisplayConfiguratorTest, ExternalControl) {
1637 InitWithSingleOutput(); 1738 InitWithSingleOutput();
1638 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_SINGLE); 1739 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_SINGLE);
1639 configurator_.RelinquishControl( 1740 configurator_.RelinquishControl(
1640 base::Bind(&DisplayConfiguratorTest::OnDisplayControlUpdated, 1741 base::Bind(&DisplayConfiguratorTest::OnDisplayControlUpdated,
1641 base::Unretained(this))); 1742 base::Unretained(this)));
1642 EXPECT_EQ(CALLBACK_SUCCESS, PopDisplayControlResult()); 1743 EXPECT_EQ(CALLBACK_SUCCESS, PopDisplayControlResult());
1643 EXPECT_EQ(JoinActions(kRelinquishDisplayControl, nullptr), 1744 EXPECT_EQ(JoinActions(kRelinquishDisplayControl, nullptr),
(...skipping 16 matching lines...) Expand all
1660 SetDisplayPowerWhilePendingConfigurationTaskRunning) { 1761 SetDisplayPowerWhilePendingConfigurationTaskRunning) {
1661 // Start out with two displays in extended mode. 1762 // Start out with two displays in extended mode.
1662 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); 1763 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
1663 Init(false); 1764 Init(false);
1664 configurator_.ForceInitialConfigure(0); 1765 configurator_.ForceInitialConfigure(0);
1665 log_->GetActionsAndClear(); 1766 log_->GetActionsAndClear();
1666 observer_.Reset(); 1767 observer_.Reset();
1667 1768
1668 native_display_delegate_->set_run_async(true); 1769 native_display_delegate_->set_run_async(true);
1669 1770
1670 configurator_.SetDisplayPower( 1771 config_waiter_.Reset();
1671 chromeos::DISPLAY_POWER_ALL_OFF, 1772 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
1672 DisplayConfigurator::kSetDisplayPowerNoFlags, 1773 DisplayConfigurator::kSetDisplayPowerNoFlags,
1673 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1774 config_waiter_.on_configuration_callback());
1674 base::Unretained(this)));
1675 1775
1676 configurator_.SetDisplayPower( 1776 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
1677 chromeos::DISPLAY_POWER_ALL_ON, 1777 DisplayConfigurator::kSetDisplayPowerNoFlags,
1678 DisplayConfigurator::kSetDisplayPowerNoFlags, 1778 config_waiter_.on_configuration_callback());
1679 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback,
1680 base::Unretained(this)));
1681 1779
1682 EXPECT_EQ(CALLBACK_NOT_CALLED, PopCallbackResult()); 1780 EXPECT_EQ(CALLBACK_NOT_CALLED, config_waiter_.callback_result());
1683 base::RunLoop().RunUntilIdle(); 1781 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1684 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1782 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1685 EXPECT_EQ(1, observer_.num_changes()); 1783 EXPECT_EQ(1, observer_.num_changes());
1686 EXPECT_EQ(0, observer_.num_failures()); 1784 EXPECT_EQ(0, observer_.num_failures());
1687 1785
1688 const int kDualHeight = small_mode_.size().height() + 1786 const int kDualHeight = small_mode_.size().height() +
1689 DisplayConfigurator::kVerticalGap + 1787 DisplayConfigurator::kVerticalGap +
1690 big_mode_.size().height(); 1788 big_mode_.size().height();
1691 EXPECT_EQ( 1789 EXPECT_EQ(
1692 JoinActions( 1790 JoinActions(
1693 kGrab, 1791 kGrab,
1694 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 1792 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
1695 outputs_[0].get(), outputs_[1].get()) 1793 outputs_[0].get(), outputs_[1].get())
1696 .c_str(), 1794 .c_str(),
1697 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1795 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1698 GetCrtcAction(*outputs_[1], nullptr, 1796 GetCrtcAction(*outputs_[1], nullptr,
1699 gfx::Point(0, small_mode_.size().height() + 1797 gfx::Point(0, small_mode_.size().height() +
1700 DisplayConfigurator::kVerticalGap)) 1798 DisplayConfigurator::kVerticalGap))
1701 .c_str(), 1799 .c_str(),
1702 kUngrab, nullptr), 1800 kUngrab, nullptr),
1703 log_->GetActionsAndClear()); 1801 log_->GetActionsAndClear());
1704 1802
1803 config_waiter_.Reset();
1705 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); 1804 EXPECT_TRUE(test_api_.TriggerConfigureTimeout());
1706 base::RunLoop().RunUntilIdle(); 1805 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1707 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); 1806 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1708 EXPECT_EQ(2, observer_.num_changes()); 1807 EXPECT_EQ(2, observer_.num_changes());
1709 EXPECT_EQ(0, observer_.num_failures()); 1808 EXPECT_EQ(0, observer_.num_failures());
1710 1809
1711 EXPECT_EQ( 1810 EXPECT_EQ(
1712 JoinActions( 1811 JoinActions(
1713 kGrab, 1812 kGrab,
1714 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 1813 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
1715 outputs_[0].get(), outputs_[1].get()) 1814 outputs_[0].get(), outputs_[1].get())
1716 .c_str(), 1815 .c_str(),
1717 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1816 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
(...skipping 10 matching lines...) Expand all
1728 // Start out with two displays in extended mode. 1827 // Start out with two displays in extended mode.
1729 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); 1828 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
1730 Init(false); 1829 Init(false);
1731 configurator_.ForceInitialConfigure(0); 1830 configurator_.ForceInitialConfigure(0);
1732 log_->GetActionsAndClear(); 1831 log_->GetActionsAndClear();
1733 observer_.Reset(); 1832 observer_.Reset();
1734 1833
1735 // Fail display configuration. 1834 // Fail display configuration.
1736 native_display_delegate_->set_max_configurable_pixels(-1); 1835 native_display_delegate_->set_max_configurable_pixels(-1);
1737 1836
1738 configurator_.SetDisplayPower( 1837 config_waiter_.Reset();
1739 chromeos::DISPLAY_POWER_ALL_OFF, 1838 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
1740 DisplayConfigurator::kSetDisplayPowerNoFlags, 1839 DisplayConfigurator::kSetDisplayPowerNoFlags,
1741 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1840 config_waiter_.on_configuration_callback());
1742 base::Unretained(this))); 1841 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1743 1842 EXPECT_EQ(CALLBACK_FAILURE, config_waiter_.callback_result());
1744 EXPECT_EQ(CALLBACK_FAILURE, PopCallbackResult());
1745 EXPECT_EQ(0, observer_.num_changes()); 1843 EXPECT_EQ(0, observer_.num_changes());
1746 EXPECT_EQ(1, observer_.num_failures()); 1844 EXPECT_EQ(1, observer_.num_failures());
1747 1845
1748 const int kDualHeight = small_mode_.size().height() + 1846 const int kDualHeight = small_mode_.size().height() +
1749 DisplayConfigurator::kVerticalGap + 1847 DisplayConfigurator::kVerticalGap +
1750 big_mode_.size().height(); 1848 big_mode_.size().height();
1751 1849
1752 EXPECT_EQ( 1850 EXPECT_EQ(
1753 JoinActions( 1851 JoinActions(
1754 kGrab, 1852 kGrab,
1755 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 1853 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
1756 outputs_[0].get(), outputs_[1].get()) 1854 outputs_[0].get(), outputs_[1].get())
1757 .c_str(), 1855 .c_str(),
1758 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1856 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1759 GetCrtcAction(*outputs_[1], nullptr, 1857 GetCrtcAction(*outputs_[1], nullptr,
1760 gfx::Point(0, small_mode_.size().height() + 1858 gfx::Point(0, small_mode_.size().height() +
1761 DisplayConfigurator::kVerticalGap)) 1859 DisplayConfigurator::kVerticalGap))
1762 .c_str(), 1860 .c_str(),
1763 kUngrab, nullptr), 1861 kUngrab, nullptr),
1764 log_->GetActionsAndClear()); 1862 log_->GetActionsAndClear());
1765 1863
1766 // This configuration should trigger a display configuration since the 1864 // This configuration should trigger a display configuration since the
1767 // previous configuration failed. 1865 // previous configuration failed.
1768 configurator_.SetDisplayPower( 1866 config_waiter_.Reset();
1769 chromeos::DISPLAY_POWER_ALL_ON, 1867 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
1770 DisplayConfigurator::kSetDisplayPowerNoFlags, 1868 DisplayConfigurator::kSetDisplayPowerNoFlags,
1771 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1869 config_waiter_.on_configuration_callback());
1772 base::Unretained(this))); 1870 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1773 1871
1774 EXPECT_EQ(0, observer_.num_changes()); 1872 EXPECT_EQ(0, observer_.num_changes());
1775 EXPECT_EQ(2, observer_.num_failures()); 1873 EXPECT_EQ(2, observer_.num_failures());
1776 EXPECT_EQ( 1874 EXPECT_EQ(
1777 JoinActions( 1875 JoinActions(
1778 kGrab, 1876 kGrab,
1779 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 1877 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
1780 outputs_[0].get(), outputs_[1].get()) 1878 outputs_[0].get(), outputs_[1].get())
1781 .c_str(), 1879 .c_str(),
1782 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1880 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 GetCrtcAction( 1946 GetCrtcAction(
1849 *outputs_[2], &small_mode_, 1947 *outputs_[2], &small_mode_,
1850 gfx::Point(0, small_mode_.size().height() + 1948 gfx::Point(0, small_mode_.size().height() +
1851 big_mode_.size().height() + 1949 big_mode_.size().height() +
1852 2 * DisplayConfigurator::kVerticalGap)) 1950 2 * DisplayConfigurator::kVerticalGap))
1853 .c_str(), 1951 .c_str(),
1854 kUngrab, nullptr), 1952 kUngrab, nullptr),
1855 log_->GetActionsAndClear()); 1953 log_->GetActionsAndClear());
1856 1954
1857 // Verify that turning the power off works. 1955 // Verify that turning the power off works.
1858 configurator_.SetDisplayPower( 1956 config_waiter_.Reset();
1859 chromeos::DISPLAY_POWER_ALL_OFF, 1957 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
1860 DisplayConfigurator::kSetDisplayPowerNoFlags, 1958 DisplayConfigurator::kSetDisplayPowerNoFlags,
1861 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1959 config_waiter_.on_configuration_callback());
1862 base::Unretained(this))); 1960 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1863 1961 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1864 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
1865 EXPECT_EQ( 1962 EXPECT_EQ(
1866 JoinActions( 1963 JoinActions(
1867 kGrab, GetFramebufferAction( 1964 kGrab, GetFramebufferAction(
1868 gfx::Size(big_mode_.size().width(), kTripleHeight), 1965 gfx::Size(big_mode_.size().width(), kTripleHeight),
1869 outputs_[0].get(), outputs_[1].get()) 1966 outputs_[0].get(), outputs_[1].get())
1870 .c_str(), 1967 .c_str(),
1871 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(), 1968 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
1872 GetCrtcAction(*outputs_[1], nullptr, 1969 GetCrtcAction(*outputs_[1], nullptr,
1873 gfx::Point(0, small_mode_.size().height() + 1970 gfx::Point(0, small_mode_.size().height() +
1874 DisplayConfigurator::kVerticalGap)) 1971 DisplayConfigurator::kVerticalGap))
1875 .c_str(), 1972 .c_str(),
1876 GetCrtcAction( 1973 GetCrtcAction(
1877 *outputs_[2], nullptr, 1974 *outputs_[2], nullptr,
1878 gfx::Point(0, small_mode_.size().height() + 1975 gfx::Point(0, small_mode_.size().height() +
1879 big_mode_.size().height() + 1976 big_mode_.size().height() +
1880 2 * DisplayConfigurator::kVerticalGap)) 1977 2 * DisplayConfigurator::kVerticalGap))
1881 .c_str(), 1978 .c_str(),
1882 kUngrab, nullptr), 1979 kUngrab, nullptr),
1883 log_->GetActionsAndClear()); 1980 log_->GetActionsAndClear());
1884 1981
1885 configurator_.SetDisplayPower( 1982 config_waiter_.Reset();
1886 chromeos::DISPLAY_POWER_ALL_ON, 1983 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
1887 DisplayConfigurator::kSetDisplayPowerNoFlags, 1984 DisplayConfigurator::kSetDisplayPowerNoFlags,
1888 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, 1985 config_waiter_.on_configuration_callback());
1889 base::Unretained(this))); 1986 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
1890 1987 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
1891 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
1892 EXPECT_EQ( 1988 EXPECT_EQ(
1893 JoinActions( 1989 JoinActions(
1894 kGrab, GetFramebufferAction( 1990 kGrab, GetFramebufferAction(
1895 gfx::Size(big_mode_.size().width(), kTripleHeight), 1991 gfx::Size(big_mode_.size().width(), kTripleHeight),
1896 outputs_[0].get(), outputs_[1].get()) 1992 outputs_[0].get(), outputs_[1].get())
1897 .c_str(), 1993 .c_str(),
1898 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 1994 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1899 GetCrtcAction(*outputs_[1], &big_mode_, 1995 GetCrtcAction(*outputs_[1], &big_mode_,
1900 gfx::Point(0, small_mode_.size().height() + 1996 gfx::Point(0, small_mode_.size().height() +
1901 DisplayConfigurator::kVerticalGap)) 1997 DisplayConfigurator::kVerticalGap))
(...skipping 19 matching lines...) Expand all
1921 .c_str(), 2017 .c_str(),
1922 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 2018 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
1923 GetCrtcAction(*outputs_[1], &big_mode_, 2019 GetCrtcAction(*outputs_[1], &big_mode_,
1924 gfx::Point(0, small_mode_.size().height() + 2020 gfx::Point(0, small_mode_.size().height() +
1925 DisplayConfigurator::kVerticalGap)) 2021 DisplayConfigurator::kVerticalGap))
1926 .c_str(), 2022 .c_str(),
1927 kUngrab, nullptr), 2023 kUngrab, nullptr),
1928 log_->GetActionsAndClear()); 2024 log_->GetActionsAndClear());
1929 } 2025 }
1930 2026
2027 // Tests the suspend and resume behavior when in dual or multi display modes.
2028 TEST_F(DisplayConfiguratorTest, SuspendResumeWithMultipleDisplays) {
2029 InitWithSingleOutput();
2030 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
2031 observer_.Reset();
2032 UpdateOutputs(2, true);
2033 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
2034 configurator_.display_state());
2035 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
2036 EXPECT_EQ(1, observer_.num_changes());
2037 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON,
2038 configurator_.current_power_state());
2039 const int kDualHeight = small_mode_.size().height() +
2040 DisplayConfigurator::kVerticalGap +
2041 big_mode_.size().height();
2042 EXPECT_EQ(
2043 JoinActions(
2044 kGrab,
2045 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
2046 outputs_[0].get(), outputs_[1].get())
2047 .c_str(),
2048 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
2049 GetCrtcAction(*outputs_[1], &big_mode_,
2050 gfx::Point(0, small_mode_.size().height() +
2051 DisplayConfigurator::kVerticalGap))
2052 .c_str(),
2053 kUngrab, nullptr),
2054 log_->GetActionsAndClear());
2055
2056 // Suspending displays should result in an immediate configuration without
2057 // delays, even in dual display mode.
2058 config_waiter_.Reset();
2059 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
2060 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
2061 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
2062 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_OFF,
2063 configurator_.current_power_state());
2064 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
2065 configurator_.display_state());
2066 EXPECT_EQ(
2067 JoinActions(
2068 kGrab,
2069 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
2070 outputs_[0].get(), outputs_[1].get())
2071 .c_str(),
2072 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
2073 GetCrtcAction(*outputs_[1], nullptr,
2074 gfx::Point(0, small_mode_.size().height() +
2075 DisplayConfigurator::kVerticalGap))
2076 .c_str(),
2077 kUngrab, kSync, nullptr),
2078 log_->GetActionsAndClear());
2079
2080 // Resuming from suspend with dual displays. Configuration should be done
2081 // after a long delay. Afterwards, we should still expect to be in a dual
2082 // display mode.
2083 config_waiter_.Reset();
2084 configurator_.ResumeDisplays();
2085 EXPECT_EQ(kLongDelayMs, config_waiter_.Wait());
2086 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON,
2087 configurator_.current_power_state());
2088 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
2089 configurator_.display_state());
2090 EXPECT_EQ(
2091 JoinActions(
2092 kGrab,
2093 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
2094 outputs_[0].get(), outputs_[1].get())
2095 .c_str(),
2096 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
2097 GetCrtcAction(*outputs_[1], &big_mode_,
2098 gfx::Point(0, small_mode_.size().height() +
2099 DisplayConfigurator::kVerticalGap))
2100 .c_str(),
2101 kForceDPMS, kUngrab, nullptr),
2102 log_->GetActionsAndClear());
2103
2104 // Suspend displays and disconnect one of them while in suspend.
2105 config_waiter_.Reset();
2106 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
2107 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
2108 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
2109 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
2110 configurator_.display_state());
2111 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_OFF,
2112 configurator_.current_power_state());
2113 EXPECT_EQ(
2114 JoinActions(
2115 kGrab,
2116 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
2117 outputs_[0].get(), outputs_[1].get())
2118 .c_str(),
2119 GetCrtcAction(*outputs_[0], nullptr, gfx::Point(0, 0)).c_str(),
2120 GetCrtcAction(*outputs_[1], nullptr,
2121 gfx::Point(0, small_mode_.size().height() +
2122 DisplayConfigurator::kVerticalGap))
2123 .c_str(),
2124 kUngrab, kSync, nullptr),
2125 log_->GetActionsAndClear());
2126 UpdateOutputs(1, false);
2127 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
2128
2129 // Now resume, and expect that we'll still have a long delay since we were in
2130 // dual mode before suspend. The configurator should pick up the change and
2131 // detect that we are in single display mode now.
2132 config_waiter_.Reset();
2133 configurator_.ResumeDisplays();
2134 EXPECT_EQ(kLongDelayMs, config_waiter_.Wait());
2135 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON,
2136 configurator_.current_power_state());
2137 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state());
2138 EXPECT_EQ(
2139 JoinActions(
2140 kGrab,
2141 GetFramebufferAction(small_mode_.size(), outputs_[0].get(), nullptr)
2142 .c_str(),
2143 GetCrtcAction(*outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
2144 kForceDPMS, kUngrab, nullptr),
2145 log_->GetActionsAndClear());
2146
2147 // Verify that the above is the exact same behavior for 3+ displays.
2148 UpdateOutputs(3, true);
2149 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED,
2150 configurator_.display_state());
2151
2152 // Suspend.
2153 config_waiter_.Reset();
2154 configurator_.SuspendDisplays(config_waiter_.on_configuration_callback());
2155 EXPECT_EQ(kNoDelay, config_waiter_.Wait());
2156 EXPECT_EQ(CALLBACK_SUCCESS, config_waiter_.callback_result());
2157 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED,
2158 configurator_.display_state());
2159 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_OFF,
2160 configurator_.current_power_state());
2161
2162 // Resume and expect the correct delay.
2163 config_waiter_.Reset();
2164 configurator_.ResumeDisplays();
2165 EXPECT_EQ(kLongDelayMs, config_waiter_.Wait());
2166 EXPECT_EQ(chromeos::DISPLAY_POWER_ALL_ON,
2167 configurator_.current_power_state());
2168 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED,
2169 configurator_.display_state());
2170 }
2171
1931 } // namespace test 2172 } // namespace test
1932 } // namespace ui 2173 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698