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

Unified Diff: content/browser/child_process_security_policy_browsertest.cc

Issue 2915813002: Add missing return statement after ReceivedBadMessage call. (Closed)
Patch Set: Created 3 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/bad_message.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_security_policy_browsertest.cc
diff --git a/content/browser/child_process_security_policy_browsertest.cc b/content/browser/child_process_security_policy_browsertest.cc
index 3e4264dd61b2e77d055622c0e41fb17f051ce6b1..10d9b8e84ab126c4b03ceb84d5c3ae629fab3358 100644
--- a/content/browser/child_process_security_policy_browsertest.cc
+++ b/content/browser/child_process_security_policy_browsertest.cc
@@ -6,10 +6,12 @@
#include "base/files/file_path.h"
#include "build/build_config.h"
+#include "content/browser/bad_message.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/result_codes.h"
+#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
@@ -56,4 +58,27 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) {
ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size());
}
+IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest,
+ RevokeOnBadMessage) {
+ GURL url = GetTestUrl("", "simple_page.html");
+
+ NavigateToURL(shell(), url);
+ int child_id = shell()->web_contents()->GetRenderProcessHost()->GetID();
+ base::FilePath file_path = GetTestFilePath("", "simple_page.html");
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(child_id,
+ file_path);
+ EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
+ child_id, file_path));
+
+ RenderProcessHostWatcher process_exit_observer(
+ shell()->web_contents()->GetRenderProcessHost(),
+ RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+ bad_message::ReceivedBadMessage(child_id,
+ bad_message::RFPH_ILLEGAL_UPLOAD_PARAMS);
+ process_exit_observer.Wait();
+ EXPECT_FALSE(
+ ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(child_id,
Charlie Reis 2017/05/31 17:28:23 This is failing on the bots, but maybe that doesn'
jam 2017/05/31 23:26:15 ok, I'll do this separately since it's a good poin
+ file_path));
+}
+
} // namespace content
« no previous file with comments | « content/browser/bad_message.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698