| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef APP_TEST_SUITE_H_ | 5 #ifndef APP_TEST_SUITE_H_ |
| 6 #define APP_TEST_SUITE_H_ | 6 #define APP_TEST_SUITE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #include "app/app_paths.h" | 11 #include "app/app_paths.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/mac/scoped_nsautorelease_pool.h" |
| 15 #include "base/test/test_suite.h" |
| 16 #include "build/build_config.h" |
| 17 |
| 14 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 15 #include "base/mac_util.h" | 19 #include "base/mac/mac_util.h" |
| 16 #include "base/test/mock_chrome_application_mac.h" | 20 #include "base/test/mock_chrome_application_mac.h" |
| 17 #endif | 21 #endif |
| 18 #include "base/mac/scoped_nsautorelease_pool.h" | |
| 19 #include "base/test/test_suite.h" | |
| 20 | 22 |
| 21 class AppTestSuite : public base::TestSuite { | 23 class AppTestSuite : public base::TestSuite { |
| 22 public: | 24 public: |
| 23 AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) { | 25 AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) { |
| 24 } | 26 } |
| 25 | 27 |
| 26 protected: | 28 protected: |
| 27 | 29 |
| 28 virtual void Initialize() { | 30 virtual void Initialize() { |
| 29 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 43 // being built. This is inappropriate in app. | 45 // being built. This is inappropriate in app. |
| 44 FilePath path; | 46 FilePath path; |
| 45 PathService::Get(base::DIR_EXE, &path); | 47 PathService::Get(base::DIR_EXE, &path); |
| 46 #if defined(GOOGLE_CHROME_BUILD) | 48 #if defined(GOOGLE_CHROME_BUILD) |
| 47 path = path.AppendASCII("Google Chrome Framework.framework"); | 49 path = path.AppendASCII("Google Chrome Framework.framework"); |
| 48 #elif defined(CHROMIUM_BUILD) | 50 #elif defined(CHROMIUM_BUILD) |
| 49 path = path.AppendASCII("Chromium Framework.framework"); | 51 path = path.AppendASCII("Chromium Framework.framework"); |
| 50 #else | 52 #else |
| 51 #error Unknown branding | 53 #error Unknown branding |
| 52 #endif | 54 #endif |
| 53 mac_util::SetOverrideAppBundlePath(path); | 55 base::mac::SetOverrideAppBundlePath(path); |
| 54 #elif defined(OS_POSIX) | 56 #elif defined(OS_POSIX) |
| 55 FilePath pak_dir; | 57 FilePath pak_dir; |
| 56 PathService::Get(base::DIR_MODULE, &pak_dir); | 58 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 57 pak_dir = pak_dir.AppendASCII("app_unittests_strings"); | 59 pak_dir = pak_dir.AppendASCII("app_unittests_strings"); |
| 58 PathService::Override(app::DIR_LOCALES, pak_dir); | 60 PathService::Override(app::DIR_LOCALES, pak_dir); |
| 59 PathService::Override(app::FILE_RESOURCES_PAK, | 61 PathService::Override(app::FILE_RESOURCES_PAK, |
| 60 pak_dir.AppendASCII("app_resources.pak")); | 62 pak_dir.AppendASCII("app_resources.pak")); |
| 61 #endif | 63 #endif |
| 62 | 64 |
| 63 // Force unittests to run using en-US so if we test against string | 65 // Force unittests to run using en-US so if we test against string |
| 64 // output, it'll pass regardless of the system language. | 66 // output, it'll pass regardless of the system language. |
| 65 ResourceBundle::InitSharedInstance("en-US"); | 67 ResourceBundle::InitSharedInstance("en-US"); |
| 66 } | 68 } |
| 67 | 69 |
| 68 virtual void Shutdown() { | 70 virtual void Shutdown() { |
| 69 ResourceBundle::CleanupSharedInstance(); | 71 ResourceBundle::CleanupSharedInstance(); |
| 70 | 72 |
| 71 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
| 72 mac_util::SetOverrideAppBundle(NULL); | 74 base::mac::SetOverrideAppBundle(NULL); |
| 73 #endif | 75 #endif |
| 74 TestSuite::Shutdown(); | 76 TestSuite::Shutdown(); |
| 75 } | 77 } |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 #endif // APP_TEST_SUITE_H_ | 80 #endif // APP_TEST_SUITE_H_ |
| OLD | NEW |