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 "base/process_util.h"
10 #include "content/browser/child_process_security_policy_impl.h"
11 #include "content/browser/web_contents/web_contents_impl.h"
12 #include "content/public/browser/render_process_host.h"
13 #include "content/public/common/result_codes.h"
14 #include "content/shell/shell.h"
15 #include "content/test/content_browser_test.h"
16 #include "content/test/content_browser_test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h"
21 class ChildProcessSecurityPolicyInProcessBrowserTest
22 : public ContentBrowserTest
{
24 virtual void SetUp() {
26 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size(),
28 ContentBrowserTest::SetUp();
31 virtual void TearDown() {
33 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size(),
35 ContentBrowserTest::TearDown();
39 #if !defined(NDEBUG) && defined(OS_MACOSX)
40 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest
, DISABLED_NoLeak
) {
42 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest
, NoLeak
) {
44 GURL url
= GetTestUrl("", "simple_page.html");
46 NavigateToURL(shell(), url
);
48 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size(),
51 WebContents
* web_contents
= shell()->web_contents();
52 base::KillProcess(web_contents
->GetRenderProcessHost()->GetHandle(),
53 RESULT_CODE_KILLED
, true);
55 web_contents
->GetController().Reload(true);
58 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_
.size());
61 } // namespace content