OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/invalidation/impl/registration_manager.h" | 5 #include "components/invalidation/impl/registration_manager.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <cmath> | 11 #include <cmath> |
9 #include <cstddef> | 12 #include <cstddef> |
10 #include <deque> | 13 #include <deque> |
11 #include <vector> | 14 #include <vector> |
12 | 15 |
13 #include "base/basictypes.h" | 16 #include "base/macros.h" |
14 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
15 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
16 #include "components/invalidation/public/invalidation_util.h" | 19 #include "components/invalidation/public/invalidation_util.h" |
17 #include "google/cacheinvalidation/include/invalidation-client.h" | 20 #include "google/cacheinvalidation/include/invalidation-client.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
19 | 22 |
20 namespace syncer { | 23 namespace syncer { |
21 namespace { | 24 namespace { |
22 | 25 |
23 // Fake registration manager that lets you override jitter. | 26 // Fake registration manager that lets you override jitter. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 for (RegistrationManager::PendingRegistrationMap::const_iterator it = | 124 for (RegistrationManager::PendingRegistrationMap::const_iterator it = |
122 pending_registrations.begin(); it != pending_registrations.end(); | 125 pending_registrations.begin(); it != pending_registrations.end(); |
123 ++it) { | 126 ++it) { |
124 SCOPED_TRACE(ObjectIdToString(it->first)); | 127 SCOPED_TRACE(ObjectIdToString(it->first)); |
125 pending_ids.insert(it->first); | 128 pending_ids.insert(it->first); |
126 base::TimeDelta offset = | 129 base::TimeDelta offset = |
127 it->second.last_registration_request - | 130 it->second.last_registration_request - |
128 it->second.registration_attempt; | 131 it->second.registration_attempt; |
129 base::TimeDelta expected_delay = | 132 base::TimeDelta expected_delay = |
130 base::TimeDelta::FromSeconds( | 133 base::TimeDelta::FromSeconds( |
131 static_cast<int64>(expected_delay_seconds)) + offset; | 134 static_cast<int64_t>(expected_delay_seconds)) + |
| 135 offset; |
132 // TODO(akalin): Add base::PrintTo() for base::Time and | 136 // TODO(akalin): Add base::PrintTo() for base::Time and |
133 // base::TimeDeltas. | 137 // base::TimeDeltas. |
134 EXPECT_EQ(expected_delay, it->second.delay) | 138 EXPECT_EQ(expected_delay, it->second.delay) |
135 << expected_delay.InMicroseconds() | 139 << expected_delay.InMicroseconds() |
136 << ", " << it->second.delay.InMicroseconds(); | 140 << ", " << it->second.delay.InMicroseconds(); |
137 if (it->second.delay <= base::TimeDelta()) { | 141 if (it->second.delay <= base::TimeDelta()) { |
138 EXPECT_EQ(base::TimeDelta(), it->second.actual_delay); | 142 EXPECT_EQ(base::TimeDelta(), it->second.actual_delay); |
139 } else { | 143 } else { |
140 EXPECT_EQ(it->second.actual_delay, it->second.delay); | 144 EXPECT_EQ(it->second.actual_delay, it->second.delay); |
141 } | 145 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 fake_registration_manager_.GetPendingRegistrationsForTest()); | 424 fake_registration_manager_.GetPendingRegistrationsForTest()); |
421 | 425 |
422 fake_registration_manager_.MarkAllRegistrationsLost(); | 426 fake_registration_manager_.MarkAllRegistrationsLost(); |
423 ExpectPendingRegistrations( | 427 ExpectPendingRegistrations( |
424 enabled_ids, 0.0, | 428 enabled_ids, 0.0, |
425 fake_registration_manager_.GetPendingRegistrationsForTest()); | 429 fake_registration_manager_.GetPendingRegistrationsForTest()); |
426 } | 430 } |
427 | 431 |
428 } // namespace | 432 } // namespace |
429 } // namespace syncer | 433 } // namespace syncer |
OLD | NEW |