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 | 5 |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "chrome/browser/safe_browsing/protocol_manager.h" | 9 #include "chrome/browser/safe_browsing/protocol_manager.h" |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 phish.subs = ""; | 69 phish.subs = ""; |
70 EXPECT_EQ(pm.FormatList(phish, false), | 70 EXPECT_EQ(pm.FormatList(phish, false), |
71 "goog-phish-shavar;a:1,4,6,8-20,99\n"); | 71 "goog-phish-shavar;a:1,4,6,8-20,99\n"); |
72 EXPECT_EQ(pm.FormatList(phish, true), | 72 EXPECT_EQ(pm.FormatList(phish, true), |
73 "goog-phish-shavar;a:1,4,6,8-20,99:mac\n"); | 73 "goog-phish-shavar;a:1,4,6,8-20,99:mac\n"); |
74 | 74 |
75 // Sub chunks only. | 75 // Sub chunks only. |
76 phish.adds = ""; | 76 phish.adds = ""; |
77 phish.subs = "16,32,64-96"; | 77 phish.subs = "16,32,64-96"; |
78 EXPECT_EQ(pm.FormatList(phish, false), "goog-phish-shavar;s:16,32,64-96\n"); | 78 EXPECT_EQ(pm.FormatList(phish, false), "goog-phish-shavar;s:16,32,64-96\n"); |
79 EXPECT_EQ(pm.FormatList(phish, true), "goog-phish-shavar;s:16,32,64-96:mac\n")
; | 79 EXPECT_EQ(pm.FormatList(phish, true), |
| 80 "goog-phish-shavar;s:16,32,64-96:mac\n"); |
80 | 81 |
81 // No chunks of either type. | 82 // No chunks of either type. |
82 phish.adds = ""; | 83 phish.adds = ""; |
83 phish.subs = ""; | 84 phish.subs = ""; |
84 EXPECT_EQ(pm.FormatList(phish, false), "goog-phish-shavar;\n"); | 85 EXPECT_EQ(pm.FormatList(phish, false), "goog-phish-shavar;\n"); |
85 EXPECT_EQ(pm.FormatList(phish, true), "goog-phish-shavar;mac\n"); | 86 EXPECT_EQ(pm.FormatList(phish, true), "goog-phish-shavar;mac\n"); |
86 } | 87 } |
87 | 88 |
88 // Flakey, see http://code.google.com/p/chromium/issues/detail?id=1880 | 89 // Flakey, see http://code.google.com/p/chromium/issues/detail?id=1880 |
89 TEST_F(SafeBrowsingProtocolManagerTest, DISABLED_TestGetHashBackOffTimes) { | 90 TEST_F(SafeBrowsingProtocolManagerTest, DISABLED_TestGetHashBackOffTimes) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // 6 errors, reached max backoff. | 131 // 6 errors, reached max backoff. |
131 pm.HandleGetHashError(); | 132 pm.HandleGetHashError(); |
132 EXPECT_EQ(pm.gethash_error_count_, 6); | 133 EXPECT_EQ(pm.gethash_error_count_, 6); |
133 EXPECT_TRUE(pm.next_gethash_time_ == now + TimeDelta::FromMinutes(480)); | 134 EXPECT_TRUE(pm.next_gethash_time_ == now + TimeDelta::FromMinutes(480)); |
134 | 135 |
135 // 7 errors. | 136 // 7 errors. |
136 pm.HandleGetHashError(); | 137 pm.HandleGetHashError(); |
137 EXPECT_EQ(pm.gethash_error_count_, 7); | 138 EXPECT_EQ(pm.gethash_error_count_, 7); |
138 EXPECT_TRUE(pm.next_gethash_time_== now + TimeDelta::FromMinutes(480)); | 139 EXPECT_TRUE(pm.next_gethash_time_== now + TimeDelta::FromMinutes(480)); |
139 } | 140 } |
OLD | NEW |