Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 584533002: Don't enable HDCP again if it is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/now_/current_/ Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <cstdarg> 10 #include <cstdarg>
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 EXPECT_EQ(CONTENT_PROTECTION_METHOD_HDCP, protection_mask); 1170 EXPECT_EQ(CONTENT_PROTECTION_METHOD_HDCP, protection_mask);
1171 1171
1172 EXPECT_TRUE(configurator_.QueryContentProtectionStatus( 1172 EXPECT_TRUE(configurator_.QueryContentProtectionStatus(
1173 client2, outputs_[1].display_id(), &link_mask, &protection_mask)); 1173 client2, outputs_[1].display_id(), &link_mask, &protection_mask));
1174 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), link_mask); 1174 EXPECT_EQ(static_cast<uint32_t>(DISPLAY_CONNECTION_TYPE_HDMI), link_mask);
1175 EXPECT_EQ(CONTENT_PROTECTION_METHOD_NONE, protection_mask); 1175 EXPECT_EQ(CONTENT_PROTECTION_METHOD_NONE, protection_mask);
1176 1176
1177 // Protections will be disabled only if no more clients request them. 1177 // Protections will be disabled only if no more clients request them.
1178 EXPECT_TRUE(configurator_.EnableContentProtection( 1178 EXPECT_TRUE(configurator_.EnableContentProtection(
1179 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE)); 1179 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE));
1180 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED).c_str(), 1180 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1181 log_->GetActionsAndClear());
1182 EXPECT_TRUE(configurator_.EnableContentProtection( 1181 EXPECT_TRUE(configurator_.EnableContentProtection(
1183 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE)); 1182 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_NONE));
1184 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_UNDESIRED).c_str(), 1183 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_UNDESIRED).c_str(),
1185 log_->GetActionsAndClear()); 1184 log_->GetActionsAndClear());
1186 } 1185 }
1187 1186
1187 TEST_F(DisplayConfiguratorTest, ContentProtectionTwoClientsEnable) {
1188 DisplayConfigurator::ContentProtectionClientId client1 =
1189 configurator_.RegisterContentProtectionClient();
1190 DisplayConfigurator::ContentProtectionClientId client2 =
1191 configurator_.RegisterContentProtectionClient();
1192 EXPECT_NE(client1, client2);
1193
1194 configurator_.Init(false);
1195 configurator_.ForceInitialConfigure(0);
1196 UpdateOutputs(2, true);
1197 EXPECT_NE(kNoActions, log_->GetActionsAndClear());
Daniel Erat 2014/09/19 15:45:55 i'd remove the EXPECT_NE() here; your test doesn't
kcwu 2014/09/23 05:43:22 Done.
1198
1199 // Only enable once if HDCP is enabling.
1200 EXPECT_TRUE(configurator_.EnableContentProtection(
1201 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP));
1202 native_display_delegate_->set_hdcp_state(HDCP_STATE_DESIRED);
1203 EXPECT_TRUE(configurator_.EnableContentProtection(
1204 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP));
1205 EXPECT_EQ(GetSetHDCPStateAction(outputs_[1], HDCP_STATE_DESIRED).c_str(),
1206 log_->GetActionsAndClear());
1207 native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED);
1208
1209 // Don't enable again if HDCP is already active
Daniel Erat 2014/09/19 15:45:55 nit: add a trailing period to this sentence
kcwu 2014/09/23 05:43:22 Done.
1210 EXPECT_TRUE(configurator_.EnableContentProtection(
1211 client1, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP));
1212 EXPECT_TRUE(configurator_.EnableContentProtection(
1213 client2, outputs_[1].display_id(), CONTENT_PROTECTION_METHOD_HDCP));
1214 EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
1215 }
1216
1188 TEST_F(DisplayConfiguratorTest, HandleConfigureCrtcFailure) { 1217 TEST_F(DisplayConfiguratorTest, HandleConfigureCrtcFailure) {
1189 InitWithSingleOutput(); 1218 InitWithSingleOutput();
1190 1219
1191 ScopedVector<const DisplayMode> modes; 1220 ScopedVector<const DisplayMode> modes;
1192 // The first mode is the mode we are requesting DisplayConfigurator to choose. 1221 // The first mode is the mode we are requesting DisplayConfigurator to choose.
1193 // The test will be setup so that this mode will fail and it will have to 1222 // The test will be setup so that this mode will fail and it will have to
1194 // choose the next best option. 1223 // choose the next best option.
1195 modes.push_back(new DisplayMode(gfx::Size(2560, 1600), false, 60.0)); 1224 modes.push_back(new DisplayMode(gfx::Size(2560, 1600), false, 60.0));
1196 modes.push_back(new DisplayMode(gfx::Size(1024, 768), false, 60.0)); 1225 modes.push_back(new DisplayMode(gfx::Size(1024, 768), false, 60.0));
1197 modes.push_back(new DisplayMode(gfx::Size(1280, 720), false, 60.0)); 1226 modes.push_back(new DisplayMode(gfx::Size(1280, 720), false, 60.0));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 gfx::Point(0, 1296 gfx::Point(0,
1268 modes[0]->size().height() + 1297 modes[0]->size().height() +
1269 DisplayConfigurator::kVerticalGap)) 1298 DisplayConfigurator::kVerticalGap))
1270 .c_str(), 1299 .c_str(),
1271 kUngrab, 1300 kUngrab,
1272 NULL), 1301 NULL),
1273 log_->GetActionsAndClear()); 1302 log_->GetActionsAndClear());
1274 } 1303 }
1275 1304
1276 } // namespace ui 1305 } // namespace ui
OLDNEW
« ui/display/chromeos/display_configurator.cc ('K') | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698