Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/safe_search_api/safe_search_url_checker_unittest.cc

Issue 2404933002: Remove SafeSearchURLCheckerTest.Equivalence which doesn't test anything (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/safe_search_api/safe_search_url_checker.h" 5 #include "chrome/browser/safe_search_api/safe_search_url_checker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SendValidResponse(true); 128 SendValidResponse(true);
129 } 129 }
130 { 130 {
131 GURL url(GetNewURL()); 131 GURL url(GetNewURL());
132 ASSERT_FALSE(CheckURL(url)); 132 ASSERT_FALSE(CheckURL(url));
133 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, true)); 133 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, true));
134 SendFailedResponse(); 134 SendFailedResponse();
135 } 135 }
136 } 136 }
137 137
138 TEST_F(SafeSearchURLCheckerTest, Equivalence) {
139 // Leading "www." in the response should be ignored.
140 {
141 GURL url("http://example.com");
142 GURL url_response("http://www.example.com");
143 ASSERT_FALSE(CheckURL(url));
144 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, false));
145 SendValidResponse(false);
146 }
147 // Scheme should be ignored.
148 {
149 GURL url("http://www.example2.com");
150 GURL url_response("https://www.example2.com");
151 ASSERT_FALSE(CheckURL(url));
152 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, false));
153 SendValidResponse(false);
154 }
155 // Both at the same time should work as well.
156 {
157 GURL url("http://example3.com");
158 GURL url_response("https://www.example3.com");
159 ASSERT_FALSE(CheckURL(url));
160 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, false));
161 SendValidResponse(false);
162 }
163 }
164
165 TEST_F(SafeSearchURLCheckerTest, Cache) { 138 TEST_F(SafeSearchURLCheckerTest, Cache) {
166 // One more URL than fit in the cache. 139 // One more URL than fit in the cache.
167 ASSERT_EQ(2u, kCacheSize); 140 ASSERT_EQ(2u, kCacheSize);
168 GURL url1(GetNewURL()); 141 GURL url1(GetNewURL());
169 GURL url2(GetNewURL()); 142 GURL url2(GetNewURL());
170 GURL url3(GetNewURL()); 143 GURL url3(GetNewURL());
171 144
172 // Populate the cache. 145 // Populate the cache.
173 ASSERT_FALSE(CheckURL(url1)); 146 ASSERT_FALSE(CheckURL(url1));
174 EXPECT_CALL(*this, OnCheckDone(url1, Classification::SAFE, false)); 147 EXPECT_CALL(*this, OnCheckDone(url1, Classification::SAFE, false));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ASSERT_FALSE(CheckURL(url)); 184 ASSERT_FALSE(CheckURL(url));
212 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, false)); 185 EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, false));
213 SendValidResponse(false); 186 SendValidResponse(false);
214 187
215 // Since the cache timeout is zero, the cache entry should be invalidated 188 // Since the cache timeout is zero, the cache entry should be invalidated
216 // immediately. 189 // immediately.
217 ASSERT_FALSE(CheckURL(url)); 190 ASSERT_FALSE(CheckURL(url));
218 EXPECT_CALL(*this, OnCheckDone(url, Classification::UNSAFE, false)); 191 EXPECT_CALL(*this, OnCheckDone(url, Classification::UNSAFE, false));
219 SendValidResponse(true); 192 SendValidResponse(true);
220 } 193 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698