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

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

Issue 150087: Create A/B test of SDCH... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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) 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 <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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 WaitForResolution(testing_master, names); 279 WaitForResolution(testing_master, names);
280 280
281 EXPECT_TRUE(testing_master->WasFound(goog)); 281 EXPECT_TRUE(testing_master->WasFound(goog));
282 282
283 MessageLoop::current()->RunAllPending(); 283 MessageLoop::current()->RunAllPending();
284 284
285 EXPECT_GT(testing_master->peak_pending_lookups(), names.size() / 2); 285 EXPECT_GT(testing_master->peak_pending_lookups(), names.size() / 2);
286 EXPECT_LE(testing_master->peak_pending_lookups(), names.size()); 286 EXPECT_LE(testing_master->peak_pending_lookups(), names.size());
287 EXPECT_LE(testing_master->peak_pending_lookups(), 287 EXPECT_LE(testing_master->peak_pending_lookups(),
288 DnsPrefetcherInit::kMaxConcurrentLookups); 288 testing_master->max_concurrent_lookups());
289 289
290 testing_master->Shutdown(); 290 testing_master->Shutdown();
291 } 291 }
292 292
293 TEST_F(DnsMasterTest, ConcurrentLookupTest) { 293 TEST_F(DnsMasterTest, ConcurrentLookupTest) {
294 mapper_->AddSimulatedFailure("*.notfound"); 294 mapper_->AddSimulatedFailure("*.notfound");
295 295
296 scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, 296 scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
297 MessageLoop::current(), default_max_queueing_delay_, 297 MessageLoop::current(), default_max_queueing_delay_,
298 DnsPrefetcherInit::kMaxConcurrentLookups); 298 DnsPrefetcherInit::kMaxConcurrentLookups);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 EXPECT_FALSE(testing_master->WasFound(bad2)); 333 EXPECT_FALSE(testing_master->WasFound(bad2));
334 334
335 MessageLoop::current()->RunAllPending(); 335 MessageLoop::current()->RunAllPending();
336 336
337 EXPECT_FALSE(testing_master->WasFound(bad1)); 337 EXPECT_FALSE(testing_master->WasFound(bad1));
338 EXPECT_FALSE(testing_master->WasFound(bad2)); 338 EXPECT_FALSE(testing_master->WasFound(bad2));
339 339
340 EXPECT_GT(testing_master->peak_pending_lookups(), names.size() / 2); 340 EXPECT_GT(testing_master->peak_pending_lookups(), names.size() / 2);
341 EXPECT_LE(testing_master->peak_pending_lookups(), names.size()); 341 EXPECT_LE(testing_master->peak_pending_lookups(), names.size());
342 EXPECT_LE(testing_master->peak_pending_lookups(), 342 EXPECT_LE(testing_master->peak_pending_lookups(),
343 DnsPrefetcherInit::kMaxConcurrentLookups); 343 testing_master->max_concurrent_lookups());
344 344
345 testing_master->Shutdown(); 345 testing_master->Shutdown();
346 } 346 }
347 347
348 TEST_F(DnsMasterTest, DISABLED_MassiveConcurrentLookupTest) { 348 TEST_F(DnsMasterTest, DISABLED_MassiveConcurrentLookupTest) {
349 mapper_->AddSimulatedFailure("*.notfound"); 349 mapper_->AddSimulatedFailure("*.notfound");
350 350
351 scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver, 351 scoped_refptr<DnsMaster> testing_master = new DnsMaster(new net::HostResolver,
352 MessageLoop::current(), default_max_queueing_delay_, 352 MessageLoop::current(), default_max_queueing_delay_,
353 DnsPrefetcherInit::kMaxConcurrentLookups); 353 DnsPrefetcherInit::kMaxConcurrentLookups);
354 354
355 NameList names; 355 NameList names;
356 for (int i = 0; i < 100; i++) 356 for (int i = 0; i < 100; i++)
357 names.push_back("host" + IntToString(i) + ".notfound"); 357 names.push_back("host" + IntToString(i) + ".notfound");
358 358
359 // Try to flood the master with many concurrent requests. 359 // Try to flood the master with many concurrent requests.
360 for (int i = 0; i < 10; i++) 360 for (int i = 0; i < 10; i++)
361 testing_master->ResolveList(names, DnsHostInfo::PAGE_SCAN_MOTIVATED); 361 testing_master->ResolveList(names, DnsHostInfo::PAGE_SCAN_MOTIVATED);
362 362
363 WaitForResolution(testing_master, names); 363 WaitForResolution(testing_master, names);
364 364
365 MessageLoop::current()->RunAllPending(); 365 MessageLoop::current()->RunAllPending();
366 366
367 EXPECT_LE(testing_master->peak_pending_lookups(), names.size()); 367 EXPECT_LE(testing_master->peak_pending_lookups(), names.size());
368 EXPECT_LE(testing_master->peak_pending_lookups(), 368 EXPECT_LE(testing_master->peak_pending_lookups(),
369 DnsPrefetcherInit::kMaxConcurrentLookups); 369 testing_master->max_concurrent_lookups());
370 370
371 testing_master->Shutdown(); 371 testing_master->Shutdown();
372 } 372 }
373 373
374 //------------------------------------------------------------------------------ 374 //------------------------------------------------------------------------------
375 // Functions to help synthesize and test serializations of subresource referrer 375 // Functions to help synthesize and test serializations of subresource referrer
376 // lists. 376 // lists.
377 377
378 // Return a motivation_list if we can find one for the given motivating_host (or 378 // Return a motivation_list if we can find one for the given motivating_host (or
379 // NULL if a match is not found). 379 // NULL if a match is not found).
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 EXPECT_EQ(queue.Pop(), "startup"); 623 EXPECT_EQ(queue.Pop(), "startup");
624 EXPECT_EQ(queue.Pop(), "omni"); 624 EXPECT_EQ(queue.Pop(), "omni");
625 625
626 EXPECT_TRUE(queue.IsEmpty()); 626 EXPECT_TRUE(queue.IsEmpty());
627 } 627 }
628 628
629 629
630 630
631 631
632 } // namespace chrome_browser_net 632 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/dns_master.h ('k') | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698