Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: app/test_suite.h

Issue 6263008: Move ResourceBundle, DataPack to ui/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/resource_bundle_win.cc ('k') | chrome/app/chrome_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
13 #include "base/path_service.h" 12 #include "base/path_service.h"
14 #include "base/mac/scoped_nsautorelease_pool.h" 13 #include "base/mac/scoped_nsautorelease_pool.h"
15 #include "base/test/test_suite.h" 14 #include "base/test/test_suite.h"
16 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/base/ui_base_paths.h"
17 18
18 #if defined(OS_MACOSX) 19 #if defined(OS_MACOSX)
19 #include "base/mac/mac_util.h" 20 #include "base/mac/mac_util.h"
20 #include "base/test/mock_chrome_application_mac.h" 21 #include "base/test/mock_chrome_application_mac.h"
21 #endif 22 #endif
22 23
23 class AppTestSuite : public base::TestSuite { 24 class AppTestSuite : public base::TestSuite {
24 public: 25 public:
25 AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) { 26 AppTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
26 } 27 }
27 28
28 protected: 29 protected:
29 30
30 virtual void Initialize() { 31 virtual void Initialize() {
31 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
32 // Some of the app unit tests try to open windows. 33 // Some of the app unit tests try to open windows.
33 mock_cr_app::RegisterMockCrApp(); 34 mock_cr_app::RegisterMockCrApp();
34 #endif 35 #endif
35 36
36 base::mac::ScopedNSAutoreleasePool autorelease_pool; 37 base::mac::ScopedNSAutoreleasePool autorelease_pool;
37 38
38 TestSuite::Initialize(); 39 TestSuite::Initialize();
39 40
40 app::RegisterPathProvider(); 41 app::RegisterPathProvider();
42 ui::RegisterPathProvider();
41 #if defined(OS_MACOSX) 43 #if defined(OS_MACOSX)
42 // Look in the framework bundle for resources. 44 // Look in the framework bundle for resources.
43 // TODO(port): make a resource bundle for non-app exes. What's done here 45 // TODO(port): make a resource bundle for non-app exes. What's done here
44 // isn't really right because this code needs to depend on chrome_dll 46 // isn't really right because this code needs to depend on chrome_dll
45 // being built. This is inappropriate in app. 47 // being built. This is inappropriate in app.
46 FilePath path; 48 FilePath path;
47 PathService::Get(base::DIR_EXE, &path); 49 PathService::Get(base::DIR_EXE, &path);
48 #if defined(GOOGLE_CHROME_BUILD) 50 #if defined(GOOGLE_CHROME_BUILD)
49 path = path.AppendASCII("Google Chrome Framework.framework"); 51 path = path.AppendASCII("Google Chrome Framework.framework");
50 #elif defined(CHROMIUM_BUILD) 52 #elif defined(CHROMIUM_BUILD)
51 path = path.AppendASCII("Chromium Framework.framework"); 53 path = path.AppendASCII("Chromium Framework.framework");
52 #else 54 #else
53 #error Unknown branding 55 #error Unknown branding
54 #endif 56 #endif
55 base::mac::SetOverrideAppBundlePath(path); 57 base::mac::SetOverrideAppBundlePath(path);
56 #elif defined(OS_POSIX) 58 #elif defined(OS_POSIX)
57 FilePath pak_dir; 59 FilePath pak_dir;
58 PathService::Get(base::DIR_MODULE, &pak_dir); 60 PathService::Get(base::DIR_MODULE, &pak_dir);
59 pak_dir = pak_dir.AppendASCII("app_unittests_strings"); 61 pak_dir = pak_dir.AppendASCII("app_unittests_strings");
60 PathService::Override(app::DIR_LOCALES, pak_dir); 62 PathService::Override(ui::DIR_LOCALES, pak_dir);
61 PathService::Override(app::FILE_RESOURCES_PAK, 63 PathService::Override(ui::FILE_RESOURCES_PAK,
62 pak_dir.AppendASCII("app_resources.pak")); 64 pak_dir.AppendASCII("app_resources.pak"));
63 #endif 65 #endif
64 66
65 // Force unittests to run using en-US so if we test against string 67 // Force unittests to run using en-US so if we test against string
66 // output, it'll pass regardless of the system language. 68 // output, it'll pass regardless of the system language.
67 ResourceBundle::InitSharedInstance("en-US"); 69 ResourceBundle::InitSharedInstance("en-US");
68 } 70 }
69 71
70 virtual void Shutdown() { 72 virtual void Shutdown() {
71 ResourceBundle::CleanupSharedInstance(); 73 ResourceBundle::CleanupSharedInstance();
72 74
73 #if defined(OS_MACOSX) 75 #if defined(OS_MACOSX)
74 base::mac::SetOverrideAppBundle(NULL); 76 base::mac::SetOverrideAppBundle(NULL);
75 #endif 77 #endif
76 TestSuite::Shutdown(); 78 TestSuite::Shutdown();
77 } 79 }
78 }; 80 };
79 81
80 #endif // APP_TEST_SUITE_H_ 82 #endif // APP_TEST_SUITE_H_
OLDNEW
« no previous file with comments | « app/resource_bundle_win.cc ('k') | chrome/app/chrome_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698