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

Unified Diff: components/cast_certificate/cast_cert_validator_unittest.cc

Issue 2918233002: Add tests for Cast certificate interpretation of policies. (Closed)
Patch Set: Add more tests, and use less restrictive approach Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/cast_certificate/cast_cert_validator_unittest.cc
diff --git a/components/cast_certificate/cast_cert_validator_unittest.cc b/components/cast_certificate/cast_cert_validator_unittest.cc
index 43f9aeacc59149dd96bb5045d75721a673d06364..7a8d1e559703a796e20f1b804487478baee36a27 100644
--- a/components/cast_certificate/cast_cert_validator_unittest.cc
+++ b/components/cast_certificate/cast_cert_validator_unittest.cc
@@ -416,6 +416,138 @@ TEST(VerifyCastDeviceCertTest, ViolatesPathlenTrustAnchorConstraint) {
TRUST_STORE_FROM_TEST_FILE, "");
}
+// Tests verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={anyPolicy}
+// Leaf: policies={anyPolicy}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAnypolicyLeafAnypolicy) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::NONE,
+ "certificates/policies_ica_anypolicy_leaf_anypolicy.pem",
+ AprilFirst2016(), TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={anyPolicy}
+// Leaf: policies={audioOnly}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAnypolicyLeafAudioonly) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::AUDIO_ONLY,
+ "certificates/policies_ica_anypolicy_leaf_audioonly.pem",
+ AprilFirst2016(), TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={anyPolicy}
+// Leaf: policies={foo}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAnypolicyLeafFoo) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::NONE,
+ "certificates/policies_ica_anypolicy_leaf_foo.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={anyPolicy}
+// Leaf: policies={}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAnypolicyLeafNone) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::NONE,
+ "certificates/policies_ica_anypolicy_leaf_none.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={audioOnly}
+// Leaf: policies={anyPolicy}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAudioonlyLeafAnypolicy) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::AUDIO_ONLY,
+ "certificates/policies_ica_audioonly_leaf_anypolicy.pem",
+ AprilFirst2016(), TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={audioOnly}
+// Leaf: policies={audioOnly}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAudioonlyLeafAudioonly) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::AUDIO_ONLY,
+ "certificates/policies_ica_audioonly_leaf_audioonly.pem",
+ AprilFirst2016(), TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={audioOnly}
+// Leaf: policies={foo}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAudioonlyLeafFoo) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::AUDIO_ONLY,
+ "certificates/policies_ica_audioonly_leaf_foo.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={audioOnly}
+// Leaf: policies={}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaAudioonlyLeafNone) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::AUDIO_ONLY,
+ "certificates/policies_ica_audioonly_leaf_none.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={}
+// Leaf: policies={anyPolicy}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaNoneLeafAnypolicy) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::NONE,
+ "certificates/policies_ica_none_leaf_anypolicy.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={}
+// Leaf: policies={audioOnly}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaNoneLeafAudioonly) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::AUDIO_ONLY,
+ "certificates/policies_ica_none_leaf_audioonly.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={}
+// Leaf: policies={foo}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaNoneLeafFoo) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::NONE,
+ "certificates/policies_ica_none_leaf_foo.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
+// Test verifying a certificate chain with the policies:
+//
+// Root: policies={}
+// Intermediate: policies={}
+// Leaf: policies={}
+TEST(VerifyCastDeviceCertTest, PoliciesIcaNoneLeafNone) {
+ RunTest(RESULT_SUCCESS, "Leaf", CastDeviceCertPolicy::NONE,
+ "certificates/policies_ica_none_leaf_none.pem", AprilFirst2016(),
+ TRUST_STORE_FROM_TEST_FILE, "");
+}
+
// ------------------------------------------------------
// Valid signature using 1024-bit RSA key
// ------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698