Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/common/origin_util.h" | 5 #include "content/public/common/origin_util.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "url/gurl.h" | 7 #include "url/gurl.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 EXPECT_FALSE( | 41 EXPECT_FALSE( |
| 42 IsOriginSecure(GURL("filesystem:http://www.example.com/temporary/"))); | 42 IsOriginSecure(GURL("filesystem:http://www.example.com/temporary/"))); |
| 43 EXPECT_FALSE( | 43 EXPECT_FALSE( |
| 44 IsOriginSecure(GURL("filesystem:ftp://www.example.com/temporary/"))); | 44 IsOriginSecure(GURL("filesystem:ftp://www.example.com/temporary/"))); |
| 45 EXPECT_TRUE(IsOriginSecure(GURL("filesystem:ftp://127.0.0.1/temporary/"))); | 45 EXPECT_TRUE(IsOriginSecure(GURL("filesystem:ftp://127.0.0.1/temporary/"))); |
| 46 EXPECT_TRUE( | 46 EXPECT_TRUE( |
| 47 IsOriginSecure(GURL("filesystem:https://www.example.com/temporary/"))); | 47 IsOriginSecure(GURL("filesystem:https://www.example.com/temporary/"))); |
| 48 } | 48 } |
| 49 | 49 |
| 50 TEST(OriginUtilTest, Suborigins) { | |
| 51 GURL no_suborigin_url("https://example.com"); | |
| 52 GURL suborigin_url("https-so://foobar.example.com"); | |
|
nasko
2016/09/26 22:54:55
Should "https-so://foo.com" succeed?
jww
2016/09/28 23:35:15
Yes, it should. These are meant to be pure parsing
| |
| 53 | |
| 54 EXPECT_FALSE(HasSuborigin(no_suborigin_url)); | |
| 55 EXPECT_TRUE(HasSuborigin(suborigin_url)); | |
| 56 | |
| 57 EXPECT_EQ("", SuboriginFromUrl(no_suborigin_url)); | |
| 58 EXPECT_EQ("foobar", SuboriginFromUrl(suborigin_url)); | |
| 59 | |
| 60 EXPECT_EQ(no_suborigin_url, UrlStripSuborigin(no_suborigin_url)); | |
| 61 EXPECT_EQ(no_suborigin_url, UrlStripSuborigin(suborigin_url)); | |
| 62 } | |
|
nasko
2016/09/26 22:54:55
What about some negative test cases? "https-so://.
jww
2016/09/28 23:35:15
Done.
| |
| 63 | |
| 50 } // namespace content | 64 } // namespace content |
| OLD | NEW |