OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef APP_TEST_SUITE_H_ |
| 6 #define APP_TEST_SUITE_H_ |
| 7 |
| 8 #include "build/build_config.h" |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "app/app_paths.h" |
| 13 #include "app/resource_bundle.h" |
| 14 #include "base/path_service.h" |
| 15 #if defined(OS_MACOSX) |
| 16 #include "base/mac_util.h" |
| 17 #endif |
| 18 #include "base/scoped_nsautorelease_pool.h" |
| 19 #include "base/test_suite.h" |
| 20 |
| 21 class AppTestSuite : public TestSuite { |
| 22 public: |
| 23 AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) { |
| 24 } |
| 25 |
| 26 protected: |
| 27 |
| 28 virtual void Initialize() { |
| 29 base::ScopedNSAutoreleasePool autorelease_pool; |
| 30 |
| 31 TestSuite::Initialize(); |
| 32 |
| 33 app::RegisterPathProvider(); |
| 34 |
| 35 #if defined(OS_MACOSX) |
| 36 FilePath path; |
| 37 PathService::Get(base::DIR_EXE, &path); |
| 38 // TODO(port): make a resource bundle for non-app exes. |
| 39 path = path.AppendASCII("Chromium.app"); |
| 40 mac_util::SetOverrideAppBundlePath(path); |
| 41 #endif |
| 42 |
| 43 // Force unittests to run using en-us so if we test against string |
| 44 // output, it'll pass regardless of the system language. |
| 45 ResourceBundle::InitSharedInstance(L"en-us"); |
| 46 ResourceBundle::GetSharedInstance().LoadThemeResources(); |
| 47 } |
| 48 |
| 49 virtual void Shutdown() { |
| 50 ResourceBundle::CleanupSharedInstance(); |
| 51 |
| 52 #if defined(OS_MACOSX) |
| 53 mac_util::SetOverrideAppBundle(NULL); |
| 54 #endif |
| 55 TestSuite::Shutdown(); |
| 56 } |
| 57 }; |
| 58 |
| 59 #endif // APP_TEST_SUITE_H_ |
OLD | NEW |