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

Side by Side Diff: chrome/browser/net/predictor_unittest.cc

Issue 7605019: Reduce number of unnamed-type-template-args violations. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
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 <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 testing_master->Shutdown(); 257 testing_master->Shutdown();
258 } 258 }
259 259
260 //------------------------------------------------------------------------------ 260 //------------------------------------------------------------------------------
261 // Functions to help synthesize and test serializations of subresource referrer 261 // Functions to help synthesize and test serializations of subresource referrer
262 // lists. 262 // lists.
263 263
264 // Return a motivation_list if we can find one for the given motivating_host (or 264 // Return a motivation_list if we can find one for the given motivating_host (or
265 // NULL if a match is not found). 265 // NULL if a match is not found).
266 static ListValue* FindSerializationMotivation( 266 static ListValue* FindSerializationMotivation(const GURL& motivation,
267 const GURL& motivation, const ListValue& referral_list) { 267 const ListValue& referral_list) {
268 CHECK_LT(0u, referral_list.GetSize()); // Room for version. 268 CHECK_LT(0u, referral_list.GetSize()); // Room for version.
269 int format_version = -1; 269 int format_version = -1;
270 CHECK(referral_list.GetInteger(0, &format_version)); 270 CHECK(referral_list.GetInteger(0, &format_version));
271 CHECK_EQ(Predictor::PREDICTOR_REFERRER_VERSION, format_version); 271 CHECK_EQ(Predictor::kPredictorReferrerVersion, format_version);
272 ListValue* motivation_list(NULL); 272 ListValue* motivation_list(NULL);
273 for (size_t i = 1; i < referral_list.GetSize(); ++i) { 273 for (size_t i = 1; i < referral_list.GetSize(); ++i) {
274 referral_list.GetList(i, &motivation_list); 274 referral_list.GetList(i, &motivation_list);
275 std::string existing_spec; 275 std::string existing_spec;
276 EXPECT_TRUE(motivation_list->GetString(0, &existing_spec)); 276 EXPECT_TRUE(motivation_list->GetString(0, &existing_spec));
277 if (motivation == GURL(existing_spec)) 277 if (motivation == GURL(existing_spec))
278 return motivation_list; 278 return motivation_list;
279 } 279 }
280 return NULL; 280 return NULL;
281 } 281 }
282 282
283 // Create a new empty serialization list. 283 // Create a new empty serialization list.
284 static ListValue* NewEmptySerializationList() { 284 static ListValue* NewEmptySerializationList() {
285 base::ListValue* list = new base::ListValue; 285 base::ListValue* list = new base::ListValue;
286 list->Append( 286 list->Append(
287 new base::FundamentalValue(Predictor::PREDICTOR_REFERRER_VERSION)); 287 new base::FundamentalValue(Predictor::kPredictorReferrerVersion));
288 return list; 288 return list;
289 } 289 }
290 290
291 // Add a motivating_url and a subresource_url to a serialized list, using 291 // Add a motivating_url and a subresource_url to a serialized list, using
292 // this given latency. This is a helper function for quickly building these 292 // this given latency. This is a helper function for quickly building these
293 // lists. 293 // lists.
294 static void AddToSerializedList(const GURL& motivation, 294 static void AddToSerializedList(const GURL& motivation,
295 const GURL& subresource, 295 const GURL& subresource,
296 double use_rate, 296 double use_rate,
297 ListValue* referral_list ) { 297 ListValue* referral_list ) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 EXPECT_EQ(2U, referral_list.GetSize()); 618 EXPECT_EQ(2U, referral_list.GetSize());
619 619
620 predictor->DiscardAllResults(); 620 predictor->DiscardAllResults();
621 predictor->SerializeReferrers(&referral_list); 621 predictor->SerializeReferrers(&referral_list);
622 EXPECT_EQ(1U, referral_list.GetSize()); 622 EXPECT_EQ(1U, referral_list.GetSize());
623 623
624 predictor->Shutdown(); 624 predictor->Shutdown();
625 } 625 }
626 626
627 } // namespace chrome_browser_net 627 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor.cc ('k') | chrome/browser/password_manager/native_backend_gnome_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698