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

Side by Side Diff: webkit/appcache/appcache_storage_impl_unittest.cc

Issue 7031065: AppCache + Quota integration (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 <stack> 5 #include <stack>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // load should complete syncly. 323 // load should complete syncly.
324 324
325 // Setup some preconditions. Make an 'unstored' cache for 325 // Setup some preconditions. Make an 'unstored' cache for
326 // us to load. The ctor should put it in the working set. 326 // us to load. The ctor should put it in the working set.
327 int64 cache_id = storage()->NewCacheId(); 327 int64 cache_id = storage()->NewCacheId();
328 scoped_refptr<AppCache> cache(new AppCache(service(), cache_id)); 328 scoped_refptr<AppCache> cache(new AppCache(service(), cache_id));
329 329
330 // Conduct the test. 330 // Conduct the test.
331 storage()->LoadCache(cache_id, delegate()); 331 storage()->LoadCache(cache_id, delegate());
332 EXPECT_EQ(cache_id, delegate()->loaded_cache_id_); 332 EXPECT_EQ(cache_id, delegate()->loaded_cache_id_);
333 EXPECT_EQ(cache.get(), delegate()->loaded_cache_.get()); 333 EXPECT_EQ(cache.get(), delegate()->loaded_cache_.get());
michaeln 2011/06/08 18:09:54 verify access notification
334 TestFinished(); 334 TestFinished();
335 } 335 }
336 336
337 // CreateGroup -------------------------------------------- 337 // CreateGroup --------------------------------------------
338 338
339 void CreateGroupInEmptyOrigin() { 339 void CreateGroupInEmptyOrigin() {
340 // Attempt to load a group that doesn't exist, one should 340 // Attempt to load a group that doesn't exist, one should
341 // be created for us, but not stored. 341 // be created for us, but not stored.
342 342
343 // Since the origin has no groups, the storage class will respond 343 // Since the origin has no groups, the storage class will respond
344 // syncly. 344 // syncly.
345 storage()->LoadOrCreateGroup(kManifestUrl, delegate()); 345 storage()->LoadOrCreateGroup(kManifestUrl, delegate());
346 Verify_CreateGroup(); 346 Verify_CreateGroup();
347 } 347 }
348 348
349 void CreateGroupInPopulatedOrigin() { 349 void CreateGroupInPopulatedOrigin() {
350 // Attempt to load a group that doesn't exist, one should 350 // Attempt to load a group that doesn't exist, one should
351 // be created for us, but not stored. 351 // be created for us, but not stored.
352 PushNextTask(NewRunnableMethod( 352 PushNextTask(NewRunnableMethod(
353 this, &AppCacheStorageImplTest::Verify_CreateGroup)); 353 this, &AppCacheStorageImplTest::Verify_CreateGroup));
354 354
355 // Since the origin has groups, storage class will have to 355 // Since the origin has groups, storage class will have to
356 // consult the database and completion will be async. 356 // consult the database and completion will be async.
357 storage()->origins_with_groups_.insert(kManifestUrl.GetOrigin()); 357 storage()->usage_map_[kManifestUrl.GetOrigin()] = 10;
358 358
359 storage()->LoadOrCreateGroup(kManifestUrl, delegate()); 359 storage()->LoadOrCreateGroup(kManifestUrl, delegate());
360 EXPECT_FALSE(delegate()->loaded_group_.get()); 360 EXPECT_FALSE(delegate()->loaded_group_.get());
361 } 361 }
362 362
363 void Verify_CreateGroup() { 363 void Verify_CreateGroup() {
michaeln 2011/06/08 18:09:54 verify access notification
364 EXPECT_EQ(kManifestUrl, delegate()->loaded_manifest_url_); 364 EXPECT_EQ(kManifestUrl, delegate()->loaded_manifest_url_);
365 EXPECT_TRUE(delegate()->loaded_group_.get()); 365 EXPECT_TRUE(delegate()->loaded_group_.get());
366 EXPECT_TRUE(delegate()->loaded_group_->HasOneRef()); 366 EXPECT_TRUE(delegate()->loaded_group_->HasOneRef());
367 EXPECT_FALSE(delegate()->loaded_group_->newest_complete_cache()); 367 EXPECT_FALSE(delegate()->loaded_group_->newest_complete_cache());
368 368
369 // Should not have been stored in the database. 369 // Should not have been stored in the database.
370 AppCacheDatabase::GroupRecord record; 370 AppCacheDatabase::GroupRecord record;
371 EXPECT_FALSE(database()->FindGroup( 371 EXPECT_FALSE(database()->FindGroup(
372 delegate()->loaded_group_->group_id(), &record)); 372 delegate()->loaded_group_->group_id(), &record));
373 373
(...skipping 25 matching lines...) Expand all
399 EXPECT_EQ(1, delegate()->loaded_cache_id_); 399 EXPECT_EQ(1, delegate()->loaded_cache_id_);
400 400
401 // The group should also have been loaded. 401 // The group should also have been loaded.
402 EXPECT_TRUE(delegate()->loaded_cache_->owning_group()); 402 EXPECT_TRUE(delegate()->loaded_cache_->owning_group());
403 EXPECT_TRUE(delegate()->loaded_cache_->owning_group()->HasOneRef()); 403 EXPECT_TRUE(delegate()->loaded_cache_->owning_group()->HasOneRef());
404 EXPECT_EQ(1, delegate()->loaded_cache_->owning_group()->group_id()); 404 EXPECT_EQ(1, delegate()->loaded_cache_->owning_group()->group_id());
405 405
406 // Drop things from the working set. 406 // Drop things from the working set.
407 delegate()->loaded_cache_ = NULL; 407 delegate()->loaded_cache_ = NULL;
408 EXPECT_FALSE(delegate()->loaded_group_); 408 EXPECT_FALSE(delegate()->loaded_group_);
409 409
michaeln 2011/06/08 18:09:54 verify access notification
410 // Conduct the group load test, also complete asyncly. 410 // Conduct the group load test, also complete asyncly.
411 PushNextTask(NewRunnableMethod( 411 PushNextTask(NewRunnableMethod(
412 this, &AppCacheStorageImplTest::Verify_LoadGroup_Far_Hit)); 412 this, &AppCacheStorageImplTest::Verify_LoadGroup_Far_Hit));
413 413
414 storage()->LoadOrCreateGroup(kManifestUrl, delegate()); 414 storage()->LoadOrCreateGroup(kManifestUrl, delegate());
415 } 415 }
416 416
417 void Verify_LoadGroup_Far_Hit() { 417 void Verify_LoadGroup_Far_Hit() {
418 EXPECT_TRUE(delegate()->loaded_group_); 418 EXPECT_TRUE(delegate()->loaded_group_);
419 EXPECT_EQ(kManifestUrl, delegate()->loaded_manifest_url_); 419 EXPECT_EQ(kManifestUrl, delegate()->loaded_manifest_url_);
420 EXPECT_TRUE(delegate()->loaded_group_->newest_complete_cache()); 420 EXPECT_TRUE(delegate()->loaded_group_->newest_complete_cache());
421 delegate()->loaded_groups_newest_cache_ = NULL; 421 delegate()->loaded_groups_newest_cache_ = NULL;
422 EXPECT_TRUE(delegate()->loaded_group_->HasOneRef()); 422 EXPECT_TRUE(delegate()->loaded_group_->HasOneRef());
michaeln 2011/06/08 18:09:54 verify access notification
423 TestFinished(); 423 TestFinished();
424 } 424 }
425 425
426 // StoreNewGroup -------------------------------------- 426 // StoreNewGroup --------------------------------------
427 427
428 void StoreNewGroup() { 428 void StoreNewGroup() {
429 // Store a group and its newest cache. Should complete asyncly. 429 // Store a group and its newest cache. Should complete asyncly.
430 PushNextTask(NewRunnableMethod( 430 PushNextTask(NewRunnableMethod(
431 this, &AppCacheStorageImplTest::Verify_StoreNewGroup)); 431 this, &AppCacheStorageImplTest::Verify_StoreNewGroup));
432 432
433 // Setup some preconditions. Create a group and newest cache that 433 // Setup some preconditions. Create a group and newest cache that
434 // appear to be "unstored". 434 // appear to be "unstored".
435 group_ = new AppCacheGroup( 435 group_ = new AppCacheGroup(
436 service(), kManifestUrl, storage()->NewGroupId()); 436 service(), kManifestUrl, storage()->NewGroupId());
437 cache_ = new AppCache(service(), storage()->NewCacheId()); 437 cache_ = new AppCache(service(), storage()->NewCacheId());
michaeln 2011/06/08 18:09:54 add an Entry to have a non-zero cache size
438 // Hold a ref to the cache simulate the UpdateJob holding that ref, 438 // Hold a ref to the cache simulate the UpdateJob holding that ref,
439 // and hold a ref to the group to simulate the CacheHost holding that ref. 439 // and hold a ref to the group to simulate the CacheHost holding that ref.
440 440
441 // Conduct the store test. 441 // Conduct the store test.
442 storage()->StoreGroupAndNewestCache(group_, cache_, delegate()); 442 storage()->StoreGroupAndNewestCache(group_, cache_, delegate());
443 EXPECT_FALSE(delegate()->stored_group_success_); 443 EXPECT_FALSE(delegate()->stored_group_success_);
444 } 444 }
445 445
446 void Verify_StoreNewGroup() { 446 void Verify_StoreNewGroup() {
447 EXPECT_TRUE(delegate()->stored_group_success_); 447 EXPECT_TRUE(delegate()->stored_group_success_);
448 EXPECT_EQ(group_.get(), delegate()->stored_group_.get()); 448 EXPECT_EQ(group_.get(), delegate()->stored_group_.get());
449 EXPECT_EQ(cache_.get(), group_->newest_complete_cache()); 449 EXPECT_EQ(cache_.get(), group_->newest_complete_cache());
450 EXPECT_TRUE(cache_->is_complete()); 450 EXPECT_TRUE(cache_->is_complete());
451 451
452 // Should have been stored in the database. 452 // Should have been stored in the database.
453 AppCacheDatabase::GroupRecord group_record; 453 AppCacheDatabase::GroupRecord group_record;
454 AppCacheDatabase::CacheRecord cache_record; 454 AppCacheDatabase::CacheRecord cache_record;
455 EXPECT_TRUE(database()->FindGroup(group_->group_id(), &group_record)); 455 EXPECT_TRUE(database()->FindGroup(group_->group_id(), &group_record));
456 EXPECT_TRUE(database()->FindCache(cache_->cache_id(), &cache_record)); 456 EXPECT_TRUE(database()->FindCache(cache_->cache_id(), &cache_record));
michaeln 2011/06/08 18:09:54 also verify notification of the modification
457 TestFinished(); 457 TestFinished();
458 } 458 }
459 459
460 // StoreExistingGroup -------------------------------------- 460 // StoreExistingGroup --------------------------------------
461 461
462 void StoreExistingGroup() { 462 void StoreExistingGroup() {
463 // Store a group and its newest cache. Should complete asyncly. 463 // Store a group and its newest cache. Should complete asyncly.
464 PushNextTask(NewRunnableMethod( 464 PushNextTask(NewRunnableMethod(
465 this, &AppCacheStorageImplTest::Verify_StoreExistingGroup)); 465 this, &AppCacheStorageImplTest::Verify_StoreExistingGroup));
466 466
467 // Setup some preconditions. Create a group and old complete cache 467 // Setup some preconditions. Create a group and old complete cache
468 // that appear to be "stored" 468 // that appear to be "stored"
469 MakeCacheAndGroup(kManifestUrl, 1, 1, true); 469 MakeCacheAndGroup(kManifestUrl, 1, 1, true);
470 470
471 // And a newest unstored complete cache. 471 // And a newest unstored complete cache.
472 cache2_ = new AppCache(service(), 2); 472 cache2_ = new AppCache(service(), 2);
michaeln 2011/06/08 18:09:54 ditto add an entry
473 473
474 // Conduct the test. 474 // Conduct the test.
475 storage()->StoreGroupAndNewestCache(group_, cache2_, delegate()); 475 storage()->StoreGroupAndNewestCache(group_, cache2_, delegate());
476 EXPECT_FALSE(delegate()->stored_group_success_); 476 EXPECT_FALSE(delegate()->stored_group_success_);
477 } 477 }
478 478
479 void Verify_StoreExistingGroup() { 479 void Verify_StoreExistingGroup() {
480 EXPECT_TRUE(delegate()->stored_group_success_); 480 EXPECT_TRUE(delegate()->stored_group_success_);
481 EXPECT_EQ(group_.get(), delegate()->stored_group_.get()); 481 EXPECT_EQ(group_.get(), delegate()->stored_group_.get());
482 EXPECT_EQ(cache2_.get(), group_->newest_complete_cache()); 482 EXPECT_EQ(cache2_.get(), group_->newest_complete_cache());
483 EXPECT_TRUE(cache2_->is_complete()); 483 EXPECT_TRUE(cache2_->is_complete());
484 484
485 // The new cache should have been stored in the database. 485 // The new cache should have been stored in the database.
486 AppCacheDatabase::GroupRecord group_record; 486 AppCacheDatabase::GroupRecord group_record;
487 AppCacheDatabase::CacheRecord cache_record; 487 AppCacheDatabase::CacheRecord cache_record;
488 EXPECT_TRUE(database()->FindGroup(1, &group_record)); 488 EXPECT_TRUE(database()->FindGroup(1, &group_record));
489 EXPECT_TRUE(database()->FindCache(2, &cache_record)); 489 EXPECT_TRUE(database()->FindCache(2, &cache_record));
490 490
491 // The old cache should have been deleted 491 // The old cache should have been deleted
492 EXPECT_FALSE(database()->FindCache(1, &cache_record)); 492 EXPECT_FALSE(database()->FindCache(1, &cache_record));
michaeln 2011/06/08 18:09:54 ditto verify modification notification
493 TestFinished(); 493 TestFinished();
494 } 494 }
495 495
496 // StoreExistingGroupExistingCache ------------------------------- 496 // StoreExistingGroupExistingCache -------------------------------
497 497
498 void StoreExistingGroupExistingCache() { 498 void StoreExistingGroupExistingCache() {
499 // Store a group with updates to its existing newest complete cache. 499 // Store a group with updates to its existing newest complete cache.
500 // Setup some preconditions. Create a group and a complete cache that 500 // Setup some preconditions. Create a group and a complete cache that
501 // appear to be "stored". 501 // appear to be "stored".
502 502
(...skipping 29 matching lines...) Expand all
532 EXPECT_TRUE(expected_update_time == cache_record.update_time); 532 EXPECT_TRUE(expected_update_time == cache_record.update_time);
533 EXPECT_EQ(100, cache_record.cache_size); 533 EXPECT_EQ(100, cache_record.cache_size);
534 534
535 std::vector<AppCacheDatabase::EntryRecord> entry_records; 535 std::vector<AppCacheDatabase::EntryRecord> entry_records;
536 EXPECT_TRUE(database()->FindEntriesForCache(1, &entry_records)); 536 EXPECT_TRUE(database()->FindEntriesForCache(1, &entry_records));
537 EXPECT_EQ(1U, entry_records.size()); 537 EXPECT_EQ(1U, entry_records.size());
538 EXPECT_EQ(1 , entry_records[0].cache_id); 538 EXPECT_EQ(1 , entry_records[0].cache_id);
539 EXPECT_EQ(kEntryUrl, entry_records[0].url); 539 EXPECT_EQ(kEntryUrl, entry_records[0].url);
540 EXPECT_EQ(AppCacheEntry::MASTER, entry_records[0].flags); 540 EXPECT_EQ(AppCacheEntry::MASTER, entry_records[0].flags);
541 EXPECT_EQ(1, entry_records[0].response_id); 541 EXPECT_EQ(1, entry_records[0].response_id);
542 EXPECT_EQ(100, entry_records[0].response_size); 542 EXPECT_EQ(100, entry_records[0].response_size);
michaeln 2011/06/08 18:09:54 verify modification notification
543 543
544 TestFinished(); 544 TestFinished();
545 } 545 }
546 546
547 // FailStoreGroup -------------------------------------- 547 // FailStoreGroup --------------------------------------
548 548
549 void FailStoreGroup() { 549 void FailStoreGroup() {
550 // Store a group and its newest cache. Should complete asyncly. 550 // Store a group and its newest cache. Should complete asyncly.
551 PushNextTask(NewRunnableMethod( 551 PushNextTask(NewRunnableMethod(
552 this, &AppCacheStorageImplTest::Verify_FailStoreGroup)); 552 this, &AppCacheStorageImplTest::Verify_FailStoreGroup));
(...skipping 19 matching lines...) Expand all
572 EXPECT_TRUE(delegate()->would_exceed_quota_); 572 EXPECT_TRUE(delegate()->would_exceed_quota_);
573 573
574 // Should not have been stored in the database. 574 // Should not have been stored in the database.
575 AppCacheDatabase::GroupRecord group_record; 575 AppCacheDatabase::GroupRecord group_record;
576 AppCacheDatabase::CacheRecord cache_record; 576 AppCacheDatabase::CacheRecord cache_record;
577 EXPECT_FALSE(database()->FindGroup(group_->group_id(), &group_record)); 577 EXPECT_FALSE(database()->FindGroup(group_->group_id(), &group_record));
578 EXPECT_FALSE(database()->FindCache(cache_->cache_id(), &cache_record)); 578 EXPECT_FALSE(database()->FindCache(cache_->cache_id(), &cache_record));
579 579
580 TestFinished(); 580 TestFinished();
581 } 581 }
582 582
michaeln 2011/06/08 18:09:54 add a test for querying the quotaMgr for the space
583 // MakeGroupObsolete ------------------------------- 583 // MakeGroupObsolete -------------------------------
584 584
585 void MakeGroupObsolete() { 585 void MakeGroupObsolete() {
586 // Make a group obsolete, should complete asyncly. 586 // Make a group obsolete, should complete asyncly.
587 PushNextTask(NewRunnableMethod( 587 PushNextTask(NewRunnableMethod(
588 this, &AppCacheStorageImplTest::Verify_MakeGroupObsolete)); 588 this, &AppCacheStorageImplTest::Verify_MakeGroupObsolete));
589 589
590 // Setup some preconditions. Create a group and newest cache that 590 // Setup some preconditions. Create a group and newest cache that
591 // appears to be "stored" and "currently in use". 591 // appears to be "stored" and "currently in use".
592 MakeCacheAndGroup(kManifestUrl, 1, 1, true); 592 MakeCacheAndGroup(kManifestUrl, 1, 1, true);
593 EXPECT_FALSE(storage()->origins_with_groups_.empty()); 593 EXPECT_FALSE(storage()->usage_map_.empty());
594 594
595 // Also insert some related records. 595 // Also insert some related records.
596 AppCacheDatabase::EntryRecord entry_record; 596 AppCacheDatabase::EntryRecord entry_record;
597 entry_record.cache_id = 1; 597 entry_record.cache_id = 1;
598 entry_record.flags = AppCacheEntry::FALLBACK; 598 entry_record.flags = AppCacheEntry::FALLBACK;
599 entry_record.response_id = 1; 599 entry_record.response_id = 1;
600 entry_record.url = kEntryUrl; 600 entry_record.url = kEntryUrl;
601 EXPECT_TRUE(database()->InsertEntry(&entry_record)); 601 EXPECT_TRUE(database()->InsertEntry(&entry_record));
602 602
603 AppCacheDatabase::FallbackNameSpaceRecord fallback_namespace_record; 603 AppCacheDatabase::FallbackNameSpaceRecord fallback_namespace_record;
(...skipping 11 matching lines...) Expand all
615 615
616 // Conduct the test. 616 // Conduct the test.
617 storage()->MakeGroupObsolete(group_, delegate()); 617 storage()->MakeGroupObsolete(group_, delegate());
618 EXPECT_FALSE(group_->is_obsolete()); 618 EXPECT_FALSE(group_->is_obsolete());
619 } 619 }
620 620
621 void Verify_MakeGroupObsolete() { 621 void Verify_MakeGroupObsolete() {
622 EXPECT_TRUE(delegate()->obsoleted_success_); 622 EXPECT_TRUE(delegate()->obsoleted_success_);
623 EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get()); 623 EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get());
624 EXPECT_TRUE(group_->is_obsolete()); 624 EXPECT_TRUE(group_->is_obsolete());
625 EXPECT_TRUE(storage()->origins_with_groups_.empty()); 625 EXPECT_TRUE(storage()->usage_map_.empty());
626 626
627 // The cache and group have been deleted from the database. 627 // The cache and group have been deleted from the database.
628 AppCacheDatabase::GroupRecord group_record; 628 AppCacheDatabase::GroupRecord group_record;
629 AppCacheDatabase::CacheRecord cache_record; 629 AppCacheDatabase::CacheRecord cache_record;
630 EXPECT_FALSE(database()->FindGroup(1, &group_record)); 630 EXPECT_FALSE(database()->FindGroup(1, &group_record));
631 EXPECT_FALSE(database()->FindCache(1, &cache_record)); 631 EXPECT_FALSE(database()->FindCache(1, &cache_record));
632 632
633 // The related records should have been deleted too. 633 // The related records should have been deleted too.
634 std::vector<AppCacheDatabase::EntryRecord> entry_records; 634 std::vector<AppCacheDatabase::EntryRecord> entry_records;
635 database()->FindEntriesForCache(1, &entry_records); 635 database()->FindEntriesForCache(1, &entry_records);
636 EXPECT_TRUE(entry_records.empty()); 636 EXPECT_TRUE(entry_records.empty());
637 std::vector<AppCacheDatabase::FallbackNameSpaceRecord> fallback_records; 637 std::vector<AppCacheDatabase::FallbackNameSpaceRecord> fallback_records;
638 database()->FindFallbackNameSpacesForCache(1, &fallback_records); 638 database()->FindFallbackNameSpacesForCache(1, &fallback_records);
639 EXPECT_TRUE(fallback_records.empty()); 639 EXPECT_TRUE(fallback_records.empty());
640 std::vector<AppCacheDatabase::OnlineWhiteListRecord> whitelist_records; 640 std::vector<AppCacheDatabase::OnlineWhiteListRecord> whitelist_records;
641 database()->FindOnlineWhiteListForCache(1, &whitelist_records); 641 database()->FindOnlineWhiteListForCache(1, &whitelist_records);
642 EXPECT_TRUE(whitelist_records.empty()); 642 EXPECT_TRUE(whitelist_records.empty());
michaeln 2011/06/08 18:09:54 verify modification notification
643 643
644 TestFinished(); 644 TestFinished();
645 } 645 }
646 646
647 // MarkEntryAsForeign ------------------------------- 647 // MarkEntryAsForeign -------------------------------
648 648
649 void MarkEntryAsForeign() { 649 void MarkEntryAsForeign() {
650 // Setup some preconditions. Create a cache with an entry 650 // Setup some preconditions. Create a cache with an entry
651 // in storage and in the working set. 651 // in storage and in the working set.
652 MakeCacheAndGroup(kManifestUrl, 1, 1, true); 652 MakeCacheAndGroup(kManifestUrl, 1, 1, true);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 group_record.group_id = group_id; 1134 group_record.group_id = group_id;
1135 group_record.manifest_url = manifest_url; 1135 group_record.manifest_url = manifest_url;
1136 group_record.origin = manifest_url.GetOrigin(); 1136 group_record.origin = manifest_url.GetOrigin();
1137 EXPECT_TRUE(database()->InsertGroup(&group_record)); 1137 EXPECT_TRUE(database()->InsertGroup(&group_record));
1138 AppCacheDatabase::CacheRecord cache_record; 1138 AppCacheDatabase::CacheRecord cache_record;
1139 cache_record.cache_id = cache_id; 1139 cache_record.cache_id = cache_id;
1140 cache_record.group_id = group_id; 1140 cache_record.group_id = group_id;
1141 cache_record.online_wildcard = false; 1141 cache_record.online_wildcard = false;
1142 cache_record.update_time = kZeroTime; 1142 cache_record.update_time = kZeroTime;
1143 EXPECT_TRUE(database()->InsertCache(&cache_record)); 1143 EXPECT_TRUE(database()->InsertCache(&cache_record));
1144 storage()->origins_with_groups_.insert(manifest_url.GetOrigin()); 1144 storage()->usage_map_[manifest_url.GetOrigin()] = 10;
1145 } 1145 }
1146 } 1146 }
1147 1147
1148 // Data members -------------------------------------------------- 1148 // Data members --------------------------------------------------
1149 1149
1150 scoped_ptr<base::WaitableEvent> test_finished_event_; 1150 scoped_ptr<base::WaitableEvent> test_finished_event_;
1151 std::stack<Task*> task_stack_; 1151 std::stack<Task*> task_stack_;
1152 MockAppCachePolicy policy_; 1152 MockAppCachePolicy policy_;
1153 scoped_ptr<AppCacheService> service_; 1153 scoped_ptr<AppCacheService> service_;
1154 scoped_ptr<MockStorageDelegate> delegate_; 1154 scoped_ptr<MockStorageDelegate> delegate_;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet); 1251 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet);
1252 } 1252 }
1253 1253
1254 // That's all folks! 1254 // That's all folks!
1255 1255
1256 } // namespace appcache 1256 } // namespace appcache
1257 1257
1258 // AppCacheStorageImplTest is expected to always live longer than the 1258 // AppCacheStorageImplTest is expected to always live longer than the
1259 // runnable methods. This lets us call NewRunnableMethod on its instances. 1259 // runnable methods. This lets us call NewRunnableMethod on its instances.
1260 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheStorageImplTest); 1260 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheStorageImplTest);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698