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

Side by Side Diff: third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp

Issue 1872563004: Match `path-part` with `url` case-sensitively (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update AUTHORS Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/frame/csp/CSPSource.h" 5 #include "core/frame/csp/CSPSource.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/csp/ContentSecurityPolicy.h" 8 #include "core/frame/csp/ContentSecurityPolicy.h"
9 #include "platform/weborigin/KURL.h" 9 #include "platform/weborigin/KURL.h"
10 #include "platform/weborigin/SecurityOrigin.h" 10 #include "platform/weborigin/SecurityOrigin.h"
(...skipping 17 matching lines...) Expand all
28 KURL base; 28 KURL base;
29 CSPSource source(csp.get(), "http", "example.com", 8000, "/foo/", CSPSource: :NoWildcard, CSPSource::NoWildcard); 29 CSPSource source(csp.get(), "http", "example.com", 8000, "/foo/", CSPSource: :NoWildcard, CSPSource::NoWildcard);
30 30
31 EXPECT_TRUE(source.matches(KURL(base, "http://example.com:8000/foo/"))); 31 EXPECT_TRUE(source.matches(KURL(base, "http://example.com:8000/foo/")));
32 EXPECT_TRUE(source.matches(KURL(base, "http://example.com:8000/foo/bar"))); 32 EXPECT_TRUE(source.matches(KURL(base, "http://example.com:8000/foo/bar")));
33 EXPECT_TRUE(source.matches(KURL(base, "HTTP://EXAMPLE.com:8000/foo/BAR"))); 33 EXPECT_TRUE(source.matches(KURL(base, "HTTP://EXAMPLE.com:8000/foo/BAR")));
34 34
35 EXPECT_FALSE(source.matches(KURL(base, "http://example.com:8000/bar/"))); 35 EXPECT_FALSE(source.matches(KURL(base, "http://example.com:8000/bar/")));
36 EXPECT_FALSE(source.matches(KURL(base, "https://example.com:8000/bar/"))); 36 EXPECT_FALSE(source.matches(KURL(base, "https://example.com:8000/bar/")));
37 EXPECT_FALSE(source.matches(KURL(base, "http://example.com:9000/bar/"))); 37 EXPECT_FALSE(source.matches(KURL(base, "http://example.com:9000/bar/")));
38 EXPECT_FALSE(source.matches(KURL(base, "HTTP://example.com:8000/FOO/bar")));
39 EXPECT_FALSE(source.matches(KURL(base, "HTTP://example.com:8000/FOO/BAR")));
38 } 40 }
39 41
40 TEST_F(CSPSourceTest, WildcardMatching) 42 TEST_F(CSPSourceTest, WildcardMatching)
41 { 43 {
42 KURL base; 44 KURL base;
43 CSPSource source(csp.get(), "http", "example.com", 0, "/", CSPSource::HasWil dcard, CSPSource::HasWildcard); 45 CSPSource source(csp.get(), "http", "example.com", 0, "/", CSPSource::HasWil dcard, CSPSource::HasWildcard);
44 46
45 EXPECT_TRUE(source.matches(KURL(base, "http://foo.example.com:8000/"))); 47 EXPECT_TRUE(source.matches(KURL(base, "http://foo.example.com:8000/")));
46 EXPECT_TRUE(source.matches(KURL(base, "http://foo.example.com:8000/foo"))); 48 EXPECT_TRUE(source.matches(KURL(base, "http://foo.example.com:8000/foo")));
47 EXPECT_TRUE(source.matches(KURL(base, "http://foo.example.com:9000/foo/"))); 49 EXPECT_TRUE(source.matches(KURL(base, "http://foo.example.com:9000/foo/")));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 KURL base; 87 KURL base;
86 CSPSource source(csp.get(), "http", "example.com", 0, "/", CSPSource::NoWild card, CSPSource::HasWildcard); 88 CSPSource source(csp.get(), "http", "example.com", 0, "/", CSPSource::NoWild card, CSPSource::HasWildcard);
87 89
88 EXPECT_TRUE(source.matches(KURL(base, "http://example.com:8000/"))); 90 EXPECT_TRUE(source.matches(KURL(base, "http://example.com:8000/")));
89 EXPECT_FALSE(source.matches(KURL(base, "http://not-example.com:8000/"))); 91 EXPECT_FALSE(source.matches(KURL(base, "http://not-example.com:8000/")));
90 EXPECT_TRUE(source.matches(KURL(base, "https://example.com:8000/"))); 92 EXPECT_TRUE(source.matches(KURL(base, "https://example.com:8000/")));
91 EXPECT_FALSE(source.matches(KURL(base, "https://not-example.com:8000/"))); 93 EXPECT_FALSE(source.matches(KURL(base, "https://not-example.com:8000/")));
92 } 94 }
93 95
94 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698