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