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