OLD | NEW |
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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 sandbox::TargetPolicy* policy = broker_services->CreatePolicy(); | 572 sandbox::TargetPolicy* policy = broker_services->CreatePolicy(); |
573 sandbox::ResultCode result = policy->CreateAlternateDesktop(true); | 573 sandbox::ResultCode result = policy->CreateAlternateDesktop(true); |
574 CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result); | 574 CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result); |
575 policy->Release(); | 575 policy->Release(); |
576 } | 576 } |
577 } | 577 } |
578 #endif | 578 #endif |
579 return ChromeTestSuite(argc, argv).Run(); | 579 return ChromeTestSuite(argc, argv).Run(); |
580 } | 580 } |
581 | 581 |
582 // The exit manager is in charge of calling the dtors of singleton objects. | |
583 // On Windows, the call to ChromeMain() below will construct one for the | |
584 // chrome.dll module, but that global is not shared with this module, so if | |
585 // chrome.dll calls back out to this module and the called code uses a | |
586 // singleton, we'll need this. On other platforms, ChromeMain() isn't called | |
587 // at all below, so this is the lone exit manager for any code after this | |
588 // point. | |
589 // NOTE: We can't init this atop main() because ChromeTestSuite, as a subclass | |
590 // of TestSuite, creates one. So we wait until after the Run() call above to | |
591 // create the manager for the code path that _doesn't_ use ChromeTestSuite. | |
592 base::AtExitManager exit_manager; | |
593 | |
594 #if defined(OS_WIN) | 582 #if defined(OS_WIN) |
595 if (command_line->HasSwitch(switches::kProcessType)) { | 583 if (command_line->HasSwitch(switches::kProcessType)) { |
596 // This is a child process, call ChromeMain. | 584 // This is a child process, call ChromeMain. |
597 FilePath chrome_path(command_line->GetProgram().DirName()); | 585 FilePath chrome_path(command_line->GetProgram().DirName()); |
598 chrome_path = chrome_path.Append(chrome::kBrowserResourcesDll); | 586 chrome_path = chrome_path.Append(chrome::kBrowserResourcesDll); |
599 HMODULE dll = LoadLibrary(chrome_path.value().c_str()); | 587 HMODULE dll = LoadLibrary(chrome_path.value().c_str()); |
600 DLL_MAIN entry_point = | 588 DLL_MAIN entry_point = |
601 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll, "ChromeMain")); | 589 reinterpret_cast<DLL_MAIN>(::GetProcAddress(dll, "ChromeMain")); |
602 if (!entry_point) | 590 if (!entry_point) |
603 return -1; | 591 return -1; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 exit_code = 1; | 628 exit_code = 1; |
641 break; | 629 break; |
642 } | 630 } |
643 | 631 |
644 // Special value "-1" means "repeat indefinitely". | 632 // Special value "-1" means "repeat indefinitely". |
645 if (cycles != -1) | 633 if (cycles != -1) |
646 cycles--; | 634 cycles--; |
647 } | 635 } |
648 return exit_code; | 636 return exit_code; |
649 } | 637 } |
OLD | NEW |