| OLD | NEW |
| 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/child_process_security_policy_impl.h" | 9 #include "content/browser/shared/child_process_security_policy_helper.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 12 #include "content/public/common/result_codes.h" | 12 #include "content/public/common/result_codes.h" |
| 13 #include "content/public/test/content_browser_test.h" | 13 #include "content/public/test/content_browser_test.h" |
| 14 #include "content/public/test/content_browser_test_utils.h" | 14 #include "content/public/test/content_browser_test_utils.h" |
| 15 #include "content/shell/browser/shell.h" | 15 #include "content/shell/browser/shell.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class ChildProcessSecurityPolicyInProcessBrowserTest | 20 class ChildProcessSecurityPolicyInProcessBrowserTest |
| 21 : public ContentBrowserTest { | 21 : public ContentBrowserTest { |
| 22 public: | 22 public: |
| 23 void SetUp() override { | 23 void SetUp() override { |
| 24 EXPECT_EQ( | 24 EXPECT_EQ( |
| 25 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), | 25 ChildProcessSecurityPolicyHelper::GetInstance()->security_state_.size(), |
| 26 0U); | 26 0U); |
| 27 ContentBrowserTest::SetUp(); | 27 ContentBrowserTest::SetUp(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void TearDown() override { | 30 void TearDown() override { |
| 31 EXPECT_EQ( | 31 EXPECT_EQ( |
| 32 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), | 32 ChildProcessSecurityPolicyHelper::GetInstance()->security_state_.size(), |
| 33 0U); | 33 0U); |
| 34 ContentBrowserTest::TearDown(); | 34 ContentBrowserTest::TearDown(); |
| 35 } | 35 } |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 #if !defined(NDEBUG) && defined(OS_MACOSX) | 38 #if !defined(NDEBUG) && defined(OS_MACOSX) |
| 39 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, DISABLED_
NoLeak) { | 39 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, |
| 40 DISABLED_NoLeak) { |
| 40 #else | 41 #else |
| 41 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { | 42 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { |
| 42 #endif | 43 #endif |
| 43 GURL url = GetTestUrl("", "simple_page.html"); | 44 GURL url = GetTestUrl("", "simple_page.html"); |
| 44 | 45 |
| 45 NavigateToURL(shell(), url); | 46 NavigateToURL(shell(), url); |
| 46 EXPECT_EQ( | 47 EXPECT_EQ( |
| 47 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), | 48 ChildProcessSecurityPolicyHelper::GetInstance()->security_state_.size(), |
| 48 1U); | 49 1U); |
| 49 | 50 |
| 50 WebContents* web_contents = shell()->web_contents(); | 51 WebContents* web_contents = shell()->web_contents(); |
| 51 web_contents->GetRenderProcessHost()->Shutdown(RESULT_CODE_KILLED, true); | 52 web_contents->GetRenderProcessHost()->Shutdown(RESULT_CODE_KILLED, true); |
| 52 | 53 |
| 53 web_contents->GetController().Reload(true); | 54 web_contents->GetController().Reload(true); |
| 54 EXPECT_EQ( | 55 EXPECT_EQ( |
| 55 1U, | 56 1U, |
| 56 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size()); | 57 ChildProcessSecurityPolicyHelper::GetInstance()->security_state_.size()); |
| 57 } | 58 } |
| 58 | 59 |
| 59 } // namespace content | 60 } // namespace content |
| OLD | NEW |