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

Unified Diff: third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp

Issue 1607243002: Add 'OriginAccessEntry::matchDomain'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 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
Index: third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
index 72d97a374d652da3c7c08a0c3a1f7be52d802d35..4136c98b0cfc67936ce9a5eb1551a461018a84c2 100644
--- a/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/OriginAccessEntryTest.cpp
@@ -91,24 +91,26 @@ TEST(OriginAccessEntryTest, AllowSubdomainsTest)
const char* protocol;
const char* host;
const char* origin;
- OriginAccessEntry::MatchResult expected;
+ OriginAccessEntry::MatchResult expectedOrigin;
+ OriginAccessEntry::MatchResult expectedDomain;
} inputs[] = {
- { "http", "example.com", "http://example.com/", OriginAccessEntry::MatchesOrigin },
- { "http", "example.com", "http://www.example.com/", OriginAccessEntry::MatchesOrigin },
- { "http", "example.com", "http://www.www.example.com/", OriginAccessEntry::MatchesOrigin },
- { "http", "www.example.com", "http://example.com/", OriginAccessEntry::DoesNotMatchOrigin },
- { "http", "www.example.com", "http://www.example.com/", OriginAccessEntry::MatchesOrigin },
- { "http", "www.example.com", "http://www.www.example.com/", OriginAccessEntry::MatchesOrigin },
- { "http", "com", "http://example.com/", OriginAccessEntry::MatchesOriginButIsPublicSuffix },
- { "http", "com", "http://www.example.com/", OriginAccessEntry::MatchesOriginButIsPublicSuffix },
- { "http", "com", "http://www.www.example.com/", OriginAccessEntry::MatchesOriginButIsPublicSuffix },
- { "https", "example.com", "http://example.com/", OriginAccessEntry::DoesNotMatchOrigin },
- { "https", "example.com", "http://www.example.com/", OriginAccessEntry::DoesNotMatchOrigin },
- { "https", "example.com", "http://www.www.example.com/", OriginAccessEntry::DoesNotMatchOrigin },
- { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOrigin },
- { "http", "", "http://example.com/", OriginAccessEntry::MatchesOrigin },
- { "http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin },
- { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOrigin },
+ { "http", "example.com", "http://example.com/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "example.com", "http://www.example.com/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "example.com", "http://www.www.example.com/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "www.example.com", "http://example.com/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::DoesNotMatchOrigin },
+ { "http", "www.example.com", "http://www.example.com/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "www.example.com", "http://www.www.example.com/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "com", "http://example.com/", OriginAccessEntry::MatchesOriginButIsPublicSuffix, OriginAccessEntry::MatchesOriginButIsPublicSuffix },
+ { "http", "com", "http://www.example.com/", OriginAccessEntry::MatchesOriginButIsPublicSuffix, OriginAccessEntry::MatchesOriginButIsPublicSuffix },
+ { "http", "com", "http://www.www.example.com/", OriginAccessEntry::MatchesOriginButIsPublicSuffix, OriginAccessEntry::MatchesOriginButIsPublicSuffix },
+ { "https", "example.com", "http://example.com/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::MatchesOrigin },
+ { "https", "example.com", "http://www.example.com/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::MatchesOrigin },
+ { "https", "example.com", "http://www.www.example.com/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::DoesNotMatchOrigin },
+ { "http", "example.com", "https://beispiel.de/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::DoesNotMatchOrigin },
+ { "http", "", "http://example.com/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin, OriginAccessEntry::MatchesOrigin },
+ { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::MatchesOrigin },
};
OriginAccessEntryTestPlatform platform;
@@ -118,7 +120,8 @@ TEST(OriginAccessEntryTest, AllowSubdomainsTest)
SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin);
RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(test.origin);
OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::AllowSubdomains);
- EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
+ EXPECT_EQ(test.expectedOrigin, entry1.matchesOrigin(*originToTest));
+ EXPECT_EQ(test.expectedDomain, entry1.matchesDomain(*originToTest));
}
}

Powered by Google App Engine
This is Rietveld 408576698