| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 void PumpLoop() { | 67 void PumpLoop() { |
| 68 // Do it this way instead of RunAllPending to pump loop exactly once | 68 // Do it this way instead of RunAllPending to pump loop exactly once |
| 69 // (necessary in the presence of timers; see comment in | 69 // (necessary in the presence of timers; see comment in |
| 70 // QuitLoopNow). | 70 // QuitLoopNow). |
| 71 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&QuitLoopNow)); | 71 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&QuitLoopNow)); |
| 72 RunLoop(); | 72 RunLoop(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ModelSafeRoutingInfo TypesToRoutingInfo(const ModelTypeSet& types) { | 75 ModelSafeRoutingInfo TypesToRoutingInfo(ModelTypeSet types) { |
| 76 ModelSafeRoutingInfo routes; | 76 ModelSafeRoutingInfo routes; |
| 77 for (ModelTypeSet::Iterator iter = types.First(); iter.Good(); iter.Inc()) { | 77 for (ModelTypeSet::Iterator iter = types.First(); iter.Good(); iter.Inc()) { |
| 78 routes[iter.Get()] = GROUP_PASSIVE; | 78 routes[iter.Get()] = GROUP_PASSIVE; |
| 79 } | 79 } |
| 80 return routes; | 80 return routes; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Convenient to use in tests wishing to analyze SyncShare calls over time. | 83 // Convenient to use in tests wishing to analyze SyncShare calls over time. |
| 84 static const size_t kMinNumSamples = 5; | 84 static const size_t kMinNumSamples = 5; |
| 85 class SyncSchedulerTest : public testing::Test { | 85 class SyncSchedulerTest : public testing::Test { |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 // Should save the nudge for until after the server is reachable. | 1117 // Should save the nudge for until after the server is reachable. |
| 1118 MessageLoop::current()->RunAllPending(); | 1118 MessageLoop::current()->RunAllPending(); |
| 1119 | 1119 |
| 1120 connection()->SetServerReachable(); | 1120 connection()->SetServerReachable(); |
| 1121 connection()->UpdateConnectionStatus(); | 1121 connection()->UpdateConnectionStatus(); |
| 1122 scheduler()->OnConnectionStatusChange(); | 1122 scheduler()->OnConnectionStatusChange(); |
| 1123 MessageLoop::current()->RunAllPending(); | 1123 MessageLoop::current()->RunAllPending(); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 } // namespace syncer | 1126 } // namespace syncer |
| OLD | NEW |