| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Single-process mode is not set in BrowserMain, so process it explicitly, | 171 // Single-process mode is not set in BrowserMain, so process it explicitly, |
| 172 // and set up renderer. | 172 // and set up renderer. |
| 173 if (command_line->HasSwitch(switches::kSingleProcess)) { | 173 if (command_line->HasSwitch(switches::kSingleProcess)) { |
| 174 content::SetRendererClientForTesting( | 174 content::SetRendererClientForTesting( |
| 175 &g_chrome_content_renderer_client.Get()); | 175 &g_chrome_content_renderer_client.Get()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 #if defined(OS_CHROMEOS) | 178 #if defined(OS_CHROMEOS) |
| 179 // Make sure that the log directory exists. | 179 // Make sure that the log directory exists. |
| 180 base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); | 180 base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); |
| 181 file_util::CreateDirectory(log_dir); | 181 base::CreateDirectory(log_dir); |
| 182 #endif // defined(OS_CHROMEOS) | 182 #endif // defined(OS_CHROMEOS) |
| 183 | 183 |
| 184 #if defined(OS_MACOSX) | 184 #if defined(OS_MACOSX) |
| 185 // On Mac, without the following autorelease pool, code which is directly | 185 // On Mac, without the following autorelease pool, code which is directly |
| 186 // executed (as opposed to executed inside a message loop) would autorelease | 186 // executed (as opposed to executed inside a message loop) would autorelease |
| 187 // objects into a higher-level pool. This pool is not recycled in-sync with | 187 // objects into a higher-level pool. This pool is not recycled in-sync with |
| 188 // the message loops' pools and causes problems with code relying on | 188 // the message loops' pools and causes problems with code relying on |
| 189 // deallocation via an autorelease pool (such as browser window closure and | 189 // deallocation via an autorelease pool (such as browser window closure and |
| 190 // browser shutdown). To avoid this, the following pool is recycled after each | 190 // browser shutdown). To avoid this, the following pool is recycled after each |
| 191 // time code is directly executed. | 191 // time code is directly executed. |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 // On the Mac, this eventually reaches | 468 // On the Mac, this eventually reaches |
| 469 // -[BrowserWindowController windowWillClose:], which will post a deferred | 469 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 470 // -autorelease on itself to ultimately destroy the Browser object. The line | 470 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 471 // below is necessary to pump these pending messages to ensure all Browsers | 471 // below is necessary to pump these pending messages to ensure all Browsers |
| 472 // get deleted. | 472 // get deleted. |
| 473 content::RunAllPendingInMessageLoop(); | 473 content::RunAllPendingInMessageLoop(); |
| 474 delete autorelease_pool_; | 474 delete autorelease_pool_; |
| 475 autorelease_pool_ = NULL; | 475 autorelease_pool_ = NULL; |
| 476 #endif | 476 #endif |
| 477 } | 477 } |
| OLD | NEW |