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

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

Issue 2562953002: Part 5.2: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: HeapVector 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/MediaListDirective.h" 5 #include "core/frame/csp/MediaListDirective.h"
6 6
7 #include "core/frame/csp/ContentSecurityPolicy.h" 7 #include "core/frame/csp/ContentSecurityPolicy.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 false, 128 false,
129 false}, 129 false},
130 {{"application/x-invalid-type text application/"}, false, false}, 130 {{"application/x-invalid-type text application/"}, false, false},
131 {{"application/x-blink-test-plugin text application/", 131 {{"application/x-blink-test-plugin text application/",
132 "application/x-blink-test-plugin"}, 132 "application/x-blink-test-plugin"},
133 false, 133 false,
134 false}, 134 false},
135 }; 135 };
136 136
137 MediaListDirective emptyA("plugin-types", "", csp.get()); 137 MediaListDirective emptyA("plugin-types", "", csp.get());
138 EXPECT_TRUE(emptyA.subsumes({&emptyA}));
amalika 2016/12/13 08:31:52 This is unnecessary since the first test cases tes
139 138
140 for (const auto& test : cases) { 139 for (const auto& test : cases) {
141 std::vector<MediaListDirective*> policiesB; 140 HeapVector<Member<MediaListDirective>> policiesB;
142 for (const auto& policy : test.policiesB) { 141 for (const auto& policy : test.policiesB) {
143 policiesB.push_back( 142 policiesB.append(
144 new MediaListDirective("plugin-types", policy, csp.get())); 143 new MediaListDirective("plugin-types", policy, csp.get()));
145 } 144 }
146 145
147 EXPECT_EQ(A.subsumes(policiesB), test.subsumed); 146 EXPECT_EQ(A.subsumes(policiesB), test.subsumed);
148 EXPECT_EQ(emptyA.subsumes(policiesB), test.subsumedByEmptyA); 147 EXPECT_EQ(emptyA.subsumes(policiesB), test.subsumedByEmptyA);
149 } 148 }
150 } 149 }
151 150
152 } // namespace blink 151 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698