| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <iosfwd> | 5 #include <iosfwd> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/port.h" | 12 #include "base/port.h" |
| 13 #include "build/build_config.h" |
| 13 #include "chrome/browser/sync/util/event_sys-inl.h" | 14 #include "chrome/browser/sync/util/event_sys-inl.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 using std::endl; | 17 using std::endl; |
| 17 using std::ostream; | 18 using std::ostream; |
| 18 using std::string; | 19 using std::string; |
| 19 using std::stringstream; | 20 using std::stringstream; |
| 20 using std::vector; | 21 using std::vector; |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return 0; | 216 return 0; |
| 216 } | 217 } |
| 217 | 218 |
| 218 void HandleEvent(const TestEvent& event) { | 219 void HandleEvent(const TestEvent& event) { |
| 219 remove_event_mutex_.Lock(); | 220 remove_event_mutex_.Lock(); |
| 220 remove_event_bool_ = true; | 221 remove_event_bool_ = true; |
| 221 pthread_cond_broadcast(&remove_event_.condvar_); | 222 pthread_cond_broadcast(&remove_event_.condvar_); |
| 222 remove_event_mutex_.Unlock(); | 223 remove_event_mutex_.Unlock(); |
| 223 | 224 |
| 224 // Windows and posix use different functions to sleep. | 225 // Windows and posix use different functions to sleep. |
| 225 #ifdef OS_WINDOWS | 226 #ifdef OS_WIN |
| 226 Sleep(1); | 227 Sleep(1); |
| 227 #else | 228 #else |
| 228 sleep(1); | 229 sleep(1); |
| 229 #endif | 230 #endif |
| 230 | 231 |
| 231 for (int i = 0; i < threads_.size(); i++) { | 232 for (int i = 0; i < threads_.size(); i++) { |
| 232 if (*(threads_[i].completed)) | 233 if (*(threads_[i].completed)) |
| 233 LOG(FATAL) << "A test thread exited too early."; | 234 LOG(FATAL) << "A test thread exited too early."; |
| 234 } | 235 } |
| 235 } | 236 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 262 Pair sally("Sally"); | 263 Pair sally("Sally"); |
| 263 HookupDeleter deleter; | 264 HookupDeleter deleter; |
| 264 deleter.hookup_ = NewEventListenerHookup(sally.event_channel(), | 265 deleter.hookup_ = NewEventListenerHookup(sally.event_channel(), |
| 265 &deleter, | 266 &deleter, |
| 266 &HookupDeleter::HandleEvent); | 267 &HookupDeleter::HandleEvent); |
| 267 sally.set_a(1); | 268 sally.set_a(1); |
| 268 ASSERT_TRUE(NULL == deleter.hookup_); | 269 ASSERT_TRUE(NULL == deleter.hookup_); |
| 269 } | 270 } |
| 270 | 271 |
| 271 } // namespace | 272 } // namespace |
| OLD | NEW |