OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | |
6 #include "base/macros.h" | 5 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
8 #include "base/test/simple_test_tick_clock.h" | 7 #include "base/test/simple_test_tick_clock.h" |
9 #include "components/copresence/timed_map.h" | 8 #include "components/copresence/timed_map.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
11 | 10 |
12 namespace { | 11 namespace { |
13 | 12 |
14 struct Value { | 13 struct Value { |
15 Value() : value(0) {} | 14 Value() : value(0) {} |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 EXPECT_FALSE(map.HasKey(0x1337)); | 120 EXPECT_FALSE(map.HasKey(0x1337)); |
122 EXPECT_EQ(0, map.GetValue(0x1337).value); | 121 EXPECT_EQ(0, map.GetValue(0x1337).value); |
123 EXPECT_TRUE(map.HasKey(0xbaad)); | 122 EXPECT_TRUE(map.HasKey(0xbaad)); |
124 EXPECT_EQ(0xf00d, map.GetValue(0xbaad).value); | 123 EXPECT_EQ(0xf00d, map.GetValue(0xbaad).value); |
125 | 124 |
126 // Check values at T=2*kLargeTimeValueSeconds | 125 // Check values at T=2*kLargeTimeValueSeconds |
127 clock->Advance(base::TimeDelta::FromSeconds(kLargeTimeValueSeconds)); | 126 clock->Advance(base::TimeDelta::FromSeconds(kLargeTimeValueSeconds)); |
128 EXPECT_FALSE(map.HasKey(0xbaad)); | 127 EXPECT_FALSE(map.HasKey(0xbaad)); |
129 EXPECT_EQ(0, map.GetValue(0xbaad).value); | 128 EXPECT_EQ(0, map.GetValue(0xbaad).value); |
130 } | 129 } |
OLD | NEW |