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

Side by Side Diff: Source/platform/weborigin/OriginAccessEntryTest.cpp

Issue 1163583005: Add "registerable domain" support to OriginAccessEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test. Created 5 years, 6 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 | « Source/platform/weborigin/OriginAccessEntry.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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 28 matching lines...) Expand all
39 39
40 using blink::SecurityOrigin; 40 using blink::SecurityOrigin;
41 using blink::OriginAccessEntry; 41 using blink::OriginAccessEntry;
42 42
43 namespace { 43 namespace {
44 44
45 class OriginAccessEntryTestSuffixList : public blink::WebPublicSuffixList { 45 class OriginAccessEntryTestSuffixList : public blink::WebPublicSuffixList {
46 public: 46 public:
47 virtual size_t getPublicSuffixLength(const blink::WebString&) 47 virtual size_t getPublicSuffixLength(const blink::WebString&)
48 { 48 {
49 return 3; // e.g. "com" 49 return m_length;
50 } 50 }
51
52 void setPublicSuffix(const blink::WebString& suffix)
53 {
54 m_length = suffix.length();
55 }
56
57 private:
58 size_t m_length;
51 }; 59 };
52 60
53 class OriginAccessEntryTestPlatform : public blink::Platform { 61 class OriginAccessEntryTestPlatform : public blink::Platform {
54 public: 62 public:
55 virtual blink::WebPublicSuffixList* publicSuffixList() 63 virtual blink::WebPublicSuffixList* publicSuffixList()
56 { 64 {
57 return &m_suffixList; 65 return &m_suffixList;
58 } 66 }
59 67
60 // Stub for pure virtual method. 68 // Stub for pure virtual method.
61 virtual void cryptographicallyRandomValues(unsigned char*, size_t) { ASSERT_ NOT_REACHED(); } 69 virtual void cryptographicallyRandomValues(unsigned char*, size_t) { ASSERT_ NOT_REACHED(); }
62 70
71 void setPublicSuffix(const blink::WebString& suffix)
72 {
73 m_suffixList.setPublicSuffix(suffix);
74 }
75
63 private: 76 private:
64 OriginAccessEntryTestSuffixList m_suffixList; 77 OriginAccessEntryTestSuffixList m_suffixList;
65 }; 78 };
66 79
67 TEST(OriginAccessEntryTest, PublicSuffixListTest) 80 TEST(OriginAccessEntryTest, PublicSuffixListTest)
68 { 81 {
69 OriginAccessEntryTestPlatform platform; 82 OriginAccessEntryTestPlatform platform;
83 platform.setPublicSuffix("com");
70 blink::Platform::initialize(&platform); 84 blink::Platform::initialize(&platform);
71 85
72 RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString("http://www .google.com"); 86 RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString("http://www .google.com");
73 OriginAccessEntry entry1("http", "google.com", OriginAccessEntry::AllowSubdo mains); 87 OriginAccessEntry entry1("http", "google.com", OriginAccessEntry::AllowSubdo mains);
74 OriginAccessEntry entry2("http", "hamster.com", OriginAccessEntry::AllowSubd omains); 88 OriginAccessEntry entry2("http", "hamster.com", OriginAccessEntry::AllowSubd omains);
75 OriginAccessEntry entry3("http", "com", OriginAccessEntry::AllowSubdomains); 89 OriginAccessEntry entry3("http", "com", OriginAccessEntry::AllowSubdomains);
76 EXPECT_EQ(OriginAccessEntry::MatchesOrigin, entry1.matchesOrigin(*origin)); 90 EXPECT_EQ(OriginAccessEntry::MatchesOrigin, entry1.matchesOrigin(*origin));
77 EXPECT_EQ(OriginAccessEntry::DoesNotMatchOrigin, entry2.matchesOrigin(*origi n)); 91 EXPECT_EQ(OriginAccessEntry::DoesNotMatchOrigin, entry2.matchesOrigin(*origi n));
78 EXPECT_EQ(OriginAccessEntry::MatchesOriginButIsPublicSuffix, entry3.matchesO rigin(*origin)); 92 EXPECT_EQ(OriginAccessEntry::MatchesOriginButIsPublicSuffix, entry3.matchesO rigin(*origin));
79 93
80 blink::Platform::shutdown(); 94 blink::Platform::shutdown();
81 } 95 }
82 96
83 TEST(OriginAccessEntryTest, AllowSubdomainsTest) 97 TEST(OriginAccessEntryTest, AllowSubdomainsTest)
84 { 98 {
85 struct TestCase { 99 struct TestCase {
86 const char* protocol; 100 const char* protocol;
87 const char* host; 101 const char* host;
88 const char* origin; 102 const char* origin;
89 OriginAccessEntry::MatchResult expected; 103 OriginAccessEntry::MatchResult expected;
90 } inputs[] = { 104 } inputs[] = {
91 { "http", "example.com", "http://example.com/", OriginAccessEntry::Match esOrigin }, 105 { "http", "example.com", "http://example.com/", OriginAccessEntry::Match esOrigin },
92 { "http", "example.com", "http://www.example.com/", OriginAccessEntry::M atchesOrigin }, 106 { "http", "example.com", "http://www.example.com/", OriginAccessEntry::M atchesOrigin },
93 { "http", "example.com", "http://www.www.example.com/", OriginAccessEntr y::MatchesOrigin }, 107 { "http", "example.com", "http://www.www.example.com/", OriginAccessEntr y::MatchesOrigin },
108 { "http", "www.example.com", "http://example.com/", OriginAccessEntry::D oesNotMatchOrigin },
109 { "http", "www.example.com", "http://www.example.com/", OriginAccessEntr y::MatchesOrigin },
110 { "http", "www.example.com", "http://www.www.example.com/", OriginAccess Entry::MatchesOrigin },
94 { "http", "com", "http://example.com/", OriginAccessEntry::MatchesOrigin ButIsPublicSuffix }, 111 { "http", "com", "http://example.com/", OriginAccessEntry::MatchesOrigin ButIsPublicSuffix },
95 { "http", "com", "http://www.example.com/", OriginAccessEntry::MatchesOr iginButIsPublicSuffix }, 112 { "http", "com", "http://www.example.com/", OriginAccessEntry::MatchesOr iginButIsPublicSuffix },
96 { "http", "com", "http://www.www.example.com/", OriginAccessEntry::Match esOriginButIsPublicSuffix }, 113 { "http", "com", "http://www.www.example.com/", OriginAccessEntry::Match esOriginButIsPublicSuffix },
97 { "https", "example.com", "http://example.com/", OriginAccessEntry::Does NotMatchOrigin }, 114 { "https", "example.com", "http://example.com/", OriginAccessEntry::Does NotMatchOrigin },
98 { "https", "example.com", "http://www.example.com/", OriginAccessEntry:: DoesNotMatchOrigin }, 115 { "https", "example.com", "http://www.example.com/", OriginAccessEntry:: DoesNotMatchOrigin },
99 { "https", "example.com", "http://www.www.example.com/", OriginAccessEnt ry::DoesNotMatchOrigin }, 116 { "https", "example.com", "http://www.www.example.com/", OriginAccessEnt ry::DoesNotMatchOrigin },
100 { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesN otMatchOrigin }, 117 { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesN otMatchOrigin },
101 { "http", "", "http://example.com/", OriginAccessEntry::MatchesOrigin }, 118 { "http", "", "http://example.com/", OriginAccessEntry::MatchesOrigin },
102 { "http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin }, 119 { "http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin },
103 { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOri gin }, 120 { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOri gin },
104 }; 121 };
105 122
106 // Initialize a PSL mock that whitelists any three-letter label as a TLD ('c om', 'org', 'net', etc).
107 OriginAccessEntryTestPlatform platform; 123 OriginAccessEntryTestPlatform platform;
124 platform.setPublicSuffix("com");
108 blink::Platform::initialize(&platform); 125 blink::Platform::initialize(&platform);
109 126
110 for (const auto& test : inputs) { 127 for (const auto& test : inputs) {
111 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin); 128 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin);
112 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin); 129 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin);
113 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Al lowSubdomains); 130 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Al lowSubdomains);
114 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest)); 131 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
115 } 132 }
116 133
117 blink::Platform::shutdown(); 134 blink::Platform::shutdown();
118 } 135 }
119 136
137 TEST(OriginAccessEntryTest, AllowRegisterableDomainsTest)
138 {
139 struct TestCase {
140 const char* protocol;
141 const char* host;
142 const char* origin;
143 OriginAccessEntry::MatchResult expected;
144 } inputs[] = {
145 { "http", "example.com", "http://example.com/", OriginAccessEntry::Match esOrigin },
146 { "http", "example.com", "http://www.example.com/", OriginAccessEntry::M atchesOrigin },
147 { "http", "example.com", "http://www.www.example.com/", OriginAccessEntr y::MatchesOrigin },
148 { "http", "www.example.com", "http://example.com/", OriginAccessEntry::M atchesOrigin },
149 { "http", "www.example.com", "http://www.example.com/", OriginAccessEntr y::MatchesOrigin },
150 { "http", "www.example.com", "http://www.www.example.com/", OriginAccess Entry::MatchesOrigin },
151 { "http", "com", "http://example.com/", OriginAccessEntry::MatchesOrigin ButIsPublicSuffix },
152 { "http", "com", "http://www.example.com/", OriginAccessEntry::MatchesOr iginButIsPublicSuffix },
153 { "http", "com", "http://www.www.example.com/", OriginAccessEntry::Match esOriginButIsPublicSuffix },
154 { "https", "example.com", "http://example.com/", OriginAccessEntry::Does NotMatchOrigin },
155 { "https", "example.com", "http://www.example.com/", OriginAccessEntry:: DoesNotMatchOrigin },
156 { "https", "example.com", "http://www.www.example.com/", OriginAccessEnt ry::DoesNotMatchOrigin },
157 { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesN otMatchOrigin },
158 { "http", "", "http://example.com/", OriginAccessEntry::MatchesOrigin },
159 { "http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin },
160 { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOri gin },
161 };
162
163 OriginAccessEntryTestPlatform platform;
164 platform.setPublicSuffix("com");
165 blink::Platform::initialize(&platform);
166
167 for (const auto& test : inputs) {
168 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin);
169 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Al lowRegisterableDomains);
170
171 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin << ", Domain: " << entry1.registerable().utf8().data());
172 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
173 }
174
175 blink::Platform::shutdown();
176 }
177
178 TEST(OriginAccessEntryTest, AllowRegisterableDomainsTestWithDottedSuffix)
179 {
180 struct TestCase {
181 const char* protocol;
182 const char* host;
183 const char* origin;
184 OriginAccessEntry::MatchResult expected;
185 } inputs[] = {
186 { "http", "example.appspot.com", "http://example.appspot.com/", OriginAc cessEntry::MatchesOrigin },
187 { "http", "example.appspot.com", "http://www.example.appspot.com/", Orig inAccessEntry::MatchesOrigin },
188 { "http", "example.appspot.com", "http://www.www.example.appspot.com/", OriginAccessEntry::MatchesOrigin },
189 { "http", "www.example.appspot.com", "http://example.appspot.com/", Orig inAccessEntry::MatchesOrigin },
190 { "http", "www.example.appspot.com", "http://www.example.appspot.com/", OriginAccessEntry::MatchesOrigin },
191 { "http", "www.example.appspot.com", "http://www.www.example.appspot.com /", OriginAccessEntry::MatchesOrigin },
192 { "http", "appspot.com", "http://example.appspot.com/", OriginAccessEntr y::MatchesOriginButIsPublicSuffix },
193 { "http", "appspot.com", "http://www.example.appspot.com/", OriginAccess Entry::MatchesOriginButIsPublicSuffix },
194 { "http", "appspot.com", "http://www.www.example.appspot.com/", OriginAc cessEntry::MatchesOriginButIsPublicSuffix },
195 { "https", "example.appspot.com", "http://example.appspot.com/", OriginA ccessEntry::DoesNotMatchOrigin },
196 { "https", "example.appspot.com", "http://www.example.appspot.com/", Ori ginAccessEntry::DoesNotMatchOrigin },
197 { "https", "example.appspot.com", "http://www.www.example.appspot.com/", OriginAccessEntry::DoesNotMatchOrigin },
198 { "http", "example.appspot.com", "http://beispiel.de/", OriginAccessEntr y::DoesNotMatchOrigin },
199 { "http", "", "http://example.appspot.com/", OriginAccessEntry::MatchesO rigin },
200 { "http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin },
201 { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOri gin },
202 };
203
204 OriginAccessEntryTestPlatform platform;
205 platform.setPublicSuffix("appspot.com");
206 blink::Platform::initialize(&platform);
207
208 for (const auto& test : inputs) {
209 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin);
210 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Al lowRegisterableDomains);
211
212 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin << ", Domain: " << entry1.registerable().utf8().data());
213 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
214 }
215
216 blink::Platform::shutdown();
217 }
218
120 TEST(OriginAccessEntryTest, DisallowSubdomainsTest) 219 TEST(OriginAccessEntryTest, DisallowSubdomainsTest)
121 { 220 {
122 struct TestCase { 221 struct TestCase {
123 const char* protocol; 222 const char* protocol;
124 const char* host; 223 const char* host;
125 const char* origin; 224 const char* origin;
126 OriginAccessEntry::MatchResult expected; 225 OriginAccessEntry::MatchResult expected;
127 } inputs[] = { 226 } inputs[] = {
128 { "http", "example.com", "http://example.com/", OriginAccessEntry::Match esOrigin }, 227 { "http", "example.com", "http://example.com/", OriginAccessEntry::Match esOrigin },
129 { "http", "example.com", "http://www.example.com/", OriginAccessEntry::D oesNotMatchOrigin }, 228 { "http", "example.com", "http://www.example.com/", OriginAccessEntry::D oesNotMatchOrigin },
130 { "http", "example.com", "http://www.www.example.com/", OriginAccessEntr y::DoesNotMatchOrigin }, 229 { "http", "example.com", "http://www.www.example.com/", OriginAccessEntr y::DoesNotMatchOrigin },
131 { "http", "com", "http://example.com/", OriginAccessEntry::DoesNotMatchO rigin }, 230 { "http", "com", "http://example.com/", OriginAccessEntry::DoesNotMatchO rigin },
132 { "http", "com", "http://www.example.com/", OriginAccessEntry::DoesNotMa tchOrigin }, 231 { "http", "com", "http://www.example.com/", OriginAccessEntry::DoesNotMa tchOrigin },
133 { "http", "com", "http://www.www.example.com/", OriginAccessEntry::DoesN otMatchOrigin }, 232 { "http", "com", "http://www.www.example.com/", OriginAccessEntry::DoesN otMatchOrigin },
134 { "https", "example.com", "http://example.com/", OriginAccessEntry::Does NotMatchOrigin }, 233 { "https", "example.com", "http://example.com/", OriginAccessEntry::Does NotMatchOrigin },
135 { "https", "example.com", "http://www.example.com/", OriginAccessEntry:: DoesNotMatchOrigin }, 234 { "https", "example.com", "http://www.example.com/", OriginAccessEntry:: DoesNotMatchOrigin },
136 { "https", "example.com", "http://www.www.example.com/", OriginAccessEnt ry::DoesNotMatchOrigin }, 235 { "https", "example.com", "http://www.www.example.com/", OriginAccessEnt ry::DoesNotMatchOrigin },
137 { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesN otMatchOrigin }, 236 { "http", "example.com", "http://beispiel.de/", OriginAccessEntry::DoesN otMatchOrigin },
138 { "http", "", "http://example.com/", OriginAccessEntry::DoesNotMatchOrig in }, 237 { "http", "", "http://example.com/", OriginAccessEntry::DoesNotMatchOrig in },
139 { "http", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOrig in }, 238 { "http", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOrig in },
140 { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOri gin }, 239 { "https", "", "http://beispiel.de/", OriginAccessEntry::DoesNotMatchOri gin },
141 }; 240 };
142 241
143 // Initialize a PSL mock that whitelists any three-letter label as a TLD ('c om', 'org', 'net', etc).
144 OriginAccessEntryTestPlatform platform; 242 OriginAccessEntryTestPlatform platform;
243 platform.setPublicSuffix("com");
145 blink::Platform::initialize(&platform); 244 blink::Platform::initialize(&platform);
146 245
147 for (const auto& test : inputs) { 246 for (const auto& test : inputs) {
148 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin); 247 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin);
149 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin); 248 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin);
150 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Di sallowSubdomains); 249 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Di sallowSubdomains);
151 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest)); 250 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
152 } 251 }
153 252
154 blink::Platform::shutdown(); 253 blink::Platform::shutdown();
(...skipping 10 matching lines...) Expand all
165 { "http", "1.1.1.1.1", false }, 264 { "http", "1.1.1.1.1", false },
166 { "http", "example.com", false }, 265 { "http", "example.com", false },
167 { "http", "hostname.that.ends.with.a.number1", false }, 266 { "http", "hostname.that.ends.with.a.number1", false },
168 { "http", "2001:db8::1", false }, 267 { "http", "2001:db8::1", false },
169 { "http", "[2001:db8::1]", true }, 268 { "http", "[2001:db8::1]", true },
170 { "http", "2001:db8::a", false }, 269 { "http", "2001:db8::a", false },
171 { "http", "[2001:db8::a]", true }, 270 { "http", "[2001:db8::a]", true },
172 { "http", "", false }, 271 { "http", "", false },
173 }; 272 };
174 273
175 // Initialize a PSL mock that whitelists any three-letter label as a TLD ('c om', 'org', 'net', etc).
176 OriginAccessEntryTestPlatform platform; 274 OriginAccessEntryTestPlatform platform;
275 platform.setPublicSuffix("com");
177 blink::Platform::initialize(&platform); 276 blink::Platform::initialize(&platform);
178 277
179 for (const auto& test : inputs) { 278 for (const auto& test : inputs) {
180 SCOPED_TRACE(testing::Message() << "Host: " << test.host); 279 SCOPED_TRACE(testing::Message() << "Host: " << test.host);
181 OriginAccessEntry entry(test.protocol, test.host, OriginAccessEntry::Dis allowSubdomains); 280 OriginAccessEntry entry(test.protocol, test.host, OriginAccessEntry::Dis allowSubdomains);
182 EXPECT_EQ(test.isIPAddress, entry.hostIsIPAddress()) << test.host; 281 EXPECT_EQ(test.isIPAddress, entry.hostIsIPAddress()) << test.host;
183 } 282 }
184 283
185 blink::Platform::shutdown(); 284 blink::Platform::shutdown();
186 } 285 }
187 286
188 TEST(OriginAccessEntryTest, IPAddressMatchingTest) 287 TEST(OriginAccessEntryTest, IPAddressMatchingTest)
189 { 288 {
190 struct TestCase { 289 struct TestCase {
191 const char* protocol; 290 const char* protocol;
192 const char* host; 291 const char* host;
193 const char* origin; 292 const char* origin;
194 OriginAccessEntry::MatchResult expected; 293 OriginAccessEntry::MatchResult expected;
195 } inputs[] = { 294 } inputs[] = {
196 { "http", "192.0.0.123", "http://192.0.0.123/", OriginAccessEntry::Match esOrigin }, 295 { "http", "192.0.0.123", "http://192.0.0.123/", OriginAccessEntry::Match esOrigin },
197 { "http", "0.0.123", "http://192.0.0.123/", OriginAccessEntry::DoesNotMa tchOrigin }, 296 { "http", "0.0.123", "http://192.0.0.123/", OriginAccessEntry::DoesNotMa tchOrigin },
198 { "http", "0.123", "http://192.0.0.123/", OriginAccessEntry::DoesNotMatc hOrigin }, 297 { "http", "0.123", "http://192.0.0.123/", OriginAccessEntry::DoesNotMatc hOrigin },
199 { "http", "1.123", "http://192.0.0.123/", OriginAccessEntry::DoesNotMatc hOrigin }, 298 { "http", "1.123", "http://192.0.0.123/", OriginAccessEntry::DoesNotMatc hOrigin },
200 }; 299 };
201 300
202 // Initialize a PSL mock that whitelists any three-letter label as a TLD ('. 123', etc).
203 OriginAccessEntryTestPlatform platform; 301 OriginAccessEntryTestPlatform platform;
302 platform.setPublicSuffix("com");
204 blink::Platform::initialize(&platform); 303 blink::Platform::initialize(&platform);
205 304
206 for (const auto& test : inputs) { 305 for (const auto& test : inputs) {
207 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin); 306 SCOPED_TRACE(testing::Message() << "Host: " << test.host << ", Origin: " << test.origin);
208 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin); 307 RefPtr<SecurityOrigin> originToTest = SecurityOrigin::createFromString(t est.origin);
209 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Al lowSubdomains); 308 OriginAccessEntry entry1(test.protocol, test.host, OriginAccessEntry::Al lowSubdomains);
210 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest)); 309 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
211 310
212 OriginAccessEntry entry2(test.protocol, test.host, OriginAccessEntry::Di sallowSubdomains); 311 OriginAccessEntry entry2(test.protocol, test.host, OriginAccessEntry::Di sallowSubdomains);
213 EXPECT_EQ(test.expected, entry2.matchesOrigin(*originToTest)); 312 EXPECT_EQ(test.expected, entry2.matchesOrigin(*originToTest));
214 } 313 }
215 314
216 blink::Platform::shutdown(); 315 blink::Platform::shutdown();
217 } 316 }
218 317
219 } // namespace 318 } // namespace
220 319
OLDNEW
« no previous file with comments | « Source/platform/weborigin/OriginAccessEntry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698