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

Side by Side Diff: chrome/browser/locale_tests_uitest.cc

Issue 3043018: base: Add UnSetEnv function to EnvVarGetter API. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2006-2008 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 #include "chrome/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #include "base/env_var.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
8 9
9 class LocaleTestsBase : public UITest { 10 class LocaleTestsBase : public UITest {
10 public: 11 public:
11 LocaleTestsBase() : UITest(), old_lc_all_(NULL) { 12 LocaleTestsBase() : UITest(), old_lc_all_(NULL) {
12 } 13 }
13 14
14 protected: 15 protected:
15 void RestoreLcAllEnvironment() { 16 void RestoreLcAllEnvironment() {
16 #if defined(OS_LINUX) 17 #if defined(OS_LINUX)
18 scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create());
17 if (old_lc_all_) { 19 if (old_lc_all_) {
18 setenv("LC_ALL", old_lc_all_, 1); 20 env->SetEnv("LC_ALL", old_lc_all_);
19 } else { 21 } else {
20 unsetenv("LC_ALL"); 22 env->UnSetEnv("LC_ALL");
21 } 23 }
22 #endif 24 #endif
23 }; 25 };
24 26
25 const char* old_lc_all_; 27 const char* old_lc_all_;
26 }; 28 };
27 29
28 30
29 class LocaleTestsDa : public LocaleTestsBase { 31 class LocaleTestsDa : public LocaleTestsBase {
30 public: 32 public:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 71
70 TEST_F(LocaleTestsHe, TestStart) { 72 TEST_F(LocaleTestsHe, TestStart) {
71 // Just making sure we can start/shutdown cleanly. 73 // Just making sure we can start/shutdown cleanly.
72 RestoreLcAllEnvironment(); 74 RestoreLcAllEnvironment();
73 } 75 }
74 76
75 TEST_F(LocaleTestsZhTw, TestStart) { 77 TEST_F(LocaleTestsZhTw, TestStart) {
76 // Just making sure we can start/shutdown cleanly. 78 // Just making sure we can start/shutdown cleanly.
77 RestoreLcAllEnvironment(); 79 RestoreLcAllEnvironment();
78 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698