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
72
73
74
75
76
77
78
|
// Copyright (c) 2010 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.
#include "chrome/test/ui/ui_test.h"
#include "base/environment.h"
#include "build/build_config.h"
class LocaleTestsBase : public UITest {
public:
LocaleTestsBase() : UITest(), old_lc_all_(NULL) {
}
virtual void TearDown() {
#if defined(OS_LINUX)
scoped_ptr<base::Environment> env(base::Environment::Create());
if (old_lc_all_) {
env->SetVar("LC_ALL", old_lc_all_);
} else {
env->UnSetVar("LC_ALL");
}
#endif
UITest::TearDown();
}
protected:
const char* old_lc_all_;
};
class LocaleTestsDa : public LocaleTestsBase {
public:
LocaleTestsDa() : LocaleTestsBase() {
launch_arguments_.AppendSwitchASCII("lang", "da");
// Linux doesn't use --lang, it only uses environment variables to set the
// language.
#if defined(OS_LINUX)
old_lc_all_ = getenv("LC_ALL");
setenv("LC_ALL", "da_DK.UTF-8", 1);
#endif
}
};
class LocaleTestsHe : public LocaleTestsBase {
public:
LocaleTestsHe() : LocaleTestsBase() {
launch_arguments_.AppendSwitchASCII("lang", "he");
#if defined(OS_LINUX)
old_lc_all_ = getenv("LC_ALL");
setenv("LC_ALL", "he_IL.UTF-8", 1);
#endif
}
};
class LocaleTestsZhTw : public LocaleTestsBase {
public:
LocaleTestsZhTw() : LocaleTestsBase() {
launch_arguments_.AppendSwitchASCII("lang", "zh-TW");
#if defined(OS_LINUX)
old_lc_all_ = getenv("LC_ALL");
setenv("LC_ALL", "zh_TW.UTF-8", 1);
#endif
}
};
TEST_F(LocaleTestsDa, TestStart) {
// Just making sure we can start/shutdown cleanly.
}
TEST_F(LocaleTestsHe, TestStart) {
// Just making sure we can start/shutdown cleanly.
}
TEST_F(LocaleTestsZhTw, TestStart) {
// Just making sure we can start/shutdown cleanly.
}
|