| 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/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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 // No preparation is needed before suspending when the display is already | 834 // No preparation is needed before suspending when the display is already |
| 835 // on. The configurator should still reprobe on resume in case a display | 835 // on. The configurator should still reprobe on resume in case a display |
| 836 // was connected while suspended. | 836 // was connected while suspended. |
| 837 const gfx::Size framebuffer_size = configurator_.framebuffer_size(); | 837 const gfx::Size framebuffer_size = configurator_.framebuffer_size(); |
| 838 DCHECK(!framebuffer_size.IsEmpty()); | 838 DCHECK(!framebuffer_size.IsEmpty()); |
| 839 configurator_.SuspendDisplays(base::Bind( | 839 configurator_.SuspendDisplays(base::Bind( |
| 840 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); | 840 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); |
| 841 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 841 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 842 EXPECT_EQ(framebuffer_size.ToString(), | 842 EXPECT_EQ(framebuffer_size.ToString(), |
| 843 configurator_.framebuffer_size().ToString()); | 843 configurator_.framebuffer_size().ToString()); |
| 844 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | |
| 845 configurator_.ResumeDisplays(); | |
| 846 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | |
| 847 EXPECT_EQ( | 844 EXPECT_EQ( |
| 848 JoinActions( | 845 JoinActions( |
| 849 kGrab, | 846 kGrab, |
| 847 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 848 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 849 kUngrab, |
| 850 kSync, |
| 851 NULL), |
| 852 log_->GetActionsAndClear()); |
| 853 configurator_.ResumeDisplays(); |
| 854 EXPECT_EQ( |
| 855 JoinActions( |
| 856 kGrab, |
| 850 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 857 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 851 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 858 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 852 kForceDPMS, | 859 kForceDPMS, |
| 853 kUngrab, | 860 kUngrab, |
| 854 NULL), | 861 NULL), |
| 855 log_->GetActionsAndClear()); | 862 log_->GetActionsAndClear()); |
| 856 | 863 |
| 857 // Now turn the display off before suspending and check that the | 864 // Now turn the display off before suspending and check that the |
| 858 // configurator turns it back on and syncs with the server. | 865 // configurator turns it back on and syncs with the server. |
| 859 configurator_.SetDisplayPower( | 866 configurator_.SetDisplayPower( |
| 860 chromeos::DISPLAY_POWER_ALL_OFF, | 867 chromeos::DISPLAY_POWER_ALL_OFF, |
| 861 DisplayConfigurator::kSetDisplayPowerNoFlags, | 868 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| 862 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, | 869 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, |
| 863 base::Unretained(this))); | 870 base::Unretained(this))); |
| 864 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 871 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 865 EXPECT_EQ( | 872 EXPECT_EQ( |
| 866 JoinActions( | 873 JoinActions( |
| 867 kGrab, | 874 kGrab, |
| 868 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 875 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 869 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), | 876 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 870 kUngrab, | 877 kUngrab, |
| 871 NULL), | 878 NULL), |
| 872 log_->GetActionsAndClear()); | 879 log_->GetActionsAndClear()); |
| 873 | 880 |
| 874 configurator_.SuspendDisplays(base::Bind( | 881 configurator_.SuspendDisplays(base::Bind( |
| 875 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); | 882 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); |
| 876 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 883 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 884 EXPECT_EQ(kSync, log_->GetActionsAndClear()); |
| 885 |
| 886 configurator_.ResumeDisplays(); |
| 877 EXPECT_EQ( | 887 EXPECT_EQ( |
| 878 JoinActions( | 888 JoinActions( |
| 879 kGrab, | 889 kGrab, |
| 880 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | |
| 881 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | |
| 882 kForceDPMS, | |
| 883 kUngrab, | |
| 884 kSync, | |
| 885 NULL), | |
| 886 log_->GetActionsAndClear()); | |
| 887 | |
| 888 configurator_.ResumeDisplays(); | |
| 889 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | |
| 890 EXPECT_EQ( | |
| 891 JoinActions( | |
| 892 kGrab, | |
| 893 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 890 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 894 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 891 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 895 kForceDPMS, | 892 kForceDPMS, |
| 896 kUngrab, | 893 kUngrab, |
| 897 NULL), | 894 NULL), |
| 898 log_->GetActionsAndClear()); | 895 log_->GetActionsAndClear()); |
| 899 | 896 |
| 900 // If a second, external display is connected, the displays shouldn't be | 897 // If a second, external display is connected, the displays shouldn't be |
| 901 // powered back on before suspending. | 898 // powered back on before suspending. |
| 902 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 899 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 924 small_mode_.size(), &outputs_[0], &outputs_[1]).c_str(), | 921 small_mode_.size(), &outputs_[0], &outputs_[1]).c_str(), |
| 925 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), | 922 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 926 GetCrtcAction(outputs_[1], NULL, gfx::Point(0, 0)).c_str(), | 923 GetCrtcAction(outputs_[1], NULL, gfx::Point(0, 0)).c_str(), |
| 927 kUngrab, | 924 kUngrab, |
| 928 NULL), | 925 NULL), |
| 929 log_->GetActionsAndClear()); | 926 log_->GetActionsAndClear()); |
| 930 | 927 |
| 931 configurator_.SuspendDisplays(base::Bind( | 928 configurator_.SuspendDisplays(base::Bind( |
| 932 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); | 929 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); |
| 933 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 930 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 934 EXPECT_EQ(JoinActions(kGrab, kUngrab, kSync, NULL), | 931 EXPECT_EQ(kSync, log_->GetActionsAndClear()); |
| 935 log_->GetActionsAndClear()); | |
| 936 | 932 |
| 937 // If a display is disconnected while suspended, the configurator should | 933 // If a display is disconnected while suspended, the configurator should |
| 938 // pick up the change. | 934 // pick up the change and only turn on the internal display. |
| 939 UpdateOutputs(1, false); | 935 UpdateOutputs(1, false); |
| 940 configurator_.ResumeDisplays(); | 936 configurator_.ResumeDisplays(); |
| 941 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | |
| 942 EXPECT_EQ( | 937 EXPECT_EQ( |
| 943 JoinActions( | 938 JoinActions( |
| 944 kGrab, | 939 kGrab, |
| 945 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 940 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 946 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), | 941 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 942 kForceDPMS, |
| 947 kUngrab, | 943 kUngrab, |
| 948 NULL), | 944 NULL), |
| 949 log_->GetActionsAndClear()); | 945 log_->GetActionsAndClear()); |
| 950 } | 946 } |
| 951 | 947 |
| 952 TEST_F(DisplayConfiguratorTest, Headless) { | 948 TEST_F(DisplayConfiguratorTest, Headless) { |
| 953 UpdateOutputs(0, false); | 949 UpdateOutputs(0, false); |
| 954 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 950 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 955 Init(false); | 951 Init(false); |
| 956 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 952 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) { | 1194 TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) { |
| 1199 InitWithSingleOutput(); | 1195 InitWithSingleOutput(); |
| 1200 | 1196 |
| 1201 // The DisplayConfigurator may occasionally receive OnConfigurationChanged() | 1197 // The DisplayConfigurator may occasionally receive OnConfigurationChanged() |
| 1202 // after the displays have been suspended. This event should be ignored since | 1198 // after the displays have been suspended. This event should be ignored since |
| 1203 // the DisplayConfigurator will force a probe and reconfiguration of displays | 1199 // the DisplayConfigurator will force a probe and reconfiguration of displays |
| 1204 // at resume time. | 1200 // at resume time. |
| 1205 configurator_.SuspendDisplays(base::Bind( | 1201 configurator_.SuspendDisplays(base::Bind( |
| 1206 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); | 1202 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); |
| 1207 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 1203 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 1208 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1204 EXPECT_EQ( |
| 1205 JoinActions( |
| 1206 kGrab, |
| 1207 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 1208 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 1209 kUngrab, |
| 1210 kSync, |
| 1211 NULL), |
| 1212 log_->GetActionsAndClear()); |
| 1209 | 1213 |
| 1210 // The configuration timer should not be started when the displays | 1214 // The configuration timer should not be started when the displays |
| 1211 // are suspended. | 1215 // are suspended. |
| 1212 configurator_.OnConfigurationChanged(); | 1216 configurator_.OnConfigurationChanged(); |
| 1213 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); | 1217 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); |
| 1214 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1218 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1215 | 1219 |
| 1216 // Calls to SetDisplayPower and SetDisplayMode should be successful. | 1220 // Calls to SetDisplayPower should do nothing if the power state doesn't |
| 1221 // change. |
| 1217 configurator_.SetDisplayPower( | 1222 configurator_.SetDisplayPower( |
| 1218 chromeos::DISPLAY_POWER_ALL_OFF, | 1223 chromeos::DISPLAY_POWER_ALL_OFF, |
| 1219 DisplayConfigurator::kSetDisplayPowerNoFlags, | 1224 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| 1220 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, | 1225 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, |
| 1221 base::Unretained(this))); | 1226 base::Unretained(this))); |
| 1222 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 1227 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 1223 EXPECT_EQ( | 1228 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1224 JoinActions( | |
| 1225 kGrab, | |
| 1226 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | |
| 1227 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), | |
| 1228 kUngrab, | |
| 1229 NULL), | |
| 1230 log_->GetActionsAndClear()); | |
| 1231 configurator_.SetDisplayPower( | 1229 configurator_.SetDisplayPower( |
| 1232 chromeos::DISPLAY_POWER_ALL_ON, | 1230 chromeos::DISPLAY_POWER_ALL_ON, |
| 1233 DisplayConfigurator::kSetDisplayPowerNoFlags, | 1231 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| 1234 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, | 1232 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, |
| 1235 base::Unretained(this))); | 1233 base::Unretained(this))); |
| 1236 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 1234 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 1237 EXPECT_EQ( | 1235 EXPECT_EQ( |
| 1238 JoinActions( | 1236 JoinActions( |
| 1239 kGrab, | 1237 kGrab, |
| 1240 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 1238 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1254 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1252 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1255 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), | 1253 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1256 kUngrab, | 1254 kUngrab, |
| 1257 NULL), | 1255 NULL), |
| 1258 log_->GetActionsAndClear()); | 1256 log_->GetActionsAndClear()); |
| 1259 | 1257 |
| 1260 // The DisplayConfigurator should force a probe and reconfiguration at resume | 1258 // The DisplayConfigurator should force a probe and reconfiguration at resume |
| 1261 // time. | 1259 // time. |
| 1262 UpdateOutputs(1, false); | 1260 UpdateOutputs(1, false); |
| 1263 configurator_.ResumeDisplays(); | 1261 configurator_.ResumeDisplays(); |
| 1264 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | |
| 1265 EXPECT_EQ( | 1262 EXPECT_EQ( |
| 1266 JoinActions( | 1263 JoinActions( |
| 1267 kGrab, | 1264 kGrab, |
| 1268 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 1265 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 1269 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1266 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1270 kForceDPMS, | 1267 kForceDPMS, |
| 1271 kUngrab, | 1268 kUngrab, |
| 1272 NULL), | 1269 NULL), |
| 1273 log_->GetActionsAndClear()); | 1270 log_->GetActionsAndClear()); |
| 1274 | 1271 |
| 1275 // If a configuration task is pending when the displays are suspended, that | 1272 // If a configuration task is pending when the displays are suspended, that |
| 1276 // task should not run either and the timer should be stopped. | 1273 // task should not run either and the timer should be stopped. The displays |
| 1274 // should be turned off by suspend. |
| 1277 configurator_.OnConfigurationChanged(); | 1275 configurator_.OnConfigurationChanged(); |
| 1278 configurator_.SuspendDisplays(base::Bind( | 1276 configurator_.SuspendDisplays(base::Bind( |
| 1279 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); | 1277 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); |
| 1280 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 1278 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 1281 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1279 EXPECT_EQ( |
| 1280 JoinActions( |
| 1281 kGrab, |
| 1282 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 1283 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 1284 kUngrab, |
| 1285 kSync, |
| 1286 NULL), |
| 1287 log_->GetActionsAndClear()); |
| 1282 | 1288 |
| 1283 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); | 1289 EXPECT_FALSE(test_api_.TriggerConfigureTimeout()); |
| 1284 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1290 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1285 | 1291 |
| 1286 configurator_.ResumeDisplays(); | 1292 configurator_.ResumeDisplays(); |
| 1287 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | |
| 1288 EXPECT_EQ( | 1293 EXPECT_EQ( |
| 1289 JoinActions( | 1294 JoinActions( |
| 1290 kGrab, | 1295 kGrab, |
| 1291 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 1296 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 1292 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1297 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1293 kForceDPMS, | 1298 kForceDPMS, |
| 1294 kUngrab, | 1299 kUngrab, |
| 1295 NULL), | 1300 NULL), |
| 1296 log_->GetActionsAndClear()); | 1301 log_->GetActionsAndClear()); |
| 1297 } | 1302 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 kGrab, | 1562 kGrab, |
| 1558 GetFramebufferAction(big_mode_.size(), &outputs_[0], &outputs_[1]) | 1563 GetFramebufferAction(big_mode_.size(), &outputs_[0], &outputs_[1]) |
| 1559 .c_str(), | 1564 .c_str(), |
| 1560 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), | 1565 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 1561 GetCrtcAction(outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(), | 1566 GetCrtcAction(outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(), |
| 1562 kForceDPMS, | 1567 kForceDPMS, |
| 1563 kUngrab, | 1568 kUngrab, |
| 1564 NULL), | 1569 NULL), |
| 1565 log_->GetActionsAndClear()); | 1570 log_->GetActionsAndClear()); |
| 1566 | 1571 |
| 1567 // Suspend and resume the system. Resuming should post a task to restore the | 1572 // Suspend and resume the system. Resuming should restore the previous power |
| 1568 // previous power state, additionally forcing a probe. | 1573 // state and force a probe. Suspend should turn off the displays since an |
| 1574 // external monitor is connected. |
| 1569 configurator_.SuspendDisplays(base::Bind( | 1575 configurator_.SuspendDisplays(base::Bind( |
| 1570 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); | 1576 &DisplayConfiguratorTest::OnConfiguredCallback, base::Unretained(this))); |
| 1571 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 1577 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 1572 configurator_.ResumeDisplays(); | 1578 EXPECT_EQ(2, observer_.num_changes()); |
| 1579 EXPECT_EQ( |
| 1580 JoinActions( |
| 1581 kGrab, |
| 1582 GetFramebufferAction(small_mode_.size(), &outputs_[0], |
| 1583 &outputs_[1]).c_str(), |
| 1584 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 1585 GetCrtcAction(outputs_[1], NULL, gfx::Point(0, 0)).c_str(), |
| 1586 kUngrab, |
| 1587 kSync, |
| 1588 NULL), |
| 1589 log_->GetActionsAndClear()); |
| 1573 | 1590 |
| 1574 // Before the task runs, exit docked mode. | 1591 // Before the task runs, exit docked mode. |
| 1575 configurator_.SetDisplayPower( | 1592 configurator_.SetDisplayPower( |
| 1576 chromeos::DISPLAY_POWER_ALL_ON, | 1593 chromeos::DISPLAY_POWER_ALL_ON, |
| 1577 DisplayConfigurator::kSetDisplayPowerNoFlags, | 1594 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| 1578 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, | 1595 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, |
| 1579 base::Unretained(this))); | 1596 base::Unretained(this))); |
| 1580 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); | 1597 EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult()); |
| 1581 EXPECT_EQ(2, observer_.num_changes()); | 1598 EXPECT_EQ(3, observer_.num_changes()); |
| 1582 EXPECT_EQ(0, observer_.num_failures()); | 1599 EXPECT_EQ(0, observer_.num_failures()); |
| 1583 EXPECT_EQ( | 1600 EXPECT_EQ( |
| 1584 JoinActions( | 1601 JoinActions( |
| 1585 kGrab, | 1602 kGrab, |
| 1586 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) | 1603 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) |
| 1587 .c_str(), | 1604 .c_str(), |
| 1588 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1605 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1589 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), | 1606 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1590 kForceDPMS, | 1607 kForceDPMS, |
| 1591 kUngrab, | 1608 kUngrab, |
| 1592 NULL), | 1609 NULL), |
| 1593 log_->GetActionsAndClear()); | 1610 log_->GetActionsAndClear()); |
| 1594 | 1611 |
| 1595 // Check that the task doesn't restore the old internal-off-external-on power | 1612 // Check that the display states are not changed after resuming. |
| 1596 // state. | 1613 configurator_.ResumeDisplays(); |
| 1597 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | |
| 1598 EXPECT_EQ( | 1614 EXPECT_EQ( |
| 1599 JoinActions( | 1615 JoinActions( |
| 1600 kGrab, | 1616 kGrab, |
| 1601 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) | 1617 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) |
| 1602 .c_str(), | 1618 .c_str(), |
| 1603 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1619 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1604 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), | 1620 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1605 kForceDPMS, | 1621 kForceDPMS, |
| 1606 kUngrab, | 1622 kUngrab, |
| 1607 NULL), | 1623 NULL), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1628 GetFramebufferAction(small_mode_.size(), &outputs_[0], | 1644 GetFramebufferAction(small_mode_.size(), &outputs_[0], |
| 1629 nullptr).c_str(), | 1645 nullptr).c_str(), |
| 1630 GetCrtcAction(outputs_[0], &small_mode_, | 1646 GetCrtcAction(outputs_[0], &small_mode_, |
| 1631 gfx::Point(0, 0)).c_str(), | 1647 gfx::Point(0, 0)).c_str(), |
| 1632 kUngrab, NULL), | 1648 kUngrab, NULL), |
| 1633 log_->GetActionsAndClear()); | 1649 log_->GetActionsAndClear()); |
| 1634 } | 1650 } |
| 1635 | 1651 |
| 1636 } // namespace test | 1652 } // namespace test |
| 1637 } // namespace ui | 1653 } // namespace ui |
| OLD | NEW |