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

Side by Side Diff: base/test/scoped_environment_variable.h

Issue 11271024: Fix DeviceStatusCollectorTest.MaxStoredPeriods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_SCOPED_ENVIRONMENT_VARIABLE_H_
6 #define BASE_TEST_SCOPED_ENVIRONMENT_VARIABLE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12
13 namespace base {
14
15 class Environment;
16
17 // Overrides the environment variable value for |name| while in scope. The
18 // previous value is restored when this goes out of scope.
19 class ScopedEnvironmentVariable {
20 public:
21 ScopedEnvironmentVariable(const std::string& name, const std::string& value);
22 ~ScopedEnvironmentVariable();
23
24 private:
25 std::string name_;
26 bool prev_was_set_;
27 std::string prev_value_;
28 scoped_ptr<base::Environment> environment_;
29
30 DISALLOW_COPY_AND_ASSIGN(ScopedEnvironmentVariable);
31 };
32
33 } // namespace base
34
35 #endif // BASE_TEST_SCOPED_ENVIRONMENT_VARIABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698