Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: content/test/content_browser_test.cc

Issue 10802064: Make content_shell and content_browsertests working with aura (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add chrome packed_resources dependency for executable binary Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/shell_browser_main_parts.cc ('k') | content/test/content_test_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/test/content_browser_test.h" 5 #include "content/test/content_browser_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/stack_trace.h" 8 #include "base/debug/stack_trace.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/shell/shell.h" 15 #include "content/shell/shell.h"
16 #include "content/shell/shell_main_delegate.h" 16 #include "content/shell/shell_main_delegate.h"
17 #include "content/shell/shell_switches.h" 17 #include "content/shell/shell_switches.h"
18 #include "content/test/test_content_client.h" 18 #include "content/test/test_content_client.h"
19 19
20 #if defined(OS_CHROMEOS)
21 #include "chromeos/dbus/mock_dbus_thread_manager.h"
22 #endif
23
20 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
21 #include "base/mac/scoped_nsautorelease_pool.h" 25 #include "base/mac/scoped_nsautorelease_pool.h"
22 #endif 26 #endif
23 27
24 namespace content { 28 namespace content {
25 29
26 ContentBrowserTest::ContentBrowserTest() { 30 ContentBrowserTest::ContentBrowserTest() {
27 #if defined(OS_MACOSX) 31 #if defined(OS_MACOSX)
28 // See comment in InProcessBrowserTest::InProcessBrowserTest(). 32 // See comment in InProcessBrowserTest::InProcessBrowserTest().
29 FilePath content_shell_path; 33 FilePath content_shell_path;
30 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); 34 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path));
31 content_shell_path = content_shell_path.DirName(); 35 content_shell_path = content_shell_path.DirName();
32 content_shell_path = content_shell_path.Append( 36 content_shell_path = content_shell_path.Append(
33 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); 37 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell"));
34 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); 38 CHECK(PathService::Override(base::FILE_EXE, content_shell_path));
35 #endif 39 #endif
36 } 40 }
37 41
38 ContentBrowserTest::~ContentBrowserTest() { 42 ContentBrowserTest::~ContentBrowserTest() {
39 } 43 }
40 44
41 void ContentBrowserTest::SetUp() { 45 void ContentBrowserTest::SetUp() {
46 #if defined(OS_CHROMEOS)
47 chromeos::MockDBusThreadManager* mock_dbus_thread_manager =
48 new chromeos::MockDBusThreadManager;
49 chromeos::DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager);
jam 2012/07/25 16:29:02 a CrOS person should maybe look at this, but are y
50 #endif
51
42 shell_main_delegate_.reset(new ShellMainDelegate); 52 shell_main_delegate_.reset(new ShellMainDelegate);
43 shell_main_delegate_->PreSandboxStartup(); 53 shell_main_delegate_->PreSandboxStartup();
44 54
45 CommandLine* command_line = CommandLine::ForCurrentProcess(); 55 CommandLine* command_line = CommandLine::ForCurrentProcess();
46 command_line->AppendSwitch(switches::kContentBrowserTest); 56 command_line->AppendSwitch(switches::kContentBrowserTest);
47 57
48 SetUpCommandLine(command_line); 58 SetUpCommandLine(command_line);
49 59
50 #if defined(OS_MACOSX) 60 #if defined(OS_MACOSX)
51 // See InProcessBrowserTest::PrepareTestCommandLine(). 61 // See InProcessBrowserTest::PrepareTestCommandLine().
52 FilePath subprocess_path; 62 FilePath subprocess_path;
53 PathService::Get(base::FILE_EXE, &subprocess_path); 63 PathService::Get(base::FILE_EXE, &subprocess_path);
54 subprocess_path = subprocess_path.DirName().DirName(); 64 subprocess_path = subprocess_path.DirName().DirName();
55 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); 65 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents");
56 subprocess_path = subprocess_path.Append( 66 subprocess_path = subprocess_path.Append(
57 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper") ; 67 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper") ;
58 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, 68 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath,
59 subprocess_path); 69 subprocess_path);
60 #endif 70 #endif
61 71
62 BrowserTestBase::SetUp(); 72 BrowserTestBase::SetUp();
63 } 73 }
64 74
65 void ContentBrowserTest::TearDown() { 75 void ContentBrowserTest::TearDown() {
66 BrowserTestBase::TearDown(); 76 BrowserTestBase::TearDown();
67 77
68 shell_main_delegate_.reset(); 78 shell_main_delegate_.reset();
79
80 #if defined(OS_CHROMEOS)
81 chromeos::DBusThreadManager::Shutdown();
82 #endif
69 } 83 }
70 84
71 #if defined(OS_POSIX) 85 #if defined(OS_POSIX)
72 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make 86 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make
73 // debugging easier) and also exit with a known error code (so that the test 87 // debugging easier) and also exit with a known error code (so that the test
74 // framework considers this a failure -- http://crbug.com/57578). 88 // framework considers this a failure -- http://crbug.com/57578).
75 static void DumpStackTraceSignalHandler(int signal) { 89 static void DumpStackTraceSignalHandler(int signal) {
76 base::debug::StackTrace().PrintBacktrace(); 90 base::debug::StackTrace().PrintBacktrace();
77 _exit(128 + signal); 91 _exit(128 + signal);
78 } 92 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 pool.Recycle(); 125 pool.Recycle();
112 #endif 126 #endif
113 127
114 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 128 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
115 !i.IsAtEnd(); i.Advance()) { 129 !i.IsAtEnd(); i.Advance()) {
116 i.GetCurrentValue()->FastShutdownIfPossible(); 130 i.GetCurrentValue()->FastShutdownIfPossible();
117 } 131 }
118 } 132 }
119 133
120 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_browser_main_parts.cc ('k') | content/test/content_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698