| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 5 #include <vector> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <cstdio> | 7 #include <cstdio> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 ASSERT_TRUE(InitHistory()); | 199 ASSERT_TRUE(InitHistory()); |
| 200 ASSERT_TRUE(InitVisited(kInitialSize, true)); | 200 ASSERT_TRUE(InitVisited(kInitialSize, true)); |
| 201 | 201 |
| 202 // Add a cluster from 14-17 wrapping around to 0. These will all hash to the | 202 // Add a cluster from 14-17 wrapping around to 0. These will all hash to the |
| 203 // same value. | 203 // same value. |
| 204 const VisitedLinkCommon::Fingerprint kFingerprint0 = kInitialSize * 0 + 14; | 204 const VisitedLinkCommon::Fingerprint kFingerprint0 = kInitialSize * 0 + 14; |
| 205 const VisitedLinkCommon::Fingerprint kFingerprint1 = kInitialSize * 1 + 14; | 205 const VisitedLinkCommon::Fingerprint kFingerprint1 = kInitialSize * 1 + 14; |
| 206 const VisitedLinkCommon::Fingerprint kFingerprint2 = kInitialSize * 2 + 14; | 206 const VisitedLinkCommon::Fingerprint kFingerprint2 = kInitialSize * 2 + 14; |
| 207 const VisitedLinkCommon::Fingerprint kFingerprint3 = kInitialSize * 3 + 14; | 207 const VisitedLinkCommon::Fingerprint kFingerprint3 = kInitialSize * 3 + 14; |
| 208 const VisitedLinkCommon::Fingerprint kFingerprint4 = kInitialSize * 4 + 14; | 208 const VisitedLinkCommon::Fingerprint kFingerprint4 = kInitialSize * 4 + 14; |
| 209 master_->AddFingerprint(kFingerprint0); // @14 | 209 master_->AddFingerprint(kFingerprint0, false); // @14 |
| 210 master_->AddFingerprint(kFingerprint1); // @15 | 210 master_->AddFingerprint(kFingerprint1, false); // @15 |
| 211 master_->AddFingerprint(kFingerprint2); // @16 | 211 master_->AddFingerprint(kFingerprint2, false); // @16 |
| 212 master_->AddFingerprint(kFingerprint3); // @0 | 212 master_->AddFingerprint(kFingerprint3, false); // @0 |
| 213 master_->AddFingerprint(kFingerprint4); // @1 | 213 master_->AddFingerprint(kFingerprint4, false); // @1 |
| 214 | 214 |
| 215 // Deleting 14 should move the next value up one slot (we do not specify an | 215 // Deleting 14 should move the next value up one slot (we do not specify an |
| 216 // order). | 216 // order). |
| 217 EXPECT_EQ(kFingerprint3, master_->hash_table_[0]); | 217 EXPECT_EQ(kFingerprint3, master_->hash_table_[0]); |
| 218 master_->DeleteFingerprint(kFingerprint3, false); | 218 master_->DeleteFingerprint(kFingerprint3, false); |
| 219 VisitedLinkCommon::Fingerprint zero_fingerprint = 0; | 219 VisitedLinkCommon::Fingerprint zero_fingerprint = 0; |
| 220 EXPECT_EQ(zero_fingerprint, master_->hash_table_[1]); | 220 EXPECT_EQ(zero_fingerprint, master_->hash_table_[1]); |
| 221 EXPECT_NE(zero_fingerprint, master_->hash_table_[0]); | 221 EXPECT_NE(zero_fingerprint, master_->hash_table_[0]); |
| 222 | 222 |
| 223 // Deleting the other four should leave the table empty. | 223 // Deleting the other four should leave the table empty. |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 EXPECT_EQ(1, profile()->add_event_count()); | 704 EXPECT_EQ(1, profile()->add_event_count()); |
| 705 EXPECT_EQ(0, profile()->reset_event_count()); | 705 EXPECT_EQ(0, profile()->reset_event_count()); |
| 706 | 706 |
| 707 // Activate the tab. | 707 // Activate the tab. |
| 708 rvh()->WasRestored(); | 708 rvh()->WasRestored(); |
| 709 | 709 |
| 710 // We should have only one more reset event. | 710 // We should have only one more reset event. |
| 711 EXPECT_EQ(1, profile()->add_event_count()); | 711 EXPECT_EQ(1, profile()->add_event_count()); |
| 712 EXPECT_EQ(1, profile()->reset_event_count()); | 712 EXPECT_EQ(1, profile()->reset_event_count()); |
| 713 } | 713 } |
| OLD | NEW |