| 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 "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/display/chromeos/test/action_logger_util.h" | 10 #include "ui/display/chromeos/test/action_logger_util.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 CALLBACK_FAILURE, | 118 CALLBACK_FAILURE, |
| 119 CALLBACK_SUCCESS, | 119 CALLBACK_SUCCESS, |
| 120 CALLBACK_NOT_CALLED, | 120 CALLBACK_NOT_CALLED, |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 DisplayConfiguratorTest() | 123 DisplayConfiguratorTest() |
| 124 : small_mode_(gfx::Size(1366, 768), false, 60.0f), | 124 : small_mode_(gfx::Size(1366, 768), false, 60.0f), |
| 125 big_mode_(gfx::Size(2560, 1600), false, 60.0f), | 125 big_mode_(gfx::Size(2560, 1600), false, 60.0f), |
| 126 observer_(&configurator_), | 126 observer_(&configurator_), |
| 127 test_api_(&configurator_), | 127 test_api_(&configurator_), |
| 128 enable_content_protection_status_(0), |
| 129 enable_content_protection_call_count_(0), |
| 130 query_content_protection_call_count_(0), |
| 128 callback_result_(CALLBACK_NOT_CALLED) {} | 131 callback_result_(CALLBACK_NOT_CALLED) {} |
| 129 ~DisplayConfiguratorTest() override {} | 132 ~DisplayConfiguratorTest() override {} |
| 130 | 133 |
| 131 void SetUp() override { | 134 void SetUp() override { |
| 132 log_.reset(new ActionLogger()); | 135 log_.reset(new ActionLogger()); |
| 133 | 136 |
| 134 native_display_delegate_ = new TestNativeDisplayDelegate(log_.get()); | 137 native_display_delegate_ = new TestNativeDisplayDelegate(log_.get()); |
| 135 configurator_.SetDelegateForTesting( | 138 configurator_.SetDelegateForTesting( |
| 136 scoped_ptr<NativeDisplayDelegate>(native_display_delegate_)); | 139 scoped_ptr<NativeDisplayDelegate>(native_display_delegate_)); |
| 137 | 140 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 158 o->set_is_aspect_preserving_scaling(true); | 161 o->set_is_aspect_preserving_scaling(true); |
| 159 o->set_display_id(456); | 162 o->set_display_id(456); |
| 160 | 163 |
| 161 UpdateOutputs(2, false); | 164 UpdateOutputs(2, false); |
| 162 } | 165 } |
| 163 | 166 |
| 164 void OnConfiguredCallback(bool status) { | 167 void OnConfiguredCallback(bool status) { |
| 165 callback_result_ = (status ? CALLBACK_SUCCESS : CALLBACK_FAILURE); | 168 callback_result_ = (status ? CALLBACK_SUCCESS : CALLBACK_FAILURE); |
| 166 } | 169 } |
| 167 | 170 |
| 171 void EnableContentProtectionCallback(bool status) { |
| 172 enable_content_protection_status_ = status; |
| 173 enable_content_protection_call_count_++; |
| 174 } |
| 175 |
| 176 void QueryContentProtectionCallback( |
| 177 const DisplayConfigurator::QueryProtectionResponse& response) { |
| 178 query_content_protection_response_ = response; |
| 179 query_content_protection_call_count_++; |
| 180 } |
| 181 |
| 168 // Predefined modes that can be used by outputs. | 182 // Predefined modes that can be used by outputs. |
| 169 const DisplayMode small_mode_; | 183 const DisplayMode small_mode_; |
| 170 const DisplayMode big_mode_; | 184 const DisplayMode big_mode_; |
| 171 | 185 |
| 172 protected: | 186 protected: |
| 173 // Configures |native_display_delegate_| to return the first |num_outputs| | 187 // Configures |native_display_delegate_| to return the first |num_outputs| |
| 174 // entries from | 188 // entries from |
| 175 // |outputs_|. If |send_events| is true, also sends screen-change and | 189 // |outputs_|. If |send_events| is true, also sends screen-change and |
| 176 // output-change events to |configurator_| and triggers the configure | 190 // output-change events to |configurator_| and triggers the configure |
| 177 // timeout if one was scheduled. | 191 // timeout if one was scheduled. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 226 |
| 213 base::MessageLoop message_loop_; | 227 base::MessageLoop message_loop_; |
| 214 TestStateController state_controller_; | 228 TestStateController state_controller_; |
| 215 TestMirroringController mirroring_controller_; | 229 TestMirroringController mirroring_controller_; |
| 216 DisplayConfigurator configurator_; | 230 DisplayConfigurator configurator_; |
| 217 TestObserver observer_; | 231 TestObserver observer_; |
| 218 scoped_ptr<ActionLogger> log_; | 232 scoped_ptr<ActionLogger> log_; |
| 219 TestNativeDisplayDelegate* native_display_delegate_; // not owned | 233 TestNativeDisplayDelegate* native_display_delegate_; // not owned |
| 220 DisplayConfigurator::TestApi test_api_; | 234 DisplayConfigurator::TestApi test_api_; |
| 221 | 235 |
| 236 bool enable_content_protection_status_; |
| 237 int enable_content_protection_call_count_; |
| 238 DisplayConfigurator::QueryProtectionResponse |
| 239 query_content_protection_response_; |
| 240 int query_content_protection_call_count_; |
| 241 |
| 222 TestDisplaySnapshot outputs_[2]; | 242 TestDisplaySnapshot outputs_[2]; |
| 223 | 243 |
| 224 CallbackResult callback_result_; | 244 CallbackResult callback_result_; |
| 225 | 245 |
| 226 private: | 246 private: |
| 227 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorTest); | 247 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorTest); |
| 228 }; | 248 }; |
| 229 | 249 |
| 230 } // namespace | 250 } // namespace |
| 231 | 251 |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 configurator_.ForceInitialConfigure(0); | 950 configurator_.ForceInitialConfigure(0); |
| 931 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 951 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| 932 | 952 |
| 933 DisplayConfigurator::ContentProtectionClientId id = | 953 DisplayConfigurator::ContentProtectionClientId id = |
| 934 configurator_.RegisterContentProtectionClient(); | 954 configurator_.RegisterContentProtectionClient(); |
| 935 EXPECT_NE(0u, id); | 955 EXPECT_NE(0u, id); |
| 936 | 956 |
| 937 // One output. | 957 // One output. |
| 938 UpdateOutputs(1, true); | 958 UpdateOutputs(1, true); |
| 939 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 959 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| 940 uint32_t link_mask = 0; | 960 configurator_.QueryContentProtectionStatus( |
| 941 uint32_t protection_mask = 0; | 961 id, outputs_[0].display_id(), |
| 942 EXPECT_TRUE(configurator_.QueryContentProtectionStatus( | 962 base::Bind(&DisplayConfiguratorTest::QueryContentProtectionCallback, |
| 943 id, outputs_[0].display_id(), &link_mask, &protection_mask)); | 963 base::Unretained(this))); |
| 944 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_INTERNAL), link_mask); | 964 EXPECT_EQ(1, query_content_protection_call_count_); |
| 965 EXPECT_TRUE(query_content_protection_response_.success); |
| 966 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_INTERNAL), |
| 967 query_content_protection_response_.link_mask); |
| 945 EXPECT_EQ(static_cast<uint32_t>(CONTENT_PROTECTION_METHOD_NONE), | 968 EXPECT_EQ(static_cast<uint32_t>(CONTENT_PROTECTION_METHOD_NONE), |
| 946 protection_mask); | 969 query_content_protection_response_.protection_mask); |
| 947 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 970 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 948 | 971 |
| 949 // Two outputs. | 972 // Two outputs. |
| 950 UpdateOutputs(2, true); | 973 UpdateOutputs(2, true); |
| 951 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 974 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| 952 EXPECT_TRUE(configurator_.QueryContentProtectionStatus( | 975 configurator_.QueryContentProtectionStatus( |
| 953 id, outputs_[1].display_id(), &link_mask, &protection_mask)); | 976 id, outputs_[1].display_id(), |
| 954 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), link_mask); | 977 base::Bind(&DisplayConfiguratorTest::QueryContentProtectionCallback, |
| 978 base::Unretained(this))); |
| 979 EXPECT_EQ(2, query_content_protection_call_count_); |
| 980 EXPECT_TRUE(query_content_protection_response_.success); |
| 981 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), |
| 982 query_content_protection_response_.link_mask); |
| 955 EXPECT_EQ(static_cast<uint32_t>(CONTENT_PROTECTION_METHOD_NONE), | 983 EXPECT_EQ(static_cast<uint32_t>(CONTENT_PROTECTION_METHOD_NONE), |
| 956 protection_mask); | 984 query_content_protection_response_.protection_mask); |
| 957 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 985 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 958 | 986 |
| 959 EXPECT_TRUE(configurator_.EnableContentProtection( | 987 configurator_.EnableContentProtection( |
| 960 id, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP)); | 988 id, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 989 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 990 base::Unretained(this))); |
| 991 EXPECT_EQ(1, enable_content_protection_call_count_); |
| 992 EXPECT_TRUE(enable_content_protection_status_); |
| 961 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED), | 993 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED), |
| 962 log_->GetActionsAndClear()); | 994 log_->GetActionsAndClear()); |
| 963 | 995 |
| 964 // Enable protection. | 996 // Enable protection. |
| 965 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED); | 997 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED); |
| 966 EXPECT_TRUE(configurator_.QueryContentProtectionStatus( | 998 configurator_.QueryContentProtectionStatus( |
| 967 id, outputs_[1].display_id(), &link_mask, &protection_mask)); | 999 id, outputs_[1].display_id(), |
| 968 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), link_mask); | 1000 base::Bind(&DisplayConfiguratorTest::QueryContentProtectionCallback, |
| 1001 base::Unretained(this))); |
| 1002 EXPECT_EQ(3, query_content_protection_call_count_); |
| 1003 EXPECT_TRUE(query_content_protection_response_.success); |
| 1004 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), |
| 1005 query_content_protection_response_.link_mask); |
| 969 EXPECT_EQ(static_cast<uint32_t>(CONTENT_PROTECTION_METHOD_HDCP), | 1006 EXPECT_EQ(static_cast<uint32_t>(CONTENT_PROTECTION_METHOD_HDCP), |
| 970 protection_mask); | 1007 query_content_protection_response_.protection_mask); |
| 971 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1008 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 972 | 1009 |
| 973 // Protections should be disabled after unregister. | 1010 // Protections should be disabled after unregister. |
| 974 configurator_.UnregisterContentProtectionClient(id); | 1011 configurator_.UnregisterContentProtectionClient(id); |
| 975 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_UNDESIRED), | 1012 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_UNDESIRED), |
| 976 log_->GetActionsAndClear()); | 1013 log_->GetActionsAndClear()); |
| 977 } | 1014 } |
| 978 | 1015 |
| 979 TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) { | 1016 TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) { |
| 980 InitWithSingleOutput(); | 1017 InitWithSingleOutput(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 DisplayConfigurator::ContentProtectionClientId client2 = | 1116 DisplayConfigurator::ContentProtectionClientId client2 = |
| 1080 configurator_.RegisterContentProtectionClient(); | 1117 configurator_.RegisterContentProtectionClient(); |
| 1081 EXPECT_NE(client1, client2); | 1118 EXPECT_NE(client1, client2); |
| 1082 | 1119 |
| 1083 configurator_.Init(false); | 1120 configurator_.Init(false); |
| 1084 configurator_.ForceInitialConfigure(0); | 1121 configurator_.ForceInitialConfigure(0); |
| 1085 UpdateOutputs(2, true); | 1122 UpdateOutputs(2, true); |
| 1086 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); | 1123 EXPECT_NE(kNoActions, log_->GetActionsAndClear()); |
| 1087 | 1124 |
| 1088 // Clients never know state enableness for methods that they didn't request. | 1125 // Clients never know state enableness for methods that they didn't request. |
| 1089 EXPECT_TRUE(configurator_.EnableContentProtection( | 1126 configurator_.EnableContentProtection( |
| 1090 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP)); | 1127 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1128 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1129 base::Unretained(this))); |
| 1130 EXPECT_EQ(1, enable_content_protection_call_count_); |
| 1131 EXPECT_TRUE(enable_content_protection_status_); |
| 1091 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED).c_str(), | 1132 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED).c_str(), |
| 1092 log_->GetActionsAndClear()); | 1133 log_->GetActionsAndClear()); |
| 1093 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED); | 1134 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED); |
| 1094 | 1135 |
| 1095 uint32_t link_mask = 0; | 1136 configurator_.QueryContentProtectionStatus( |
| 1096 uint32_t protection_mask = 0; | 1137 client1, outputs_[1].display_id(), |
| 1097 EXPECT_TRUE(configurator_.QueryContentProtectionStatus( | 1138 base::Bind(&DisplayConfiguratorTest::QueryContentProtectionCallback, |
| 1098 client1, outputs_[1].display_id(), &link_mask, &protection_mask)); | 1139 base::Unretained(this))); |
| 1099 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), link_mask); | 1140 EXPECT_EQ(1, query_content_protection_call_count_); |
| 1100 EXPECT_EQ(CONTENT_PROTECTION_METHOD_HDCP, protection_mask); | 1141 EXPECT_TRUE(query_content_protection_response_.success); |
| 1142 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), |
| 1143 query_content_protection_response_.link_mask); |
| 1144 EXPECT_EQ(CONTENT_PROTECTION_METHOD_HDCP, |
| 1145 query_content_protection_response_.protection_mask); |
| 1101 | 1146 |
| 1102 EXPECT_TRUE(configurator_.QueryContentProtectionStatus( | 1147 configurator_.QueryContentProtectionStatus( |
| 1103 client2, outputs_[1].display_id(), &link_mask, &protection_mask)); | 1148 client2, outputs_[1].display_id(), |
| 1104 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), link_mask); | 1149 base::Bind(&DisplayConfiguratorTest::QueryContentProtectionCallback, |
| 1105 EXPECT_EQ(CONTENT_PROTECTION_METHOD_NONE, protection_mask); | 1150 base::Unretained(this))); |
| 1151 EXPECT_EQ(2, query_content_protection_call_count_); |
| 1152 EXPECT_TRUE(query_content_protection_response_.success); |
| 1153 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), |
| 1154 query_content_protection_response_.link_mask); |
| 1155 EXPECT_EQ(CONTENT_PROTECTION_METHOD_NONE, |
| 1156 query_content_protection_response_.protection_mask); |
| 1106 | 1157 |
| 1107 // Protections will be disabled only if no more clients request them. | 1158 // Protections will be disabled only if no more clients request them. |
| 1108 EXPECT_TRUE(configurator_.EnableContentProtection( | 1159 configurator_.EnableContentProtection( |
| 1109 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE)); | 1160 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE, |
| 1161 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1162 base::Unretained(this))); |
| 1163 EXPECT_EQ(2, enable_content_protection_call_count_); |
| 1164 EXPECT_TRUE(enable_content_protection_status_); |
| 1110 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1165 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1111 EXPECT_TRUE(configurator_.EnableContentProtection( | 1166 |
| 1112 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE)); | 1167 configurator_.EnableContentProtection( |
| 1168 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE, |
| 1169 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1170 base::Unretained(this))); |
| 1171 EXPECT_EQ(3, enable_content_protection_call_count_); |
| 1172 EXPECT_TRUE(enable_content_protection_status_); |
| 1113 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_UNDESIRED).c_str(), | 1173 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_UNDESIRED).c_str(), |
| 1114 log_->GetActionsAndClear()); | 1174 log_->GetActionsAndClear()); |
| 1115 } | 1175 } |
| 1116 | 1176 |
| 1117 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClientsEnable) { | 1177 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClientsEnable) { |
| 1118 DisplayConfigurator::ContentProtectionClientId client1 = | 1178 DisplayConfigurator::ContentProtectionClientId client1 = |
| 1119 configurator_.RegisterContentProtectionClient(); | 1179 configurator_.RegisterContentProtectionClient(); |
| 1120 DisplayConfigurator::ContentProtectionClientId client2 = | 1180 DisplayConfigurator::ContentProtectionClientId client2 = |
| 1121 configurator_.RegisterContentProtectionClient(); | 1181 configurator_.RegisterContentProtectionClient(); |
| 1122 EXPECT_NE(client1, client2); | 1182 EXPECT_NE(client1, client2); |
| 1123 | 1183 |
| 1124 configurator_.Init(false); | 1184 configurator_.Init(false); |
| 1125 configurator_.ForceInitialConfigure(0); | 1185 configurator_.ForceInitialConfigure(0); |
| 1126 UpdateOutputs(2, true); | 1186 UpdateOutputs(2, true); |
| 1127 log_->GetActionsAndClear(); | 1187 log_->GetActionsAndClear(); |
| 1128 | 1188 |
| 1129 // Only enable once if HDCP is enabling. | 1189 // Only enable once if HDCP is enabling. |
| 1130 EXPECT_TRUE(configurator_.EnableContentProtection( | 1190 configurator_.EnableContentProtection( |
| 1131 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP)); | 1191 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1192 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1193 base::Unretained(this))); |
| 1194 EXPECT_EQ(1, enable_content_protection_call_count_); |
| 1195 EXPECT_TRUE(enable_content_protection_status_); |
| 1132 native_display_delegate_->set_hdcp_state(HDCP_STATE_DESIRED); | 1196 native_display_delegate_->set_hdcp_state(HDCP_STATE_DESIRED); |
| 1133 EXPECT_TRUE(configurator_.EnableContentProtection( | 1197 configurator_.EnableContentProtection( |
| 1134 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP)); | 1198 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1199 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1200 base::Unretained(this))); |
| 1201 EXPECT_EQ(2, enable_content_protection_call_count_); |
| 1202 EXPECT_TRUE(enable_content_protection_status_); |
| 1135 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED).c_str(), | 1203 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED).c_str(), |
| 1136 log_->GetActionsAndClear()); | 1204 log_->GetActionsAndClear()); |
| 1137 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED); | 1205 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED); |
| 1138 | 1206 |
| 1139 // Don't enable again if HDCP is already active. | 1207 // Don't enable again if HDCP is already active. |
| 1140 EXPECT_TRUE(configurator_.EnableContentProtection( | 1208 configurator_.EnableContentProtection( |
| 1141 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP)); | 1209 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1142 EXPECT_TRUE(configurator_.EnableContentProtection( | 1210 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1143 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP)); | 1211 base::Unretained(this))); |
| 1212 EXPECT_EQ(3, enable_content_protection_call_count_); |
| 1213 EXPECT_TRUE(enable_content_protection_status_); |
| 1214 configurator_.EnableContentProtection( |
| 1215 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP, |
| 1216 base::Bind(&DisplayConfiguratorTest::EnableContentProtectionCallback, |
| 1217 base::Unretained(this))); |
| 1218 EXPECT_EQ(4, enable_content_protection_call_count_); |
| 1219 EXPECT_TRUE(enable_content_protection_status_); |
| 1144 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); | 1220 EXPECT_EQ(kNoActions, log_->GetActionsAndClear()); |
| 1145 } | 1221 } |
| 1146 | 1222 |
| 1147 TEST_F(DisplayConfiguratorTest, HandleConfigureCrtcFailure) { | 1223 TEST_F(DisplayConfiguratorTest, HandleConfigureCrtcFailure) { |
| 1148 InitWithSingleOutput(); | 1224 InitWithSingleOutput(); |
| 1149 | 1225 |
| 1150 ScopedVector<const DisplayMode> modes; | 1226 ScopedVector<const DisplayMode> modes; |
| 1151 // The first mode is the mode we are requesting DisplayConfigurator to choose. | 1227 // The first mode is the mode we are requesting DisplayConfigurator to choose. |
| 1152 // The test will be setup so that this mode will fail and it will have to | 1228 // The test will be setup so that this mode will fail and it will have to |
| 1153 // choose the next best option. | 1229 // choose the next best option. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 GetFramebufferAction(small_mode_.size(), &outputs_[0], | 1434 GetFramebufferAction(small_mode_.size(), &outputs_[0], |
| 1359 nullptr).c_str(), | 1435 nullptr).c_str(), |
| 1360 GetCrtcAction(outputs_[0], &small_mode_, | 1436 GetCrtcAction(outputs_[0], &small_mode_, |
| 1361 gfx::Point(0, 0)).c_str(), | 1437 gfx::Point(0, 0)).c_str(), |
| 1362 kUngrab, NULL), | 1438 kUngrab, NULL), |
| 1363 log_->GetActionsAndClear()); | 1439 log_->GetActionsAndClear()); |
| 1364 } | 1440 } |
| 1365 | 1441 |
| 1366 } // namespace test | 1442 } // namespace test |
| 1367 } // namespace ui | 1443 } // namespace ui |
| OLD | NEW |