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

Unified Diff: chrome/browser/browsing_data/browsing_data_helper_unittest.cc

Issue 2661543003: Introduce the concept of web schemes capable of storage (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_helper.cc ('k') | url/url_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/browsing_data_helper_unittest.cc
diff --git a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc
index f5ff40f5dc77f1d4904fc3951750cb5e54a778ae..5bf6ac4fadd2f9e392f17fcc0cb8ce614fb08ef8 100644
--- a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc
@@ -61,18 +61,16 @@ class BrowsingDataHelperTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(BrowsingDataHelperTest);
};
-TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreWebSafe) {
+TEST_F(BrowsingDataHelperTest, WebStorageSchemesAreWebSchemes) {
EXPECT_TRUE(IsWebScheme(url::kHttpScheme));
EXPECT_TRUE(IsWebScheme(url::kHttpsScheme));
+ EXPECT_TRUE(IsWebScheme(url::kFileScheme));
EXPECT_TRUE(IsWebScheme(url::kFtpScheme));
- EXPECT_TRUE(IsWebScheme(url::kDataScheme));
- EXPECT_TRUE(IsWebScheme("feed"));
- EXPECT_TRUE(IsWebScheme(url::kBlobScheme));
- EXPECT_TRUE(IsWebScheme(url::kFileSystemScheme));
- EXPECT_FALSE(IsWebScheme("invalid-scheme-i-just-made-up"));
+ EXPECT_TRUE(IsWebScheme(url::kWsScheme));
+ EXPECT_TRUE(IsWebScheme(url::kWssScheme));
}
-TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) {
+TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSchemes) {
EXPECT_FALSE(IsWebScheme(extensions::kExtensionScheme));
EXPECT_FALSE(IsWebScheme(url::kAboutScheme));
EXPECT_FALSE(IsWebScheme(content::kChromeDevToolsScheme));
@@ -82,15 +80,13 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) {
EXPECT_FALSE(IsWebScheme(content::kViewSourceScheme));
}
-TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreNotExtensions) {
+TEST_F(BrowsingDataHelperTest, WebStorageSchemesAreNotExtensions) {
EXPECT_FALSE(IsExtensionScheme(url::kHttpScheme));
EXPECT_FALSE(IsExtensionScheme(url::kHttpsScheme));
+ EXPECT_FALSE(IsExtensionScheme(url::kFileScheme));
EXPECT_FALSE(IsExtensionScheme(url::kFtpScheme));
- EXPECT_FALSE(IsExtensionScheme(url::kDataScheme));
- EXPECT_FALSE(IsExtensionScheme("feed"));
- EXPECT_FALSE(IsExtensionScheme(url::kBlobScheme));
- EXPECT_FALSE(IsExtensionScheme(url::kFileSystemScheme));
- EXPECT_FALSE(IsExtensionScheme("invalid-scheme-i-just-made-up"));
+ EXPECT_FALSE(IsExtensionScheme(url::kWsScheme));
+ EXPECT_FALSE(IsExtensionScheme(url::kWssScheme));
}
TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotAllExtension) {
@@ -104,6 +100,23 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotAllExtension) {
EXPECT_FALSE(IsExtensionScheme(content::kViewSourceScheme));
}
+TEST_F(BrowsingDataHelperTest, SchemesThatCantStoreDataDontMatchAnything) {
+ EXPECT_FALSE(IsWebScheme(url::kDataScheme));
+ EXPECT_FALSE(IsExtensionScheme(url::kDataScheme));
+
+ EXPECT_FALSE(IsWebScheme("feed"));
+ EXPECT_FALSE(IsExtensionScheme("feed"));
+
+ EXPECT_FALSE(IsWebScheme(url::kBlobScheme));
+ EXPECT_FALSE(IsExtensionScheme(url::kBlobScheme));
+
+ EXPECT_FALSE(IsWebScheme(url::kFileSystemScheme));
+ EXPECT_FALSE(IsExtensionScheme(url::kFileSystemScheme));
+
+ EXPECT_FALSE(IsWebScheme("invalid-scheme-i-just-made-up"));
+ EXPECT_FALSE(IsExtensionScheme("invalid-scheme-i-just-made-up"));
+}
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
TEST_F(BrowsingDataHelperTest, TestMatches) {
scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy =
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_helper.cc ('k') | url/url_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698