| OLD | NEW |
| 1 // Copyright (c) 2010 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 #ifndef GFX_TEST_SUITE_H_ | 5 #ifndef GFX_TEST_SUITE_H_ |
| 6 #define GFX_TEST_SUITE_H_ | 6 #define GFX_TEST_SUITE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "gfx/gfx_paths.h" | |
| 12 #include "base/file_path.h" | |
| 13 #include "base/path_service.h" | |
| 14 #include "base/mac/scoped_nsautorelease_pool.h" | |
| 15 #include "base/test/test_suite.h" | 11 #include "base/test/test_suite.h" |
| 16 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 17 | 13 |
| 18 #if defined(OS_MACOSX) | |
| 19 #include "base/mac/mac_util.h" | |
| 20 #endif | |
| 21 | |
| 22 class GfxTestSuite : public base::TestSuite { | 14 class GfxTestSuite : public base::TestSuite { |
| 23 public: | 15 public: |
| 24 GfxTestSuite(int argc, char** argv) : TestSuite(argc, argv) { | 16 GfxTestSuite(int argc, char** argv); |
| 25 } | |
| 26 | 17 |
| 27 protected: | 18 protected: |
| 28 | 19 // Overridden from base::TestSuite: |
| 29 virtual void Initialize() { | 20 virtual void Initialize(); |
| 30 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 21 virtual void Shutdown(); |
| 31 | |
| 32 TestSuite::Initialize(); | |
| 33 | |
| 34 gfx::RegisterPathProvider(); | |
| 35 | |
| 36 #if defined(OS_MACOSX) | |
| 37 // Look in the framework bundle for resources. | |
| 38 // TODO(port): make a resource bundle for non-app exes. What's done here | |
| 39 // isn't really right because this code needs to depend on chrome_dll | |
| 40 // being built. This is inappropriate in app. | |
| 41 FilePath path; | |
| 42 PathService::Get(base::DIR_EXE, &path); | |
| 43 #if defined(GOOGLE_CHROME_BUILD) | |
| 44 path = path.AppendASCII("Google Chrome Framework.framework"); | |
| 45 #elif defined(CHROMIUM_BUILD) | |
| 46 path = path.AppendASCII("Chromium Framework.framework"); | |
| 47 #else | |
| 48 #error Unknown branding | |
| 49 #endif | |
| 50 base::mac::SetOverrideAppBundlePath(path); | |
| 51 #endif // OS_MACOSX | |
| 52 } | |
| 53 | |
| 54 virtual void Shutdown() { | |
| 55 #if defined(OS_MACOSX) | |
| 56 base::mac::SetOverrideAppBundle(NULL); | |
| 57 #endif | |
| 58 TestSuite::Shutdown(); | |
| 59 } | |
| 60 }; | 22 }; |
| 61 | 23 |
| 62 #endif // GFX_TEST_SUITE_H_ | 24 #endif // GFX_TEST_SUITE_H_ |
| OLD | NEW |