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
3 // found in the LICENSE file.
7 #include "base/basictypes.h"
8 #include "base/files/file_path.h"
9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "content/public/browser/render_process_host.h"
12 #include "content/public/common/result_codes.h"
13 #include "content/public/test/content_browser_test.h"
14 #include "content/public/test/content_browser_test_utils.h"
15 #include "content/shell/browser/shell.h"
16 #include "testing/gtest/include/gtest/gtest.h"
20 class ChildProcessSecurityPolicyInProcessBrowserTest
21 : public ContentBrowserTest
{
23 void SetUp() override
{
25 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size(),
27 ContentBrowserTest::SetUp();
30 void TearDown() override
{
32 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size(),
34 ContentBrowserTest::TearDown();
38 #if !defined(NDEBUG) && defined(OS_MACOSX)
39 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest
, DISABLED_NoLeak
) {
41 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest
, NoLeak
) {
43 GURL url
= GetTestUrl("", "simple_page.html");
45 NavigateToURL(shell(), url
);
47 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size(),
50 WebContents
* web_contents
= shell()->web_contents();
51 base::KillProcess(web_contents
->GetRenderProcessHost()->GetHandle(),
52 RESULT_CODE_KILLED
, true);
54 web_contents
->GetController().Reload(true);
57 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size());
60 } // namespace content