Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 EXPECT_TRUE(file1->isSameSchemeHostPort(file2.get())); | 74 EXPECT_TRUE(file1->isSameSchemeHostPort(file2.get())); |
| 75 EXPECT_TRUE(file2->isSameSchemeHostPort(file1.get())); | 75 EXPECT_TRUE(file2->isSameSchemeHostPort(file1.get())); |
| 76 | 76 |
| 77 EXPECT_TRUE(file1->canAccess(file1.get())); | 77 EXPECT_TRUE(file1->canAccess(file1.get())); |
| 78 EXPECT_TRUE(file1->canAccess(file2.get())); | 78 EXPECT_TRUE(file1->canAccess(file2.get())); |
| 79 EXPECT_TRUE(file2->canAccess(file1.get())); | 79 EXPECT_TRUE(file2->canAccess(file1.get())); |
| 80 | 80 |
| 81 // Block |file1|'s access to local origins. It should now be same-origin | 81 // Block |file1|'s access to local origins. It should now be same-origin |
| 82 // with itself, but shouldn't have access to |file2|. | 82 // with itself, but shouldn't have access to |file2|. |
| 83 file1->blockLocalAccessFromLocalOrigin(); | 83 file1->blockLocalAccessFromLocalOrigin(); |
| 84 EXPECT_FALSE(file1->isSameSchemeHostPort(file1.get())); | 84 EXPECT_TRUE(file1->isSameSchemeHostPort(file1.get())); |
| 85 EXPECT_FALSE(file1->isSameSchemeHostPort(file2.get())); | 85 EXPECT_FALSE(file1->isSameSchemeHostPort(file2.get())); |
| 86 EXPECT_FALSE(file2->isSameSchemeHostPort(file1.get())); | 86 EXPECT_FALSE(file2->isSameSchemeHostPort(file1.get())); |
| 87 | 87 |
| 88 EXPECT_TRUE(file1->canAccess(file1.get())); | 88 EXPECT_TRUE(file1->canAccess(file1.get())); |
| 89 EXPECT_FALSE(file1->canAccess(file2.get())); | 89 EXPECT_FALSE(file1->canAccess(file2.get())); |
| 90 EXPECT_FALSE(file2->canAccess(file1.get())); | 90 EXPECT_FALSE(file2->canAccess(file1.get())); |
| 91 } | 91 } |
| 92 | 92 |
| 93 TEST_F(SecurityOriginTest, IsPotentiallyTrustworthy) | 93 TEST_F(SecurityOriginTest, IsPotentiallyTrustworthy) |
| 94 { | 94 { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 EXPECT_EQ(test.expectedOriginString, origin->toString()); | 428 EXPECT_EQ(test.expectedOriginString, origin->toString()); |
| 429 | 429 |
| 430 KURL blobUrl = BlobURL::createPublicURL(origin.get()); | 430 KURL blobUrl = BlobURL::createPublicURL(origin.get()); |
| 431 RefPtr<SecurityOrigin> blobUrlOrigin = SecurityOrigin::create(blobUrl); | 431 RefPtr<SecurityOrigin> blobUrlOrigin = SecurityOrigin::create(blobUrl); |
| 432 EXPECT_EQ(blobUrlOrigin->isUnique(), origin->isUnique()); | 432 EXPECT_EQ(blobUrlOrigin->isUnique(), origin->isUnique()); |
| 433 EXPECT_EQ(blobUrlOrigin->toString(), origin->toString()); | 433 EXPECT_EQ(blobUrlOrigin->toString(), origin->toString()); |
| 434 EXPECT_EQ(blobUrlOrigin->toRawString(), origin->toRawString()); | 434 EXPECT_EQ(blobUrlOrigin->toRawString(), origin->toRawString()); |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 | 437 |
| 438 TEST_F(SecurityOriginTest, UniqueOriginIsSameSchemeHostPort) | |
| 439 { | |
| 440 RefPtr<SecurityOrigin> uniqueOrigin = SecurityOrigin::createUnique(); | |
| 441 RefPtr<SecurityOrigin> tupleOrigin = SecurityOrigin::createFromString("http: //example.com"); | |
| 442 | |
| 443 EXPECT_TRUE(uniqueOrigin->isSameSchemeHostPort(uniqueOrigin.get())); | |
|
Mike West
2016/06/03 05:22:04
Why is this true? I'd expect it to be false (becau
Marijn Kruisselbrink
2016/06/03 05:25:11
According to the HTML specification of origins an
| |
| 444 EXPECT_FALSE(SecurityOrigin::createUnique()->isSameSchemeHostPort(uniqueOrig in.get())); | |
| 445 EXPECT_FALSE(tupleOrigin->isSameSchemeHostPort(uniqueOrigin.get())); | |
| 446 EXPECT_FALSE(uniqueOrigin->isSameSchemeHostPort(tupleOrigin.get())); | |
| 447 } | |
| 448 | |
| 438 } // namespace blink | 449 } // namespace blink |
| OLD | NEW |