diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 14:27:24 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 14:27:24 +0000 |
commit | df5456934b083ec39b32e8da7cc7017277240790 (patch) | |
tree | b3efd4c0bc698e50009c0539005e37f9b7d519ee /chrome/browser/child_process_security_policy_browsertest.cc | |
parent | fcd0c3cb084ffbcc36ed8c8dd1245be02c24aec3 (diff) | |
download | chromium_src-df5456934b083ec39b32e8da7cc7017277240790.zip chromium_src-df5456934b083ec39b32e8da7cc7017277240790.tar.gz chromium_src-df5456934b083ec39b32e8da7cc7017277240790.tar.bz2 |
Fix file names so that for browser tests the suffix is _browsertest.
TEST=browser_tests
BUG=none
Review URL: http://codereview.chromium.org/1549028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/child_process_security_policy_browsertest.cc')
-rw-r--r-- | chrome/browser/child_process_security_policy_browsertest.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/chrome/browser/child_process_security_policy_browsertest.cc b/chrome/browser/child_process_security_policy_browsertest.cc new file mode 100644 index 0000000..41ec56a --- /dev/null +++ b/chrome/browser/child_process_security_policy_browsertest.cc @@ -0,0 +1,50 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> + +#include "base/basictypes.h" +#include "base/file_path.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/child_process_security_policy.h" +#include "chrome/browser/renderer_host/render_process_host.h" +#include "chrome/test/in_process_browser_test.h" +#include "chrome/test/ui_test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" + +class ChildProcessSecurityPolicyInProcessBrowserTest + : public InProcessBrowserTest { + public: + virtual void SetUp() { + EXPECT_EQ( + ChildProcessSecurityPolicy::GetInstance()->security_state_.size(), 0U); + InProcessBrowserTest::SetUp(); + } + + virtual void TearDown() { + EXPECT_EQ( + ChildProcessSecurityPolicy::GetInstance()->security_state_.size(), 0U); + InProcessBrowserTest::TearDown(); + } +}; + +IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) { + const FilePath kTestDir(FILE_PATH_LITERAL("google")); + const FilePath kTestFile(FILE_PATH_LITERAL("google.html")); + GURL url(ui_test_utils::GetTestUrl(kTestDir, kTestFile)); + + ui_test_utils::NavigateToURL(browser(), url); + EXPECT_EQ( + ChildProcessSecurityPolicy::GetInstance()->security_state_.size(), 1U); + + TabContents* tab = browser()->GetTabContentsAt(0); + ASSERT_TRUE(tab != NULL); + base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), + base::PROCESS_END_KILLED_BY_USER, true); + + tab->controller().Reload(true); + EXPECT_EQ( + ChildProcessSecurityPolicy::GetInstance()->security_state_.size(), 1U); +} |