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

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 SecurityPolicy::generateReferrer(ReferrerPolicyAlways, exampleHttpUrl, 44 SecurityPolicy::generateReferrer(ReferrerPolicyAlways, exampleHttpUrl,
45 String::fromUTF8("chrome://somepage/")) 45 String::fromUTF8("chrome://somepage/"))
46 .referrer); 46 .referrer);
47 } 47 }
48 48
49 TEST(SecurityPolicyTest, GenerateReferrerRespectsReferrerSchemesRegistry) { 49 TEST(SecurityPolicyTest, GenerateReferrerRespectsReferrerSchemesRegistry) {
50 const KURL exampleHttpUrl = KURL(ParsedURLString, "http://example.com/"); 50 const KURL exampleHttpUrl = KURL(ParsedURLString, "http://example.com/");
51 const String foobarURL = String::fromUTF8("foobar://somepage/"); 51 const String foobarURL = String::fromUTF8("foobar://somepage/");
52 const String foobarScheme = String::fromUTF8("foobar"); 52 const String foobarScheme = String::fromUTF8("foobar");
53 53
54 EXPECT_EQ(String(), SecurityPolicy::generateReferrer( 54 EXPECT_EQ(String(),
55 ReferrerPolicyAlways, exampleHttpUrl, foobarURL) 55 SecurityPolicy::generateReferrer(ReferrerPolicyAlways,
56 .referrer); 56 exampleHttpUrl, foobarURL)
57 .referrer);
57 SchemeRegistry::registerURLSchemeAsAllowedForReferrer(foobarScheme); 58 SchemeRegistry::registerURLSchemeAsAllowedForReferrer(foobarScheme);
58 EXPECT_EQ(foobarURL, SecurityPolicy::generateReferrer( 59 EXPECT_EQ(foobarURL,
59 ReferrerPolicyAlways, exampleHttpUrl, foobarURL) 60 SecurityPolicy::generateReferrer(ReferrerPolicyAlways,
60 .referrer); 61 exampleHttpUrl, foobarURL)
62 .referrer);
61 SchemeRegistry::removeURLSchemeAsAllowedForReferrer(foobarScheme); 63 SchemeRegistry::removeURLSchemeAsAllowedForReferrer(foobarScheme);
62 } 64 }
63 65
64 TEST(SecurityPolicyTest, ShouldHideReferrerRespectsReferrerSchemesRegistry) { 66 TEST(SecurityPolicyTest, ShouldHideReferrerRespectsReferrerSchemesRegistry) {
65 const KURL exampleHttpUrl = KURL(ParsedURLString, "http://example.com/"); 67 const KURL exampleHttpUrl = KURL(ParsedURLString, "http://example.com/");
66 const KURL foobarURL = KURL(KURL(), "foobar://somepage/"); 68 const KURL foobarURL = KURL(KURL(), "foobar://somepage/");
67 const String foobarScheme = String::fromUTF8("foobar"); 69 const String foobarScheme = String::fromUTF8("foobar");
68 70
69 EXPECT_TRUE(SecurityPolicy::shouldHideReferrer(exampleHttpUrl, foobarURL)); 71 EXPECT_TRUE(SecurityPolicy::shouldHideReferrer(exampleHttpUrl, foobarURL));
70 SchemeRegistry::registerURLSchemeAsAllowedForReferrer(foobarScheme); 72 SchemeRegistry::registerURLSchemeAsAllowedForReferrer(foobarScheme);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 218
217 EXPECT_FALSE(origin1->isPotentiallyTrustworthy()); 219 EXPECT_FALSE(origin1->isPotentiallyTrustworthy());
218 EXPECT_FALSE(origin2->isPotentiallyTrustworthy()); 220 EXPECT_FALSE(origin2->isPotentiallyTrustworthy());
219 SecurityPolicy::addOriginTrustworthyWhiteList(origin1); 221 SecurityPolicy::addOriginTrustworthyWhiteList(origin1);
220 EXPECT_TRUE(origin1->isPotentiallyTrustworthy()); 222 EXPECT_TRUE(origin1->isPotentiallyTrustworthy());
221 EXPECT_TRUE(origin2->isPotentiallyTrustworthy()); 223 EXPECT_TRUE(origin2->isPotentiallyTrustworthy());
222 } 224 }
223 } 225 }
224 226
225 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698