diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 06:11:28 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-19 06:11:28 +0000 |
commit | 78089f0bfcb2e2760db01191ceb0165d9517b154 (patch) | |
tree | e371ab6d6bedc40421d351648bfb5e68235d8dff /content/test/content_browser_test.cc | |
parent | 39e12cb553cf861ab0b34b3ccd82baa3dd82be7f (diff) | |
download | chromium_src-78089f0bfcb2e2760db01191ceb0165d9517b154.zip chromium_src-78089f0bfcb2e2760db01191ceb0165d9517b154.tar.gz chromium_src-78089f0bfcb2e2760db01191ceb0165d9517b154.tar.bz2 |
Get content_browsertest working. I've added a simple test for now, and will convert the tests in src/content in future changes.
BUG=90448
Review URL: https://chromiumcodereview.appspot.com/10803026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test/content_browser_test.cc')
-rw-r--r-- | content/test/content_browser_test.cc | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc index b1dddd0..9eb5c63 100644 --- a/content/test/content_browser_test.cc +++ b/content/test/content_browser_test.cc @@ -4,8 +4,13 @@ #include "content/test/content_browser_test.h" +#include "base/command_line.h" #include "base/debug/stack_trace.h" +#include "base/file_path.h" +#include "base/logging.h" #include "base/message_loop.h" +#include "base/path_service.h" +#include "content/public/common/content_switches.h" #include "content/shell/shell.h" #include "content/shell/shell_main_delegate.h" #include "content/test/test_content_client.h" @@ -15,16 +20,37 @@ #endif ContentBrowserTest::ContentBrowserTest() { +#if defined(OS_MACOSX) + // See comment in InProcessBrowserTest::InProcessBrowserTest(). + FilePath content_shell_path; + CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); + content_shell_path = content_shell_path.DirName(); + content_shell_path = content_shell_path.Append( + FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); + CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); +#endif } ContentBrowserTest::~ContentBrowserTest() { } void ContentBrowserTest::SetUp() { - DCHECK(!content::GetContentClient()); shell_main_delegate_.reset(new ShellMainDelegate); shell_main_delegate_->PreSandboxStartup(); +#if defined(OS_MACOSX) + // See InProcessBrowserTest::PrepareTestCommandLine(). + CommandLine* command_line = CommandLine::ForCurrentProcess(); + FilePath subprocess_path; + PathService::Get(base::FILE_EXE, &subprocess_path); + subprocess_path = subprocess_path.DirName().DirName(); + DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); + subprocess_path = subprocess_path.Append( + "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper"); + command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, + subprocess_path); +#endif + BrowserTestBase::SetUp(); } @@ -45,6 +71,9 @@ static void DumpStackTraceSignalHandler(int signal) { #endif // defined(OS_POSIX) void ContentBrowserTest::RunTestOnMainThreadLoop() { + CHECK_EQ(content::Shell::windows().size(), 1u); + shell_ = content::Shell::windows()[0]; + #if defined(OS_POSIX) signal(SIGTERM, DumpStackTraceSignalHandler); #endif // defined(OS_POSIX) @@ -71,9 +100,4 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() { #if defined(OS_MACOSX) pool.Recycle(); #endif - - MessageLoopForUI::current()->Quit(); -#if defined(OS_MACOSX) - pool.Recycle(); -#endif } |