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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/test/test_suite.h" | 8 #include "base/test/test_suite.h" |
9 #include "media/base/media.h" | 9 #include "media/base/media.h" |
10 | 10 |
11 class TestSuiteNoAtExit : public base::TestSuite { | 11 class TestSuiteNoAtExit : public base::TestSuite { |
12 public: | 12 public: |
13 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv, false) {} | 13 TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv, false) {} |
14 virtual ~TestSuiteNoAtExit() {} | 14 virtual ~TestSuiteNoAtExit() {} |
15 }; | 15 }; |
16 | 16 |
17 int main(int argc, char** argv) { | 17 int main(int argc, char** argv) { |
18 // By default command-line parsing happens only in TestSuite::Run(), but | 18 // By default command-line parsing happens only in TestSuite::Run(), but |
19 // that's too late to get VLOGs and so on from | 19 // that's too late to get VLOGs and so on from |
20 // InitializeMediaLibraryForTesting() below. Instead initialize logging | 20 // InitializeMediaLibraryForTesting() below. Instead initialize logging |
21 // explicitly here (and have it get re-initialized by TestSuite::Run()). | 21 // explicitly here (and have it get re-initialized by TestSuite::Run()). |
22 CommandLine::Init(argc, argv); | 22 CommandLine::Init(argc, argv); |
23 CHECK(logging::InitLogging( | 23 CHECK(logging::InitLogging( |
24 NULL, | 24 NULL, |
25 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 25 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
26 logging::DONT_LOCK_LOG_FILE, | 26 logging::DONT_LOCK_LOG_FILE, |
27 logging::APPEND_TO_OLD_LOG_FILE, | 27 logging::APPEND_TO_OLD_LOG_FILE, |
28 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); | 28 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); |
29 | |
30 // On Android, AtExitManager is created in | |
31 // testing/android/native_test_wrapper.cc before main() is called. | |
Ami GONE FROM CHROMIUM
2012/07/24 23:37:35
Do you mean native_test_launcher.cc?
Is this patt
nilesh
2012/07/25 00:19:45
Yes. Corrected.
nilesh
2012/07/25 00:23:11
I can look into having multiple AtExitManager not
Ami GONE FROM CHROMIUM
2012/07/25 17:09:59
Can you make the pre-main() code not need an AEM?
nilesh
2012/07/25 21:56:32
I take back my comment that we need similar code i
| |
32 // The same thing is also done in base/test/test_suite.cc | |
Ami GONE FROM CHROMIUM
2012/07/24 23:37:35
This line isn't useful to commit IMO.
nilesh
2012/07/25 00:19:45
Removed.
| |
33 #if !defined(OS_ANDROID) | |
29 base::AtExitManager exit_manager; | 34 base::AtExitManager exit_manager; |
35 #endif | |
30 | 36 |
31 media::InitializeMediaLibraryForTesting(); | 37 media::InitializeMediaLibraryForTesting(); |
32 | 38 |
33 return TestSuiteNoAtExit(argc, argv).Run(); | 39 return TestSuiteNoAtExit(argc, argv).Run(); |
34 } | 40 } |
OLD | NEW |