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

Unified Diff: chrome/common/multi_process_lock_unittest.cc

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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/multi_process_lock_unittest.cc
diff --git a/chrome/common/multi_process_lock_unittest.cc b/chrome/common/multi_process_lock_unittest.cc
index 30c4d7b0ab9ade41f7eb130fee33f1d4502c1598..ef52b79690f14c53633105996b0c7ad1b7e07d65 100644
--- a/chrome/common/multi_process_lock_unittest.cc
+++ b/chrome/common/multi_process_lock_unittest.cc
@@ -9,6 +9,7 @@
#include "base/rand_util.h"
#include "base/stringprintf.h"
#include "base/test/multiprocess_test.h"
+#include "base/test/scoped_environment_variable.h"
#include "base/time.h"
#include "chrome/common/multi_process_lock.h"
#include "testing/multiprocess_func_list.h"
@@ -17,23 +18,6 @@ class MultiProcessLockTest : public base::MultiProcessTest {
public:
static const char kLockEnviromentVarName[];
- class ScopedEnvironmentVariable {
- public:
- ScopedEnvironmentVariable(const std::string &name,
- const std::string &value)
- : name_(name), environment_(base::Environment::Create()) {
jar (doing other things) 2012/11/16 20:29:23 nit: you could fix this up to have one initializer
- environment_->SetVar(name_.c_str(), value);
- }
- ~ScopedEnvironmentVariable() {
- environment_->UnSetVar(name_.c_str());
- }
-
- private:
- std::string name_;
- scoped_ptr<base::Environment> environment_;
- DISALLOW_COPY_AND_ASSIGN(ScopedEnvironmentVariable);
- };
-
std::string GenerateLockName();
void ExpectLockIsLocked(const std::string &name);
void ExpectLockIsUnlocked(const std::string &name);
@@ -49,7 +33,7 @@ std::string MultiProcessLockTest::GenerateLockName() {
}
void MultiProcessLockTest::ExpectLockIsLocked(const std::string &name) {
- ScopedEnvironmentVariable var(kLockEnviromentVarName, name);
+ base::ScopedEnvironmentVariable var(kLockEnviromentVarName, name);
base::ProcessHandle handle = SpawnChild("MultiProcessLockTryFailMain", false);
ASSERT_TRUE(handle);
int exit_code = 0;
@@ -59,7 +43,7 @@ void MultiProcessLockTest::ExpectLockIsLocked(const std::string &name) {
void MultiProcessLockTest::ExpectLockIsUnlocked(
const std::string &name) {
- ScopedEnvironmentVariable var(kLockEnviromentVarName, name);
+ base::ScopedEnvironmentVariable var(kLockEnviromentVarName, name);
base::ProcessHandle handle = SpawnChild("MultiProcessLockTrySucceedMain",
false);
ASSERT_TRUE(handle);

Powered by Google App Engine
This is Rietveld 408576698