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

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

Issue 2550093005: Embedding-CSP: Fixing path matching (Closed)
Patch Set: Adding test cases Created 4 years 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 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/network/ResourceRequest.h" 9 #include "platform/network/ResourceRequest.h"
10 #include "platform/weborigin/KURL.h" 10 #include "platform/weborigin/KURL.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } cases[] = { 187 } cases[] = {
188 // Equal signals 188 // Equal signals
189 {{"http", "/", 0}, {"http", "/", 0}, true, true}, 189 {{"http", "/", 0}, {"http", "/", 0}, true, true},
190 {{"https", "/", 0}, {"https", "/", 0}, true, true}, 190 {{"https", "/", 0}, {"https", "/", 0}, true, true},
191 {{"https", "/page1.html", 0}, {"https", "/page1.html", 0}, true, true}, 191 {{"https", "/page1.html", 0}, {"https", "/page1.html", 0}, true, true},
192 {{"http", "/", 70}, {"http", "/", 70}, true, true}, 192 {{"http", "/", 70}, {"http", "/", 70}, true, true},
193 {{"https", "/", 70}, {"https", "/", 70}, true, true}, 193 {{"https", "/", 70}, {"https", "/", 70}, true, true},
194 {{"https", "/page1.html", 0}, {"https", "/page1.html", 0}, true, true}, 194 {{"https", "/page1.html", 0}, {"https", "/page1.html", 0}, true, true},
195 {{"http", "/page1.html", 70}, {"http", "/page1.html", 70}, true, true}, 195 {{"http", "/page1.html", 70}, {"http", "/page1.html", 70}, true, true},
196 {{"https", "/page1.html", 70}, {"https", "/page1.html", 70}, true, true}, 196 {{"https", "/page1.html", 70}, {"https", "/page1.html", 70}, true, true},
197 {{"http", "/", 0}, {"http", "", 0}, true, true},
198 {{"http", "/", 80}, {"http", "", 80}, true, true},
199 {{"http", "/", 80}, {"https", "", 443}, false, true},
amalika 2016/12/08 09:01:59 This also tests when A and B are swapped. Would th
197 // One stronger signal in the first CSPSource 200 // One stronger signal in the first CSPSource
198 {{"https", "/", 0}, {"http", "/", 0}, true, false}, 201 {{"https", "/", 0}, {"http", "/", 0}, true, false},
199 {{"http", "/page1.html", 0}, {"http", "/", 0}, true, false}, 202 {{"http", "/page1.html", 0}, {"http", "/", 0}, true, false},
200 {{"http", "/", 80}, {"http", "/", 0}, true, true}, 203 {{"http", "/", 80}, {"http", "/", 0}, true, true},
201 {{"http", "/", 700}, {"http", "/", 0}, false, false}, 204 {{"http", "/", 700}, {"http", "/", 0}, false, false},
202 // Two stronger signals in the first CSPSource 205 // Two stronger signals in the first CSPSource
203 {{"https", "/page1.html", 0}, {"http", "/", 0}, true, false}, 206 {{"https", "/page1.html", 0}, {"http", "/", 0}, true, false},
204 {{"https", "/", 80}, {"http", "/", 0}, false, false}, 207 {{"https", "/", 80}, {"http", "/", 0}, false, false},
205 {{"http", "/page1.html", 80}, {"http", "/", 0}, true, false}, 208 {{"http", "/page1.html", 80}, {"http", "/", 0}, true, false},
206 // Three stronger signals in the first CSPSource 209 // Three stronger signals in the first CSPSource
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 normalized = B->intersect(A); 740 normalized = B->intersect(A);
738 Source intersectBA = { 741 Source intersectBA = {
739 normalized->m_scheme, normalized->m_host, 742 normalized->m_scheme, normalized->m_host,
740 normalized->m_path, normalized->m_port, 743 normalized->m_path, normalized->m_port,
741 normalized->m_hostWildcard, normalized->m_portWildcard}; 744 normalized->m_hostWildcard, normalized->m_portWildcard};
742 EXPECT_TRUE(equalSources(intersectBA, test.normalized)); 745 EXPECT_TRUE(equalSources(intersectBA, test.normalized));
743 } 746 }
744 } 747 }
745 748
746 } // namespace blink 749 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698