| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 for (size_t i = 0; i < num_outputs; ++i) | 205 for (size_t i = 0; i < num_outputs; ++i) |
| 206 outputs.push_back(&outputs_[i]); | 206 outputs.push_back(&outputs_[i]); |
| 207 native_display_delegate_->set_outputs(outputs); | 207 native_display_delegate_->set_outputs(outputs); |
| 208 | 208 |
| 209 if (send_events) { | 209 if (send_events) { |
| 210 configurator_.OnConfigurationChanged(); | 210 configurator_.OnConfigurationChanged(); |
| 211 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); | 211 EXPECT_TRUE(test_api_.TriggerConfigureTimeout()); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void Init(bool panel_fitting_enabled) { |
| 216 configurator_.Init(std::unique_ptr<NativeDisplayDelegate>(), |
| 217 panel_fitting_enabled); |
| 218 } |
| 219 |
| 215 // Initializes |configurator_| with a single internal display. | 220 // Initializes |configurator_| with a single internal display. |
| 216 void InitWithSingleOutput() { | 221 void InitWithSingleOutput() { |
| 217 UpdateOutputs(1, false); | 222 UpdateOutputs(1, false); |
| 218 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 223 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 219 configurator_.Init(false); | 224 configurator_.Init(std::unique_ptr<NativeDisplayDelegate>(), false); |
| 225 |
| 220 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 226 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 221 configurator_.ForceInitialConfigure(0); | 227 configurator_.ForceInitialConfigure(0); |
| 222 EXPECT_EQ(JoinActions(kInitXRandR, kGrab, | 228 EXPECT_EQ(JoinActions(kInitXRandR, kGrab, |
| 223 GetFramebufferAction(small_mode_.size(), &outputs_[0], | 229 GetFramebufferAction(small_mode_.size(), &outputs_[0], |
| 224 NULL).c_str(), | 230 NULL).c_str(), |
| 225 GetCrtcAction(outputs_[0], &small_mode_, | 231 GetCrtcAction(outputs_[0], &small_mode_, |
| 226 gfx::Point(0, 0)).c_str(), | 232 gfx::Point(0, 0)).c_str(), |
| 227 kForceDPMS, kUngrab, NULL), | 233 kForceDPMS, kUngrab, NULL), |
| 228 log_->GetActionsAndClear()); | 234 log_->GetActionsAndClear()); |
| 229 } | 235 } |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), | 945 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), |
| 940 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), | 946 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), |
| 941 kUngrab, | 947 kUngrab, |
| 942 NULL), | 948 NULL), |
| 943 log_->GetActionsAndClear()); | 949 log_->GetActionsAndClear()); |
| 944 } | 950 } |
| 945 | 951 |
| 946 TEST_F(DisplayConfiguratorTest, Headless) { | 952 TEST_F(DisplayConfiguratorTest, Headless) { |
| 947 UpdateOutputs(0, false); | 953 UpdateOutputs(0, false); |
| 948 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 954 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 949 configurator_.Init(false); | 955 Init(false); |
| 950 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 956 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 951 configurator_.ForceInitialConfigure(0); | 957 configurator_.ForceInitialConfigure(0); |
| 952 EXPECT_EQ(JoinActions(kInitXRandR, kGrab, kForceDPMS, kUngrab, NULL), | 958 EXPECT_EQ(JoinActions(kInitXRandR, kGrab, kForceDPMS, kUngrab, NULL), |
| 953 log_->GetActionsAndClear()); | 959 log_->GetActionsAndClear()); |
| 954 | 960 |
| 955 // Not much should happen when the display power state is changed while | 961 // Not much should happen when the display power state is changed while |
| 956 // no displays are connected. | 962 // no displays are connected. |
| 957 configurator_.SetDisplayPower( | 963 configurator_.SetDisplayPower( |
| 958 chromeos::DISPLAY_POWER_ALL_OFF, | 964 chromeos::DISPLAY_POWER_ALL_OFF, |
| 959 DisplayConfigurator::kSetDisplayPowerNoFlags, | 965 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 990 | 996 |
| 991 UpdateOutputs(0, true); | 997 UpdateOutputs(0, true); |
| 992 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_->GetActionsAndClear()); | 998 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_->GetActionsAndClear()); |
| 993 EXPECT_EQ(framebuffer_size.ToString(), | 999 EXPECT_EQ(framebuffer_size.ToString(), |
| 994 configurator_.framebuffer_size().ToString()); | 1000 configurator_.framebuffer_size().ToString()); |
| 995 } | 1001 } |
| 996 | 1002 |
| 997 TEST_F(DisplayConfiguratorTest, StartWithTwoOutputs) { | 1003 TEST_F(DisplayConfiguratorTest, StartWithTwoOutputs) { |
| 998 UpdateOutputs(2, false); | 1004 UpdateOutputs(2, false); |
| 999 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1005 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1000 configurator_.Init(false); | 1006 Init(false); |
| 1001 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1007 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1002 | 1008 |
| 1003 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 1009 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 1004 configurator_.ForceInitialConfigure(0); | 1010 configurator_.ForceInitialConfigure(0); |
| 1005 EXPECT_EQ( | 1011 EXPECT_EQ( |
| 1006 JoinActions( | 1012 JoinActions( |
| 1007 kInitXRandR, kGrab, | 1013 kInitXRandR, kGrab, |
| 1008 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) | 1014 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) |
| 1009 .c_str(), | 1015 .c_str(), |
| 1010 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1016 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1011 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), | 1017 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1012 kForceDPMS, kUngrab, NULL), | 1018 kForceDPMS, kUngrab, NULL), |
| 1013 log_->GetActionsAndClear()); | 1019 log_->GetActionsAndClear()); |
| 1014 } | 1020 } |
| 1015 | 1021 |
| 1016 TEST_F(DisplayConfiguratorTest, InvalidMultipleDisplayStates) { | 1022 TEST_F(DisplayConfiguratorTest, InvalidMultipleDisplayStates) { |
| 1017 UpdateOutputs(0, false); | 1023 UpdateOutputs(0, false); |
| 1018 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1024 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1019 configurator_.Init(false); | 1025 Init(false); |
| 1020 configurator_.ForceInitialConfigure(0); | 1026 configurator_.ForceInitialConfigure(0); |
| 1021 observer_.Reset(); | 1027 observer_.Reset(); |
| 1022 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_HEADLESS); | 1028 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_HEADLESS); |
| 1023 EXPECT_EQ(1, observer_.num_changes()); | 1029 EXPECT_EQ(1, observer_.num_changes()); |
| 1024 EXPECT_EQ(0, observer_.num_failures()); | 1030 EXPECT_EQ(0, observer_.num_failures()); |
| 1025 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_SINGLE); | 1031 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_SINGLE); |
| 1026 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 1032 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 1027 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); | 1033 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); |
| 1028 EXPECT_EQ(1, observer_.num_changes()); | 1034 EXPECT_EQ(1, observer_.num_changes()); |
| 1029 EXPECT_EQ(3, observer_.num_failures()); | 1035 EXPECT_EQ(3, observer_.num_failures()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1049 EXPECT_EQ(0, observer_.num_changes()); | 1055 EXPECT_EQ(0, observer_.num_changes()); |
| 1050 EXPECT_EQ(2, observer_.num_failures()); | 1056 EXPECT_EQ(2, observer_.num_failures()); |
| 1051 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 1057 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 1052 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); | 1058 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); |
| 1053 EXPECT_EQ(2, observer_.num_changes()); | 1059 EXPECT_EQ(2, observer_.num_changes()); |
| 1054 EXPECT_EQ(2, observer_.num_failures()); | 1060 EXPECT_EQ(2, observer_.num_failures()); |
| 1055 } | 1061 } |
| 1056 | 1062 |
| 1057 TEST_F(DisplayConfiguratorTest, GetMultipleDisplayStateForMirroredDisplays) { | 1063 TEST_F(DisplayConfiguratorTest, GetMultipleDisplayStateForMirroredDisplays) { |
| 1058 UpdateOutputs(2, false); | 1064 UpdateOutputs(2, false); |
| 1059 configurator_.Init(false); | 1065 Init(false); |
| 1060 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 1066 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 1061 configurator_.ForceInitialConfigure(0); | 1067 configurator_.ForceInitialConfigure(0); |
| 1062 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); | 1068 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); |
| 1063 } | 1069 } |
| 1064 | 1070 |
| 1065 TEST_F(DisplayConfiguratorTest, UpdateCachedOutputsEvenAfterFailure) { | 1071 TEST_F(DisplayConfiguratorTest, UpdateCachedOutputsEvenAfterFailure) { |
| 1066 InitWithSingleOutput(); | 1072 InitWithSingleOutput(); |
| 1067 const DisplayConfigurator::DisplayStateList& cached = | 1073 const DisplayConfigurator::DisplayStateList& cached = |
| 1068 configurator_.cached_displays(); | 1074 configurator_.cached_displays(); |
| 1069 ASSERT_EQ(static_cast<size_t>(1), cached.size()); | 1075 ASSERT_EQ(static_cast<size_t>(1), cached.size()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1086 outputs_[0].set_modes(std::vector<const DisplayMode*>(1, &big_mode_)); | 1092 outputs_[0].set_modes(std::vector<const DisplayMode*>(1, &big_mode_)); |
| 1087 | 1093 |
| 1088 outputs_[1].set_current_mode(&small_mode_); | 1094 outputs_[1].set_current_mode(&small_mode_); |
| 1089 outputs_[1].set_native_mode(&small_mode_); | 1095 outputs_[1].set_native_mode(&small_mode_); |
| 1090 outputs_[1].set_modes(std::vector<const DisplayMode*>(1, &small_mode_)); | 1096 outputs_[1].set_modes(std::vector<const DisplayMode*>(1, &small_mode_)); |
| 1091 | 1097 |
| 1092 // The small mode should be added to the internal output when requesting | 1098 // The small mode should be added to the internal output when requesting |
| 1093 // mirrored mode. | 1099 // mirrored mode. |
| 1094 UpdateOutputs(2, false); | 1100 UpdateOutputs(2, false); |
| 1095 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 1101 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 1096 configurator_.Init(true /* is_panel_fitting_enabled */); | 1102 Init(true /* is_panel_fitting_enabled */); |
| 1097 configurator_.ForceInitialConfigure(0); | 1103 configurator_.ForceInitialConfigure(0); |
| 1098 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); | 1104 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); |
| 1099 EXPECT_EQ( | 1105 EXPECT_EQ( |
| 1100 JoinActions( | 1106 JoinActions( |
| 1101 kInitXRandR, kGrab, | 1107 kInitXRandR, kGrab, |
| 1102 GetAddOutputModeAction(outputs_[0], &small_mode_).c_str(), | 1108 GetAddOutputModeAction(outputs_[0], &small_mode_).c_str(), |
| 1103 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) | 1109 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) |
| 1104 .c_str(), | 1110 .c_str(), |
| 1105 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), | 1111 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1106 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), | 1112 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), |
| 1107 kForceDPMS, kUngrab, NULL), | 1113 kForceDPMS, kUngrab, NULL), |
| 1108 log_->GetActionsAndClear()); | 1114 log_->GetActionsAndClear()); |
| 1109 | 1115 |
| 1110 // Both outputs should be using the small mode. | 1116 // Both outputs should be using the small mode. |
| 1111 ASSERT_EQ(1, observer_.num_changes()); | 1117 ASSERT_EQ(1, observer_.num_changes()); |
| 1112 ASSERT_EQ(static_cast<size_t>(2), observer_.latest_outputs().size()); | 1118 ASSERT_EQ(static_cast<size_t>(2), observer_.latest_outputs().size()); |
| 1113 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[0]->current_mode()); | 1119 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[0]->current_mode()); |
| 1114 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[1]->current_mode()); | 1120 EXPECT_EQ(&small_mode_, observer_.latest_outputs()[1]->current_mode()); |
| 1115 | 1121 |
| 1116 // Also check that the newly-added small mode is present in the internal | 1122 // Also check that the newly-added small mode is present in the internal |
| 1117 // snapshot that was passed to the observer (http://crbug.com/289159). | 1123 // snapshot that was passed to the observer (http://crbug.com/289159). |
| 1118 DisplaySnapshot* state = observer_.latest_outputs()[0]; | 1124 DisplaySnapshot* state = observer_.latest_outputs()[0]; |
| 1119 ASSERT_NE( | 1125 ASSERT_NE( |
| 1120 state->modes().end(), | 1126 state->modes().end(), |
| 1121 std::find(state->modes().begin(), state->modes().end(), &small_mode_)); | 1127 std::find(state->modes().begin(), state->modes().end(), &small_mode_)); |
| 1122 } | 1128 } |
| 1123 | 1129 |
| 1124 TEST_F(DisplayConfiguratorTest, ContentProtection) { | 1130 TEST_F(DisplayConfiguratorTest, ContentProtection) { |
| 1125 configurator_.Init(false); | 1131 Init(false); |
| 1126 configurator_.ForceInitialConfigure(0); | 1132 configurator_.ForceInitialConfigure(0); |
| 1127 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 1133 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| 1128 | 1134 |
| 1129 DisplayConfigurator::ContentProtectionClientId id = | 1135 DisplayConfigurator::ContentProtectionClientId id = |
| 1130 configurator_.RegisterContentProtectionClient(); | 1136 configurator_.RegisterContentProtectionClient(); |
| 1131 EXPECT_NE(0u, id); | 1137 EXPECT_NE(0u, id); |
| 1132 | 1138 |
| 1133 // One output. | 1139 // One output. |
| 1134 UpdateOutputs(1, true); | 1140 UpdateOutputs(1, true); |
| 1135 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 1141 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 log_->GetActionsAndClear()); | 1296 log_->GetActionsAndClear()); |
| 1291 } | 1297 } |
| 1292 | 1298 |
| 1293 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClients) { | 1299 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClients) { |
| 1294 DisplayConfigurator::ContentProtectionClientId client1 = | 1300 DisplayConfigurator::ContentProtectionClientId client1 = |
| 1295 configurator_.RegisterContentProtectionClient(); | 1301 configurator_.RegisterContentProtectionClient(); |
| 1296 DisplayConfigurator::ContentProtectionClientId client2 = | 1302 DisplayConfigurator::ContentProtectionClientId client2 = |
| 1297 configurator_.RegisterContentProtectionClient(); | 1303 configurator_.RegisterContentProtectionClient(); |
| 1298 EXPECT_NE(client1, client2); | 1304 EXPECT_NE(client1, client2); |
| 1299 | 1305 |
| 1300 configurator_.Init(false); | 1306 Init(false); |
| 1301 configurator_.ForceInitialConfigure(0); | 1307 configurator_.ForceInitialConfigure(0); |
| 1302 UpdateOutputs(2, true); | 1308 UpdateOutputs(2, true); |
| 1303 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 1309 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| 1304 | 1310 |
| 1305 // Clients never know state enableness for methods that they didn't request. | 1311 // Clients never know state enableness for methods that they didn't request. |
| 1306 configurator_.EnableContentProtection( | 1312 configurator_.EnableContentProtection( |
| 1307 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, | 1313 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1308 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, | 1314 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1309 base::Unretained(this))); | 1315 base::Unretained(this))); |
| 1310 EXPECT_EQ(1, enable_content_protection_call_count_); | 1316 EXPECT_EQ(1, enable_content_protection_call_count_); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 log_->GetActionsAndClear()); | 1360 log_->GetActionsAndClear()); |
| 1355 } | 1361 } |
| 1356 | 1362 |
| 1357 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClientsEnable) { | 1363 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClientsEnable) { |
| 1358 DisplayConfigurator::ContentProtectionClientId client1 = | 1364 DisplayConfigurator::ContentProtectionClientId client1 = |
| 1359 configurator_.RegisterContentProtectionClient(); | 1365 configurator_.RegisterContentProtectionClient(); |
| 1360 DisplayConfigurator::ContentProtectionClientId client2 = | 1366 DisplayConfigurator::ContentProtectionClientId client2 = |
| 1361 configurator_.RegisterContentProtectionClient(); | 1367 configurator_.RegisterContentProtectionClient(); |
| 1362 EXPECT_NE(client1, client2); | 1368 EXPECT_NE(client1, client2); |
| 1363 | 1369 |
| 1364 configurator_.Init(false); | 1370 Init(false); |
| 1365 configurator_.ForceInitialConfigure(0); | 1371 configurator_.ForceInitialConfigure(0); |
| 1366 UpdateOutputs(2, true); | 1372 UpdateOutputs(2, true); |
| 1367 log_->GetActionsAndClear(); | 1373 log_->GetActionsAndClear(); |
| 1368 | 1374 |
| 1369 // Only enable once if HDCP is enabling. | 1375 // Only enable once if HDCP is enabling. |
| 1370 configurator_.EnableContentProtection( | 1376 configurator_.EnableContentProtection( |
| 1371 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, | 1377 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1372 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, | 1378 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1373 base::Unretained(this))); | 1379 base::Unretained(this))); |
| 1374 EXPECT_EQ(1, enable_content_protection_call_count_); | 1380 EXPECT_EQ(1, enable_content_protection_call_count_); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 .c_str(), | 1483 .c_str(), |
| 1478 kUngrab, NULL), | 1484 kUngrab, NULL), |
| 1479 log_->GetActionsAndClear()); | 1485 log_->GetActionsAndClear()); |
| 1480 } | 1486 } |
| 1481 | 1487 |
| 1482 // Tests that power state requests are saved after failed configuration attempts | 1488 // Tests that power state requests are saved after failed configuration attempts |
| 1483 // so they can be reused later: http://crosbug.com/p/31571 | 1489 // so they can be reused later: http://crosbug.com/p/31571 |
| 1484 TEST_F(DisplayConfiguratorTest, SaveDisplayPowerStateOnConfigFailure) { | 1490 TEST_F(DisplayConfiguratorTest, SaveDisplayPowerStateOnConfigFailure) { |
| 1485 // Start out with two displays in extended mode. | 1491 // Start out with two displays in extended mode. |
| 1486 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); | 1492 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); |
| 1487 configurator_.Init(false); | 1493 Init(false); |
| 1488 configurator_.ForceInitialConfigure(0); | 1494 configurator_.ForceInitialConfigure(0); |
| 1489 log_->GetActionsAndClear(); | 1495 log_->GetActionsAndClear(); |
| 1490 observer_.Reset(); | 1496 observer_.Reset(); |
| 1491 | 1497 |
| 1492 // Turn off the internal display, simulating docked mode. | 1498 // Turn off the internal display, simulating docked mode. |
| 1493 configurator_.SetDisplayPower( | 1499 configurator_.SetDisplayPower( |
| 1494 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, | 1500 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, |
| 1495 DisplayConfigurator::kSetDisplayPowerNoFlags, | 1501 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| 1496 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, | 1502 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, |
| 1497 base::Unretained(this))); | 1503 base::Unretained(this))); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1525 kForceDPMS, kUngrab, NULL), | 1531 kForceDPMS, kUngrab, NULL), |
| 1526 log_->GetActionsAndClear()); | 1532 log_->GetActionsAndClear()); |
| 1527 } | 1533 } |
| 1528 | 1534 |
| 1529 // Tests that the SetDisplayPowerState() task posted by HandleResume() doesn't | 1535 // Tests that the SetDisplayPowerState() task posted by HandleResume() doesn't |
| 1530 // use a stale state if a new state is requested before it runs: | 1536 // use a stale state if a new state is requested before it runs: |
| 1531 // http://crosbug.com/p/32393 | 1537 // http://crosbug.com/p/32393 |
| 1532 TEST_F(DisplayConfiguratorTest, DontRestoreStalePowerStateAfterResume) { | 1538 TEST_F(DisplayConfiguratorTest, DontRestoreStalePowerStateAfterResume) { |
| 1533 // Start out with two displays in mirrored mode. | 1539 // Start out with two displays in mirrored mode. |
| 1534 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); | 1540 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); |
| 1535 configurator_.Init(false); | 1541 Init(false); |
| 1536 configurator_.ForceInitialConfigure(0); | 1542 configurator_.ForceInitialConfigure(0); |
| 1537 log_->GetActionsAndClear(); | 1543 log_->GetActionsAndClear(); |
| 1538 observer_.Reset(); | 1544 observer_.Reset(); |
| 1539 | 1545 |
| 1540 // Turn off the internal display, simulating docked mode. | 1546 // Turn off the internal display, simulating docked mode. |
| 1541 configurator_.SetDisplayPower( | 1547 configurator_.SetDisplayPower( |
| 1542 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, | 1548 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, |
| 1543 DisplayConfigurator::kSetDisplayPowerNoFlags, | 1549 DisplayConfigurator::kSetDisplayPowerNoFlags, |
| 1544 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, | 1550 base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback, |
| 1545 base::Unretained(this))); | 1551 base::Unretained(this))); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 GetFramebufferAction(small_mode_.size(), &outputs_[0], | 1628 GetFramebufferAction(small_mode_.size(), &outputs_[0], |
| 1623 nullptr).c_str(), | 1629 nullptr).c_str(), |
| 1624 GetCrtcAction(outputs_[0], &small_mode_, | 1630 GetCrtcAction(outputs_[0], &small_mode_, |
| 1625 gfx::Point(0, 0)).c_str(), | 1631 gfx::Point(0, 0)).c_str(), |
| 1626 kUngrab, NULL), | 1632 kUngrab, NULL), |
| 1627 log_->GetActionsAndClear()); | 1633 log_->GetActionsAndClear()); |
| 1628 } | 1634 } |
| 1629 | 1635 |
| 1630 } // namespace test | 1636 } // namespace test |
| 1631 } // namespace ui | 1637 } // namespace ui |
| OLD | NEW |