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