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

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

Issue 1723753002: Make Document::isSecureContext() work for OOPIFs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more rebase fixups Created 4 years, 9 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 for (size_t i = 0; i < WTF_ARRAY_LENGTH(inputs); ++i) { 156 for (size_t i = 0; i < WTF_ARRAY_LENGTH(inputs); ++i) {
157 SCOPED_TRACE(i); 157 SCOPED_TRACE(i);
158 RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(inputs[ i].url); 158 RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(inputs[ i].url);
159 String errorMessage; 159 String errorMessage;
160 EXPECT_EQ(inputs[i].accessGranted, origin->isPotentiallyTrustworthy()); 160 EXPECT_EQ(inputs[i].accessGranted, origin->isPotentiallyTrustworthy());
161 } 161 }
162 162
163 // Unique origins are not considered secure. 163 // Unique origins are not considered secure.
164 RefPtr<SecurityOrigin> uniqueOrigin = SecurityOrigin::createUnique(); 164 RefPtr<SecurityOrigin> uniqueOrigin = SecurityOrigin::createUnique();
165 EXPECT_FALSE(uniqueOrigin->isPotentiallyTrustworthy()); 165 EXPECT_FALSE(uniqueOrigin->isPotentiallyTrustworthy());
166 // ... unless they are specially marked as such.
167 uniqueOrigin->setUniqueOriginIsPotentiallyTrustworthy(true);
168 EXPECT_TRUE(uniqueOrigin->isPotentiallyTrustworthy());
169 uniqueOrigin->setUniqueOriginIsPotentiallyTrustworthy(false);
170 EXPECT_FALSE(uniqueOrigin->isPotentiallyTrustworthy());
166 } 171 }
167 172
168 TEST_F(SecurityOriginTest, IsSecure) 173 TEST_F(SecurityOriginTest, IsSecure)
169 { 174 {
170 struct TestCase { 175 struct TestCase {
171 bool isSecure; 176 bool isSecure;
172 const char* url; 177 const char* url;
173 } inputs[] = { 178 } inputs[] = {
174 { false, "blob:ftp://evil:99/578223a1-8c13-17b3-84d5-eca045ae384a" }, 179 { false, "blob:ftp://evil:99/578223a1-8c13-17b3-84d5-eca045ae384a" },
175 { false, "blob:http://example.com/578223a1-8c13-17b3-84d5-eca045ae384a" }, 180 { false, "blob:http://example.com/578223a1-8c13-17b3-84d5-eca045ae384a" },
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 413
409 KURL blobUrl = BlobURL::createPublicURL(origin.get()); 414 KURL blobUrl = BlobURL::createPublicURL(origin.get());
410 RefPtr<SecurityOrigin> blobUrlOrigin = SecurityOrigin::create(blobUrl); 415 RefPtr<SecurityOrigin> blobUrlOrigin = SecurityOrigin::create(blobUrl);
411 EXPECT_EQ(blobUrlOrigin->isUnique(), origin->isUnique()); 416 EXPECT_EQ(blobUrlOrigin->isUnique(), origin->isUnique());
412 EXPECT_EQ(blobUrlOrigin->toString(), origin->toString()); 417 EXPECT_EQ(blobUrlOrigin->toString(), origin->toString());
413 EXPECT_EQ(blobUrlOrigin->toRawString(), origin->toRawString()); 418 EXPECT_EQ(blobUrlOrigin->toRawString(), origin->toRawString());
414 } 419 }
415 } 420 }
416 421
417 } // namespace blink 422 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp ('k') | third_party/WebKit/Source/web/FrameLoaderClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698