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

Unified Diff: content/browser/renderer_host/media/webrtc_identity_service_host_unittest.cc

Issue 1948223005: ChildProcessSecurityPolicy::CanAccessDataForOrigin workaround to suppress bad kills (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « content/browser/child_process_security_policy_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/webrtc_identity_service_host_unittest.cc
diff --git a/content/browser/renderer_host/media/webrtc_identity_service_host_unittest.cc b/content/browser/renderer_host/media/webrtc_identity_service_host_unittest.cc
index 49ff80430074d1022555c52e273de177ffeeabba..5314d577b68688b00b3d9e7c35c81379cc353b16 100644
--- a/content/browser/renderer_host/media/webrtc_identity_service_host_unittest.cc
+++ b/content/browser/renderer_host/media/webrtc_identity_service_host_unittest.cc
@@ -19,7 +19,9 @@ namespace content {
namespace {
-const char FAKE_URL[] = "http://fake.com";
+const char FAKE_URL[] = "http://www.fake.com";
+const char FAKE_SITE[] = "http://fake.com";
+const char OTHER_SITE[] = "https://other.com";
const char FAKE_FIRST_PARTY_URL[] = "http://fake.firstparty.com";
const char FAKE_IDENTITY_NAME[] = "fake identity";
const char FAKE_COMMON_NAME[] = "fake common name";
@@ -231,12 +233,22 @@ TEST_F(WebRTCIdentityServiceHostTest, TestOnRequestFailed) {
TEST_F(WebRTCIdentityServiceHostTest, TestOriginAccessDenied) {
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
- policy->Remove(FAKE_RENDERER_ID);
+ policy->LockToOrigin(FAKE_RENDERER_ID, GURL(OTHER_SITE));
SendRequestToHost();
VerifyRequestFailedMessage(net::ERR_ACCESS_DENIED);
}
+TEST_F(WebRTCIdentityServiceHostTest, TestOriginAccessAllowed) {
+ ChildProcessSecurityPolicyImpl* policy =
+ ChildProcessSecurityPolicyImpl::GetInstance();
+ policy->LockToOrigin(FAKE_RENDERER_ID, GURL(FAKE_SITE));
+
+ SendRequestToHost();
+ store_->RunCompletionCallback(net::OK, FAKE_CERTIFICATE, FAKE_PRIVATE_KEY);
+ VerifyIdentityReadyMessage(FAKE_CERTIFICATE, FAKE_PRIVATE_KEY);
+}
+
// Verifies that we do not crash if we try to cancel a completed request.
TEST_F(WebRTCIdentityServiceHostTest, TestCancelAfterRequestCompleted) {
SendRequestToHost();
« no previous file with comments | « content/browser/child_process_security_policy_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698