OLD | NEW |
1 // Copyright (c) 2010 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/environment.h" | 6 #include "base/environment.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 | 128 |
129 MULTIPROCESS_TEST_MAIN(MultiProcessLockTryFailMain) { | 129 MULTIPROCESS_TEST_MAIN(MultiProcessLockTryFailMain) { |
130 std::string name; | 130 std::string name; |
131 scoped_ptr<base::Environment> environment(base::Environment::Create()); | 131 scoped_ptr<base::Environment> environment(base::Environment::Create()); |
132 EXPECT_TRUE(environment->GetVar(MultiProcessLockTest::kLockEnviromentVarName, | 132 EXPECT_TRUE(environment->GetVar(MultiProcessLockTest::kLockEnviromentVarName, |
133 &name)); | 133 &name)); |
134 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
135 // OS X sends out a log if a lock fails. | 135 // OS X sends out a log if a lock fails. |
136 // Hopefully this will keep people from panicking about it when they | 136 // Hopefully this will keep people from panicking about it when they |
137 // are perusing thge build logs. | 137 // are perusing the build logs. |
138 LOG(INFO) << "Following error log " | 138 LOG(INFO) << "Following error log " |
139 << "\"CFMessagePort: bootstrap_register(): failed 1100 (0x44c) " | 139 << "\"CFMessagePort: bootstrap_register(): failed 1100 (0x44c) " |
140 << "'Permission denied'\" is expected"; | 140 << "'Permission denied'\" is expected"; |
141 #endif // defined(OS_MACOSX) | 141 #endif // defined(OS_MACOSX) |
142 scoped_ptr<MultiProcessLock> test_lock( | 142 scoped_ptr<MultiProcessLock> test_lock( |
143 MultiProcessLock::Create(name)); | 143 MultiProcessLock::Create(name)); |
144 EXPECT_FALSE(test_lock->TryLock()); | 144 EXPECT_FALSE(test_lock->TryLock()); |
145 return 0; | 145 return 0; |
146 } | 146 } |
147 | 147 |
148 MULTIPROCESS_TEST_MAIN(MultiProcessLockTrySucceedMain) { | 148 MULTIPROCESS_TEST_MAIN(MultiProcessLockTrySucceedMain) { |
149 std::string name; | 149 std::string name; |
150 scoped_ptr<base::Environment> environment(base::Environment::Create()); | 150 scoped_ptr<base::Environment> environment(base::Environment::Create()); |
151 EXPECT_TRUE(environment->GetVar(MultiProcessLockTest::kLockEnviromentVarName, | 151 EXPECT_TRUE(environment->GetVar(MultiProcessLockTest::kLockEnviromentVarName, |
152 &name)); | 152 &name)); |
153 scoped_ptr<MultiProcessLock> test_lock( | 153 scoped_ptr<MultiProcessLock> test_lock( |
154 MultiProcessLock::Create(name)); | 154 MultiProcessLock::Create(name)); |
155 EXPECT_TRUE(test_lock->TryLock()); | 155 EXPECT_TRUE(test_lock->TryLock()); |
156 return 0; | 156 return 0; |
157 } | 157 } |
OLD | NEW |