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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #endif | 51 #endif |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 // Passed as value of kTestType. | 55 // Passed as value of kTestType. |
56 const char kBrowserTestType[] = "browser"; | 56 const char kBrowserTestType[] = "browser"; |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 InProcessBrowserTest::InProcessBrowserTest() | 60 InProcessBrowserTest::InProcessBrowserTest() |
61 : browser_(NULL), | 61 : browser_(NULL) |
62 dom_automation_enabled_(false) | |
63 #if defined(OS_POSIX) | 62 #if defined(OS_POSIX) |
64 , handle_sigterm_(true) | 63 , handle_sigterm_(true) |
65 #endif | 64 #endif |
66 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
67 , autorelease_pool_(NULL) | 66 , autorelease_pool_(NULL) |
68 #endif // OS_MACOSX | 67 #endif // OS_MACOSX |
69 { | 68 { |
70 #if defined(OS_MACOSX) | 69 #if defined(OS_MACOSX) |
71 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. | 70 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. |
72 // Before we run the browser, we have to hack the path to the exe to match | 71 // Before we run the browser, we have to hack the path to the exe to match |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // time code is directly executed. | 149 // time code is directly executed. |
151 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; | 150 autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; |
152 #endif | 151 #endif |
153 BrowserTestBase::SetUp(); | 152 BrowserTestBase::SetUp(); |
154 } | 153 } |
155 | 154 |
156 void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) { | 155 void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) { |
157 // Propagate commandline settings from test_launcher_utils. | 156 // Propagate commandline settings from test_launcher_utils. |
158 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); | 157 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); |
159 | 158 |
160 if (dom_automation_enabled_) | 159 command_line->AppendSwitch(switches::kDomAutomationController); |
161 command_line->AppendSwitch(switches::kDomAutomationController); | |
162 | 160 |
163 // This is a Browser test. | 161 // This is a Browser test. |
164 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); | 162 command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); |
165 | 163 |
166 #if defined(OS_WIN) | 164 #if defined(OS_WIN) |
167 // The Windows sandbox requires that the browser and child processes are the | 165 // The Windows sandbox requires that the browser and child processes are the |
168 // same binary. So we launch browser_process.exe which loads chrome.dll | 166 // same binary. So we launch browser_process.exe which loads chrome.dll |
169 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, | 167 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, |
170 command_line->GetProgram()); | 168 command_line->GetProgram()); |
171 #else | 169 #else |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // On the Mac, this eventually reaches | 402 // On the Mac, this eventually reaches |
405 // -[BrowserWindowController windowWillClose:], which will post a deferred | 403 // -[BrowserWindowController windowWillClose:], which will post a deferred |
406 // -autorelease on itself to ultimately destroy the Browser object. The line | 404 // -autorelease on itself to ultimately destroy the Browser object. The line |
407 // below is necessary to pump these pending messages to ensure all Browsers | 405 // below is necessary to pump these pending messages to ensure all Browsers |
408 // get deleted. | 406 // get deleted. |
409 ui_test_utils::RunAllPendingInMessageLoop(); | 407 ui_test_utils::RunAllPendingInMessageLoop(); |
410 delete autorelease_pool_; | 408 delete autorelease_pool_; |
411 autorelease_pool_ = NULL; | 409 autorelease_pool_ = NULL; |
412 #endif | 410 #endif |
413 } | 411 } |
OLD | NEW |