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

Side by Side Diff: chrome/browser/browsing_data_remover_unittest.cc

Issue 7464029: Adding QuotaManager logic to TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Uglay. Created 9 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
« no previous file with comments | « no previous file | chrome/test/testing_profile.h » ('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) 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 "chrome/browser/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data_remover.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 fileapi::kFileSystemTypePersistent)); 354 fileapi::kFileSystemTypePersistent));
355 EXPECT_FALSE(tester->FileSystemContainsOriginAndType(kOrigin2, 355 EXPECT_FALSE(tester->FileSystemContainsOriginAndType(kOrigin2,
356 fileapi::kFileSystemTypeTemporary)); 356 fileapi::kFileSystemTypeTemporary));
357 EXPECT_FALSE(tester->FileSystemContainsOriginAndType(kOrigin3, 357 EXPECT_FALSE(tester->FileSystemContainsOriginAndType(kOrigin3,
358 fileapi::kFileSystemTypePersistent)); 358 fileapi::kFileSystemTypePersistent));
359 EXPECT_FALSE(tester->FileSystemContainsOriginAndType(kOrigin3, 359 EXPECT_FALSE(tester->FileSystemContainsOriginAndType(kOrigin3,
360 fileapi::kFileSystemTypeTemporary)); 360 fileapi::kFileSystemTypeTemporary));
361 } 361 }
362 362
363 TEST_F(BrowsingDataRemoverTest, RemoveAppCacheForever) { 363 TEST_F(BrowsingDataRemoverTest, RemoveAppCacheForever) {
364 // Set up ChromeAppCacheService. 364 // Set up ChromeAppCacheService with a single protected origin
365 scoped_refptr<ChromeAppCacheService> appcache_service =
366 new ChromeAppCacheService(NULL);
367 const content::ResourceContext* resource_context = NULL;
368 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy = 365 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy =
369 new MockExtensionSpecialStoragePolicy; 366 new MockExtensionSpecialStoragePolicy;
370 mock_policy->AddProtected(kProtectedManifest.GetOrigin()); 367 mock_policy->AddProtected(kProtectedManifest.GetOrigin());
371 BrowserThread::PostTask( 368 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy);
372 BrowserThread::IO, FROM_HERE, 369 scoped_refptr<ChromeAppCacheService> appcache_service =
373 NewRunnableMethod(appcache_service.get(), 370 GetProfile()->GetAppCacheService();
374 &ChromeAppCacheService::InitializeOnIOThread, 371
375 FilePath(), 372 // AppCacheService is initialized asynchronously. It must be finished before
376 resource_context, 373 // we can safely run BrowsingDataRemover's methods, so let's block a moment.
377 mock_policy,
378 false));
379 MessageLoop::current()->RunAllPending(); 374 MessageLoop::current()->RunAllPending();
375
380 TestingProfile* profile = GetProfile(); 376 TestingProfile* profile = GetProfile();
381 profile->SetAppCacheService(appcache_service);
382 profile->SetExtensionSpecialStoragePolicy(mock_policy); 377 profile->SetExtensionSpecialStoragePolicy(mock_policy);
383 378
384 // Add data into the AppCacheStorage. 379 // Add data into the AppCacheStorage.
385 AppCacheInserter appcache_inserter; 380 AppCacheInserter appcache_inserter;
386 appcache_inserter.AddGroupAndCache(appcache_service, kNormalManifest); 381 appcache_inserter.AddGroupAndCache(appcache_service, kNormalManifest);
387 appcache_inserter.AddGroupAndCache(appcache_service, kProtectedManifest); 382 appcache_inserter.AddGroupAndCache(appcache_service, kProtectedManifest);
388 383
389 // Verify that adding the data succeeded. 384 // Verify that adding the data succeeded.
390 AppCacheReader reader(appcache_service); 385 AppCacheReader reader(appcache_service);
391 std::set<GURL>* origins = reader.ReadAppCaches(); 386 std::set<GURL>* origins = reader.ReadAppCaches();
(...skipping 13 matching lines...) Expand all
405 tester->BlockUntilNotified(); 400 tester->BlockUntilNotified();
406 401
407 // Results: appcaches for the normal origin got deleted, appcaches for the 402 // Results: appcaches for the normal origin got deleted, appcaches for the
408 // protected origin didn't. 403 // protected origin didn't.
409 origins = reader.ReadAppCaches(); 404 origins = reader.ReadAppCaches();
410 EXPECT_EQ(1UL, origins->size()); 405 EXPECT_EQ(1UL, origins->size());
411 EXPECT_TRUE(origins->find(kProtectedManifest.GetOrigin()) != origins->end()); 406 EXPECT_TRUE(origins->find(kProtectedManifest.GetOrigin()) != origins->end());
412 } 407 }
413 408
414 } // namespace 409 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/test/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698