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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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 | « webkit/appcache/appcache_test_helper.cc ('k') | webkit/appcache/appcache_update_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "webkit/appcache/appcache.h" 6 #include "webkit/appcache/appcache.h"
7 #include "webkit/appcache/appcache_frontend_impl.h" 7 #include "webkit/appcache/appcache_frontend_impl.h"
8 #include "webkit/appcache/appcache_host.h" 8 #include "webkit/appcache/appcache_host.h"
9 #include "webkit/appcache/mock_appcache_service.h" 9 #include "webkit/appcache/mock_appcache_service.h"
10 10
11 namespace appcache { 11 namespace appcache {
12 12
13 class AppCacheTest : public testing::Test { 13 class AppCacheTest : public testing::Test {
14 }; 14 };
15 15
16 TEST(AppCacheTest, CleanupUnusedCache) { 16 TEST(AppCacheTest, CleanupUnusedCache) {
17 MockAppCacheService service; 17 MockAppCacheService service;
18 AppCacheFrontendImpl frontend; 18 AppCacheFrontendImpl frontend;
19 scoped_refptr<AppCache> cache(new AppCache(&service, 111)); 19 scoped_refptr<AppCache> cache(new AppCache(&service, 111));
20 cache->set_complete(true); 20 cache->set_complete(true);
21 scoped_refptr<AppCacheGroup> group( 21 scoped_refptr<AppCacheGroup> group(
22 new AppCacheGroup(&service, GURL("http://blah/manifest"), 111)); 22 new AppCacheGroup(&service, GURL("http://blah/manifest"), 111));
23 group->AddCache(cache); 23 group->AddCache(cache.get());
24 24
25 AppCacheHost host1(1, &frontend, &service); 25 AppCacheHost host1(1, &frontend, &service);
26 AppCacheHost host2(2, &frontend, &service); 26 AppCacheHost host2(2, &frontend, &service);
27 27
28 host1.AssociateCompleteCache(cache.get()); 28 host1.AssociateCompleteCache(cache.get());
29 host2.AssociateCompleteCache(cache.get()); 29 host2.AssociateCompleteCache(cache.get());
30 30
31 host1.AssociateNoCache(GURL()); 31 host1.AssociateNoCache(GURL());
32 host2.AssociateNoCache(GURL()); 32 host2.AssociateNoCache(GURL());
33 } 33 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 kFallbackUrl, 357 kFallbackUrl,
358 AppCacheEntry(AppCacheEntry::FALLBACK, 2, 2)); 358 AppCacheEntry(AppCacheEntry::FALLBACK, 2, 2));
359 359
360 // Get it to produce database records and verify them. 360 // Get it to produce database records and verify them.
361 AppCacheDatabase::CacheRecord cache_record; 361 AppCacheDatabase::CacheRecord cache_record;
362 std::vector<AppCacheDatabase::EntryRecord> entries; 362 std::vector<AppCacheDatabase::EntryRecord> entries;
363 std::vector<AppCacheDatabase::NamespaceRecord> intercepts; 363 std::vector<AppCacheDatabase::NamespaceRecord> intercepts;
364 std::vector<AppCacheDatabase::NamespaceRecord> fallbacks; 364 std::vector<AppCacheDatabase::NamespaceRecord> fallbacks;
365 std::vector<AppCacheDatabase::OnlineWhiteListRecord> whitelists; 365 std::vector<AppCacheDatabase::OnlineWhiteListRecord> whitelists;
366 cache->ToDatabaseRecords( 366 cache->ToDatabaseRecords(
367 group, &cache_record, &entries, 367 group.get(), &cache_record, &entries,
368 &intercepts, &fallbacks, &whitelists); 368 &intercepts, &fallbacks, &whitelists);
369 EXPECT_EQ(kCacheId, cache_record.cache_id); 369 EXPECT_EQ(kCacheId, cache_record.cache_id);
370 EXPECT_EQ(kGroupId, cache_record.group_id); 370 EXPECT_EQ(kGroupId, cache_record.group_id);
371 EXPECT_TRUE(cache_record.online_wildcard); 371 EXPECT_TRUE(cache_record.online_wildcard);
372 EXPECT_EQ(1 + 2 + 3, cache_record.cache_size); 372 EXPECT_EQ(1 + 2 + 3, cache_record.cache_size);
373 EXPECT_EQ(3u, entries.size()); 373 EXPECT_EQ(3u, entries.size());
374 EXPECT_EQ(1u, intercepts.size()); 374 EXPECT_EQ(1u, intercepts.size());
375 EXPECT_EQ(1u, fallbacks.size()); 375 EXPECT_EQ(1u, fallbacks.size());
376 EXPECT_EQ(1u, whitelists.size()); 376 EXPECT_EQ(1u, whitelists.size());
377 cache = NULL; 377 cache = NULL;
(...skipping 10 matching lines...) Expand all
388 EXPECT_TRUE(cache->GetEntry(kFallbackUrl)); 388 EXPECT_TRUE(cache->GetEntry(kFallbackUrl));
389 EXPECT_EQ(kInterceptUrl, 389 EXPECT_EQ(kInterceptUrl,
390 cache->GetInterceptEntryUrl(GURL("http://foo.com/intercept"))); 390 cache->GetInterceptEntryUrl(GURL("http://foo.com/intercept")));
391 EXPECT_EQ(kFallbackUrl, 391 EXPECT_EQ(kFallbackUrl,
392 cache->GetFallbackEntryUrl(GURL("http://foo.com/"))); 392 cache->GetFallbackEntryUrl(GURL("http://foo.com/")));
393 EXPECT_EQ(1 + 2 + 3, cache->cache_size()); 393 EXPECT_EQ(1 + 2 + 3, cache->cache_size());
394 } 394 }
395 395
396 } // namespace appacache 396 } // namespace appacache
397 397
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_test_helper.cc ('k') | webkit/appcache/appcache_update_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698