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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_tabstrip.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/browser/child_process_security_policy_impl.h" | 14 #include "content/browser/child_process_security_policy_impl.h" |
14 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
15 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/common/result_codes.h" | 17 #include "content/public/common/result_codes.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 using content::WebContents; | 20 using content::WebContents; |
20 | 21 |
(...skipping 18 matching lines...) Expand all Loading... |
39 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { | 40 IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { |
40 const FilePath kTestDir(FILE_PATH_LITERAL("google")); | 41 const FilePath kTestDir(FILE_PATH_LITERAL("google")); |
41 const FilePath kTestFile(FILE_PATH_LITERAL("google.html")); | 42 const FilePath kTestFile(FILE_PATH_LITERAL("google.html")); |
42 GURL url(ui_test_utils::GetTestUrl(kTestDir, kTestFile)); | 43 GURL url(ui_test_utils::GetTestUrl(kTestDir, kTestFile)); |
43 | 44 |
44 ui_test_utils::NavigateToURL(browser(), url); | 45 ui_test_utils::NavigateToURL(browser(), url); |
45 EXPECT_EQ( | 46 EXPECT_EQ( |
46 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), | 47 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(), |
47 1U); | 48 1U); |
48 | 49 |
49 WebContents* web_contents = browser()->GetWebContentsAt(0); | 50 WebContents* web_contents = chrome::GetWebContentsAt(browser(), 0); |
50 ASSERT_TRUE(web_contents != NULL); | 51 ASSERT_TRUE(web_contents != NULL); |
51 base::KillProcess(web_contents->GetRenderProcessHost()->GetHandle(), | 52 base::KillProcess(web_contents->GetRenderProcessHost()->GetHandle(), |
52 content::RESULT_CODE_KILLED, true); | 53 content::RESULT_CODE_KILLED, true); |
53 | 54 |
54 web_contents->GetController().Reload(true); | 55 web_contents->GetController().Reload(true); |
55 EXPECT_EQ( | 56 EXPECT_EQ( |
56 1U, | 57 1U, |
57 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size()); | 58 ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size()); |
58 } | 59 } |
OLD | NEW |