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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_local_storage_helper_unittest.cc

Issue 2005783005: Re-enable storage for Suborigins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase on ToT Created 4 years, 2 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
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 "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 5 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
6 6
7 #include "chrome/test/base/testing_profile.h" 7 #include "chrome/test/base/testing_profile.h"
8 #include "content/public/test/test_browser_thread_bundle.h" 8 #include "content/public/test/test_browser_thread_bundle.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 EXPECT_TRUE(helper->empty()); 42 EXPECT_TRUE(helper->empty());
43 helper->AddLocalStorage(origin1); 43 helper->AddLocalStorage(origin1);
44 helper->AddLocalStorage(origin2); 44 helper->AddLocalStorage(origin2);
45 helper->AddLocalStorage(origin3); 45 helper->AddLocalStorage(origin3);
46 EXPECT_EQ(3u, helper->GetLocalStorageCount()); 46 EXPECT_EQ(3u, helper->GetLocalStorageCount());
47 helper->DeleteOrigin(origin2); 47 helper->DeleteOrigin(origin2);
48 EXPECT_EQ(2u, helper->GetLocalStorageCount()); 48 EXPECT_EQ(2u, helper->GetLocalStorageCount());
49 helper->DeleteOrigin(origin1); 49 helper->DeleteOrigin(origin1);
50 EXPECT_EQ(1u, helper->GetLocalStorageCount()); 50 EXPECT_EQ(1u, helper->GetLocalStorageCount());
51
52 // Local storage for a suborigin
53 // (https://www.chromestatus.com/feature/5569465034997760) should be deleted
54 // when the corresponding physical origin is deleted.
55 const GURL suborigin("http-so://suborigin.foo.example.com");
56 helper->AddLocalStorage(suborigin);
57 EXPECT_EQ(2u, helper->GetLocalStorageCount());
58 helper->DeleteOrigin(origin3);
59 EXPECT_EQ(0u, helper->GetLocalStorageCount());
60 helper->AddLocalStorage(suborigin);
61 EXPECT_EQ(1u, helper->GetLocalStorageCount());
62 helper->DeleteOrigin(origin3);
63 EXPECT_EQ(0u, helper->GetLocalStorageCount());
51 } 64 }
52 65
53 TEST_F(CannedBrowsingDataLocalStorageTest, IgnoreExtensionsAndDevTools) { 66 TEST_F(CannedBrowsingDataLocalStorageTest, IgnoreExtensionsAndDevTools) {
54 TestingProfile profile; 67 TestingProfile profile;
55 68
56 const GURL origin1("chrome-extension://abcdefghijklmnopqrstuvwxyz/"); 69 const GURL origin1("chrome-extension://abcdefghijklmnopqrstuvwxyz/");
57 const GURL origin2("chrome-devtools://abcdefghijklmnopqrstuvwxyz/"); 70 const GURL origin2("chrome-devtools://abcdefghijklmnopqrstuvwxyz/");
58 71
59 scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper( 72 scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper(
60 new CannedBrowsingDataLocalStorageHelper(&profile)); 73 new CannedBrowsingDataLocalStorageHelper(&profile));
61 74
62 ASSERT_TRUE(helper->empty()); 75 ASSERT_TRUE(helper->empty());
63 helper->AddLocalStorage(origin1); 76 helper->AddLocalStorage(origin1);
64 ASSERT_TRUE(helper->empty()); 77 ASSERT_TRUE(helper->empty());
65 helper->AddLocalStorage(origin2); 78 helper->AddLocalStorage(origin2);
66 ASSERT_TRUE(helper->empty()); 79 ASSERT_TRUE(helper->empty());
67 } 80 }
68 81
69 } // namespace 82 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_local_storage_helper.cc ('k') | chrome/browser/browsing_data/cookies_tree_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698