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

Side by Side Diff: content/browser/child_process_security_policy_browsertest.cc

Issue 2915813002: Add missing return statement after ReceivedBadMessage call. (Closed)
Patch Set: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/bad_message.h"
9 #include "content/browser/child_process_security_policy_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 11 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
12 #include "content/public/common/result_codes.h" 13 #include "content/public/common/result_codes.h"
14 #include "content/public/test/browser_test_utils.h"
13 #include "content/public/test/content_browser_test.h" 15 #include "content/public/test/content_browser_test.h"
14 #include "content/public/test/content_browser_test_utils.h" 16 #include "content/public/test/content_browser_test_utils.h"
15 #include "content/shell/browser/shell.h" 17 #include "content/shell/browser/shell.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
17 19
18 namespace content { 20 namespace content {
19 21
20 class ChildProcessSecurityPolicyInProcessBrowserTest 22 class ChildProcessSecurityPolicyInProcessBrowserTest
21 : public ContentBrowserTest { 23 : public ContentBrowserTest {
22 public: 24 public:
(...skipping 26 matching lines...) Expand all
49 51
50 WebContents* web_contents = shell()->web_contents(); 52 WebContents* web_contents = shell()->web_contents();
51 web_contents->GetRenderProcessHost()->Shutdown(RESULT_CODE_KILLED, true); 53 web_contents->GetRenderProcessHost()->Shutdown(RESULT_CODE_KILLED, true);
52 54
53 web_contents->GetController().Reload(ReloadType::NORMAL, true); 55 web_contents->GetController().Reload(ReloadType::NORMAL, true);
54 EXPECT_EQ( 56 EXPECT_EQ(
55 1U, 57 1U,
56 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size()); 58 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size());
57 } 59 }
58 60
61 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest,
62 RevokeOnBadMessage) {
63 GURL url = GetTestUrl("", "simple_page.html");
64
65 NavigateToURL(shell(), url);
66 int child_id = shell()->web_contents()->GetRenderProcessHost()->GetID();
67 base::FilePath file_path = GetTestFilePath("", "simple_page.html");
68 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(child_id,
69 file_path);
70 EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
71 child_id, file_path));
72
73 RenderProcessHostWatcher process_exit_observer(
74 shell()->web_contents()->GetRenderProcessHost(),
75 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
76 bad_message::ReceivedBadMessage(child_id,
77 bad_message::RFPH_ILLEGAL_UPLOAD_PARAMS);
78 process_exit_observer.Wait();
79 EXPECT_FALSE(
80 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
81 file_path));
82 }
83
59 } // namespace content 84 } // namespace content
OLDNEW
« 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