Lines Matching refs:Key
22 // Builds a key for |hostname|, defaulting the address family to unspecified.
23 HostCache::Key Key(const std::string& hostname) {
24 return HostCache::Key(hostname, ADDRESS_FAMILY_UNSPECIFIED, 0);
41 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), base::TimeTicks()) == NULL);
42 cache.Set(Key("foobar.com"), OK, AddressList(), now);
43 entry1 = cache.Lookup(Key("foobar.com"), base::TimeTicks());
51 EXPECT_TRUE(cache.Lookup(Key("foobar2.com"), base::TimeTicks()) == NULL);
52 cache.Set(Key("foobar2.com"), OK, AddressList(), now);
53 entry2 = cache.Lookup(Key("foobar2.com"), base::TimeTicks());
61 EXPECT_EQ(entry1, cache.Lookup(Key("foobar.com"), now));
62 EXPECT_EQ(entry2, cache.Lookup(Key("foobar2.com"), now));
67 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), now) == NULL);
68 EXPECT_EQ(entry2, cache.Lookup(Key("foobar2.com"), now));
71 cache.Set(Key("foobar.com"), OK, AddressList(), now);
73 EXPECT_EQ(entry1, cache.Lookup(Key("foobar.com"), now));
77 EXPECT_EQ(entry1, cache.Lookup(Key("foobar.com"), now));
78 EXPECT_EQ(entry2, cache.Lookup(Key("foobar2.com"), now));
83 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), now) == NULL);
84 EXPECT_TRUE(cache.Lookup(Key("foobar2.com"), now) == NULL);
95 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), base::TimeTicks()) == NULL);
96 cache.Set(Key("foobar.com"), ERR_NAME_NOT_RESOLVED, AddressList(), now);
100 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), now) == NULL);
104 cache.Set(Key("foobar.com"), OK, AddressList(), now);
105 EXPECT_FALSE(cache.Lookup(Key("foobar.com"), now) == NULL);
106 cache.Set(Key("foobar.com"), ERR_NAME_NOT_RESOLVED, AddressList(), now);
107 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), now) == NULL);
125 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), base::TimeTicks()) == NULL);
126 cache.Set(Key("foobar.com"), ERR_NAME_NOT_RESOLVED, AddressList(), now);
127 entry1 = cache.Lookup(Key("foobar.com"), base::TimeTicks());
135 EXPECT_TRUE(cache.Lookup(Key("foobar2.com"), base::TimeTicks()) == NULL);
136 cache.Set(Key("foobar2.com"), ERR_NAME_NOT_RESOLVED, AddressList(), now);
137 entry2 = cache.Lookup(Key("foobar2.com"), base::TimeTicks());
145 EXPECT_EQ(entry1, cache.Lookup(Key("foobar.com"), now));
146 EXPECT_EQ(entry2, cache.Lookup(Key("foobar2.com"), now));
151 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), now) == NULL);
152 EXPECT_EQ(entry2, cache.Lookup(Key("foobar2.com"), now));
155 cache.Set(Key("foobar.com"), ERR_NAME_NOT_RESOLVED, AddressList(), now);
157 EXPECT_EQ(entry1, cache.Lookup(Key("foobar.com"), now));
161 EXPECT_EQ(entry1, cache.Lookup(Key("foobar.com"), now));
162 EXPECT_EQ(entry2, cache.Lookup(Key("foobar2.com"), now));
167 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), now) == NULL);
168 EXPECT_TRUE(cache.Lookup(Key("foobar2.com"), now) == NULL);
183 cache.Set(Key(hostname), OK, AddressList(), now);
191 cache.Set(Key(hostname), OK, AddressList(), t);
198 cache.Set(Key(hostname), ERR_NAME_NOT_RESOLVED, AddressList(), now);
202 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid0")));
203 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid1")));
204 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid2")));
205 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid3")));
206 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid4")));
207 EXPECT_TRUE(ContainsKey(cache.entries_, Key("expired0")));
208 EXPECT_TRUE(ContainsKey(cache.entries_, Key("expired1")));
209 EXPECT_TRUE(ContainsKey(cache.entries_, Key("expired2")));
210 EXPECT_TRUE(ContainsKey(cache.entries_, Key("negative0")));
211 EXPECT_TRUE(ContainsKey(cache.entries_, Key("negative1")));
219 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid0")));
220 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid1")));
221 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid2")));
222 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid3")));
223 EXPECT_TRUE(ContainsKey(cache.entries_, Key("valid4")));
224 EXPECT_FALSE(ContainsKey(cache.entries_, Key("expired0")));
225 EXPECT_FALSE(ContainsKey(cache.entries_, Key("expired1")));
226 EXPECT_FALSE(ContainsKey(cache.entries_, Key("expired2")));
227 EXPECT_FALSE(ContainsKey(cache.entries_, Key("negative0")));
228 EXPECT_FALSE(ContainsKey(cache.entries_, Key("negative1")));
244 cache.Set(Key("host1"), OK, AddressList(), now);
245 cache.Set(Key("host2"), OK, AddressList(), now);
246 cache.Set(Key("expired"), OK, AddressList(), now - kSuccessEntryTTL);
251 EXPECT_FALSE(NULL == cache.Lookup(Key("host1"), now));
252 EXPECT_FALSE(NULL == cache.Lookup(Key("host2"), now));
253 EXPECT_TRUE(NULL == cache.Lookup(Key("expired"), now));
256 cache.Set(Key("host3"), OK, AddressList(), now);
258 EXPECT_TRUE(cache.Lookup(Key("expired"), now) == NULL);
259 EXPECT_FALSE(cache.Lookup(Key("host1"), now) == NULL);
260 EXPECT_FALSE(cache.Lookup(Key("host2"), now) == NULL);
261 EXPECT_FALSE(cache.Lookup(Key("host3"), now) == NULL);
265 cache.Set(Key("host4"), OK, AddressList(), now);
267 cache.Set(Key("host5"), OK, AddressList(), now);
269 EXPECT_FALSE(cache.Lookup(Key("host5"), now) == NULL);
280 HostCache::Key key1("foobar.com", ADDRESS_FAMILY_UNSPECIFIED, 0);
281 HostCache::Key key2("foobar.com", ADDRESS_FAMILY_IPV4, 0);
315 HostCache::Key key1("foobar.com", ADDRESS_FAMILY_IPV4, 0);
316 HostCache::Key key2("foobar.com", ADDRESS_FAMILY_IPV4,
318 HostCache::Key key3("foobar.com", ADDRESS_FAMILY_IPV4,
364 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), base::TimeTicks()) == NULL);
365 cache.Set(Key("foobar.com"), OK, AddressList(), now);
366 EXPECT_TRUE(cache.Lookup(Key("foobar.com"), base::TimeTicks()) == NULL);
380 cache.Set(Key("foobar1.com"), OK, AddressList(), now);
381 cache.Set(Key("foobar2.com"), OK, AddressList(), now);
382 cache.Set(Key("foobar3.com"), OK, AddressList(), now);
391 // Tests the less than and equal operators for HostCache::Key work.
395 HostCache::Key key1;
396 HostCache::Key key2;
405 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
406 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
410 HostCache::Key("host1", ADDRESS_FAMILY_IPV4, 0),
411 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
415 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
416 HostCache::Key("host1", ADDRESS_FAMILY_IPV4, 0),
420 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
421 HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED, 0),
425 HostCache::Key("host1", ADDRESS_FAMILY_IPV4, 0),
426 HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED, 0),
430 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
431 HostCache::Key("host2", ADDRESS_FAMILY_IPV4, 0),
435 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
436 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED,
441 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED,
443 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED, 0),
447 HostCache::Key("host1", ADDRESS_FAMILY_UNSPECIFIED,
449 HostCache::Key("host2", ADDRESS_FAMILY_UNSPECIFIED,
458 const HostCache::Key& key1 = tests[i].key1;
459 const HostCache::Key& key2 = tests[i].key2;