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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 {"http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin, 132 {"http", "", "http://beispiel.de/", OriginAccessEntry::MatchesOrigin,
133 OriginAccessEntry::MatchesOrigin}, 133 OriginAccessEntry::MatchesOrigin},
134 {"https", "", "http://beispiel.de/", 134 {"https", "", "http://beispiel.de/",
135 OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::MatchesOrigin}, 135 OriginAccessEntry::DoesNotMatchOrigin, OriginAccessEntry::MatchesOrigin},
136 }; 136 };
137 137
138 ScopedTestingPlatformSupport<OriginAccessEntryTestPlatform> platform; 138 ScopedTestingPlatformSupport<OriginAccessEntryTestPlatform> platform;
139 platform->setPublicSuffix("com"); 139 platform->setPublicSuffix("com");
140 140
141 for (const auto& test : inputs) { 141 for (const auto& test : inputs) {
142 SCOPED_TRACE(testing::Message() << "Host: " << test.host 142 SCOPED_TRACE(testing::Message()
143 << ", Origin: " << test.origin); 143 << "Host: " << test.host << ", Origin: " << test.origin);
144 RefPtr<SecurityOrigin> originToTest = 144 RefPtr<SecurityOrigin> originToTest =
145 SecurityOrigin::createFromString(test.origin); 145 SecurityOrigin::createFromString(test.origin);
146 OriginAccessEntry entry1(test.protocol, test.host, 146 OriginAccessEntry entry1(test.protocol, test.host,
147 OriginAccessEntry::AllowSubdomains); 147 OriginAccessEntry::AllowSubdomains);
148 EXPECT_EQ(test.expectedOrigin, entry1.matchesOrigin(*originToTest)); 148 EXPECT_EQ(test.expectedOrigin, entry1.matchesOrigin(*originToTest));
149 EXPECT_EQ(test.expectedDomain, entry1.matchesDomain(*originToTest)); 149 EXPECT_EQ(test.expectedDomain, entry1.matchesDomain(*originToTest));
150 } 150 }
151 } 151 }
152 152
153 TEST(OriginAccessEntryTest, AllowRegisterableDomainsTest) { 153 TEST(OriginAccessEntryTest, AllowRegisterableDomainsTest) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 {"http", "", "http://beispiel.de/", 293 {"http", "", "http://beispiel.de/",
294 OriginAccessEntry::DoesNotMatchOrigin}, 294 OriginAccessEntry::DoesNotMatchOrigin},
295 {"https", "", "http://beispiel.de/", 295 {"https", "", "http://beispiel.de/",
296 OriginAccessEntry::DoesNotMatchOrigin}, 296 OriginAccessEntry::DoesNotMatchOrigin},
297 }; 297 };
298 298
299 ScopedTestingPlatformSupport<OriginAccessEntryTestPlatform> platform; 299 ScopedTestingPlatformSupport<OriginAccessEntryTestPlatform> platform;
300 platform->setPublicSuffix("com"); 300 platform->setPublicSuffix("com");
301 301
302 for (const auto& test : inputs) { 302 for (const auto& test : inputs) {
303 SCOPED_TRACE(testing::Message() << "Host: " << test.host 303 SCOPED_TRACE(testing::Message()
304 << ", Origin: " << test.origin); 304 << "Host: " << test.host << ", Origin: " << test.origin);
305 RefPtr<SecurityOrigin> originToTest = 305 RefPtr<SecurityOrigin> originToTest =
306 SecurityOrigin::createFromString(test.origin); 306 SecurityOrigin::createFromString(test.origin);
307 OriginAccessEntry entry1(test.protocol, test.host, 307 OriginAccessEntry entry1(test.protocol, test.host,
308 OriginAccessEntry::DisallowSubdomains); 308 OriginAccessEntry::DisallowSubdomains);
309 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest)); 309 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
310 } 310 }
311 } 311 }
312 312
313 TEST(OriginAccessEntryTest, IPAddressTest) { 313 TEST(OriginAccessEntryTest, IPAddressTest) {
314 struct TestCase { 314 struct TestCase {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 {"http", "0.123", "http://192.0.0.123/", 352 {"http", "0.123", "http://192.0.0.123/",
353 OriginAccessEntry::DoesNotMatchOrigin}, 353 OriginAccessEntry::DoesNotMatchOrigin},
354 {"http", "1.123", "http://192.0.0.123/", 354 {"http", "1.123", "http://192.0.0.123/",
355 OriginAccessEntry::DoesNotMatchOrigin}, 355 OriginAccessEntry::DoesNotMatchOrigin},
356 }; 356 };
357 357
358 ScopedTestingPlatformSupport<OriginAccessEntryTestPlatform> platform; 358 ScopedTestingPlatformSupport<OriginAccessEntryTestPlatform> platform;
359 platform->setPublicSuffix("com"); 359 platform->setPublicSuffix("com");
360 360
361 for (const auto& test : inputs) { 361 for (const auto& test : inputs) {
362 SCOPED_TRACE(testing::Message() << "Host: " << test.host 362 SCOPED_TRACE(testing::Message()
363 << ", Origin: " << test.origin); 363 << "Host: " << test.host << ", Origin: " << test.origin);
364 RefPtr<SecurityOrigin> originToTest = 364 RefPtr<SecurityOrigin> originToTest =
365 SecurityOrigin::createFromString(test.origin); 365 SecurityOrigin::createFromString(test.origin);
366 OriginAccessEntry entry1(test.protocol, test.host, 366 OriginAccessEntry entry1(test.protocol, test.host,
367 OriginAccessEntry::AllowSubdomains); 367 OriginAccessEntry::AllowSubdomains);
368 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest)); 368 EXPECT_EQ(test.expected, entry1.matchesOrigin(*originToTest));
369 369
370 OriginAccessEntry entry2(test.protocol, test.host, 370 OriginAccessEntry entry2(test.protocol, test.host,
371 OriginAccessEntry::DisallowSubdomains); 371 OriginAccessEntry::DisallowSubdomains);
372 EXPECT_EQ(test.expected, entry2.matchesOrigin(*originToTest)); 372 EXPECT_EQ(test.expected, entry2.matchesOrigin(*originToTest));
373 } 373 }
374 } 374 }
375 375
376 } // namespace blink 376 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698